Skip to content

Commit

Permalink
landing page: swap username by ID to manage user.
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandromumo authored and slint committed Oct 16, 2024
1 parent ab9a69a commit 88ec8b1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
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}`}
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

0 comments on commit 88ec8b1

Please sign in to comment.