Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

landing page: swap username by ID to manage user. #2879

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
data-is-draft="{{ is_draft | tojson }}"
data-is-preview-submission-request="{{ is_preview_submission_request | tojson }}"
data-current-user-id="{{ current_user.id }}"
data-record-owner-username='{{ record_owner_username }}'
data-record-owner-id='{{ record_owner_id }}'
data-groups-enabled='{{ config.USERS_RESOURCES_GROUPS_ENABLED | tojson }}'
>
<div class="ui placeholder">
Expand Down
4 changes: 2 additions & 2 deletions invenio_app_rdm/records_ui/views/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def record_detail(
community=resolved_community,
external_resources=get_external_resources(record),
user_avatar=avatar,
record_owner_username=(
record_owner.get("username")
record_owner_id=(
record_owner.get("id")
), # record created with system_identity have not owners e.g demo
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Dropdown } from "semantic-ui-react";
import { i18next } from "@translations/invenio_app_rdm/i18next";
import PropTypes from "prop-types";

export const ManageButton = ({ recid, recordOwnerUsername }) => {
export const ManageButton = ({ recid, recordOwnerID }) => {
return (
<Dropdown
fluid
Expand All @@ -30,7 +30,7 @@ export const ManageButton = ({ recid, recordOwnerUsername }) => {
/>
<Dropdown.Item
as="a"
href={`/administration/users?q=username:${recordOwnerUsername}`}
href={`/administration/users?q=id:${recordOwnerID}`}
slint marked this conversation as resolved.
Show resolved Hide resolved
target="_blank"
key="manage_user"
text={i18next.t("Manage user")}
Expand All @@ -42,5 +42,5 @@ export const ManageButton = ({ recid, recordOwnerUsername }) => {

ManageButton.propTypes = {
recid: PropTypes.string.isRequired,
recordOwnerUsername: PropTypes.string.isRequired,
recordOwnerID: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class RecordManagement extends Component {
isDraft,
isPreviewSubmissionRequest,
currentUserId,
recordOwnerUsername,
recordOwnerID,
groupsEnabled,
} = this.props;
const { error } = this.state;
Expand All @@ -46,7 +46,7 @@ export class RecordManagement extends Component {
<Grid columns={1} className="record-management">
{permissions.can_moderate && (
<Grid.Column className="pb-5">
<ManageButton recid={recid} recordOwnerUsername={recordOwnerUsername} />
<ManageButton recid={recid} recordOwnerID={recordOwnerID} />
</Grid.Column>
)}
{permissions.can_edit && !isDraft && (
Expand Down Expand Up @@ -118,5 +118,5 @@ RecordManagement.propTypes = {
groupsEnabled: PropTypes.bool.isRequired,
isPreviewSubmissionRequest: PropTypes.bool.isRequired,
currentUserId: PropTypes.string.isRequired,
recordOwnerUsername: PropTypes.object.isRequired,
recordOwnerID: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function renderRecordManagement(element) {
recordManagementAppDiv.dataset.isPreviewSubmissionRequest
)}
currentUserId={recordManagementAppDiv.dataset.currentUserId}
recordOwnerUsername={recordManagementAppDiv.dataset.recordOwnerUsername}
recordOwnerID={recordManagementAppDiv.dataset.recordOwnerId}
groupsEnabled={JSON.parse(recordManagementAppDiv.dataset.groupsEnabled)}
/>
</OverridableContext.Provider>,
Expand Down
Loading