Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/managers/ParticipantManager/ParticipantManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
<div>
<DropdownActions
:actions="participantManagerStore.itemActions"
:actions="participantManagerStore.itemActions(participant)"
:label="`${participant.fullName} ${t('common.moreActions')}`"
:display-as-ellipsis="true"
@action="
Expand Down
10 changes: 7 additions & 3 deletions src/managers/ParticipantManager/participantManagerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const useParticipantManagerStore = defineComponentStore(
const submissionId = ref(props.submission.id);

const relativeUrl = computed(() => {
return `submissions/${encodeURIComponent(submissionId.value)}/participants/${props.submissionStageId}`;
return `submissions/${encodeURIComponent(submissionId.value)}/participants/${props.submissionStageId}?includeCanLoginAs=1&includeGossip=1`;
});

const {apiUrl: participantApiUrl} = useUrl(relativeUrl);
Expand Down Expand Up @@ -50,7 +50,8 @@ export const useParticipantManagerStore = defineComponentStore(
roleId: stageAssignment.stageAssignmentUserGroup.roleId,
userGroupId: stageAssignment.stageAssignmentUserGroup.id,
recommendOnly: stageAssignment.recommendOnly,
displayInitials: participant.displayInitials,
canLoginAs: participant.canLoginAs,
canGossip: participant.canGossip,
});
});
});
Expand All @@ -74,7 +75,10 @@ export const useParticipantManagerStore = defineComponentStore(

const _actionFns = useParticipantManagerActions();

const itemActions = computed(() => _actionFns.getItemActions({}));
const itemActions = (participant) => {
return _actionFns.getItemActions(participant);
};


function enrichActionArg(args) {
return {
Expand Down
21 changes: 13 additions & 8 deletions src/managers/ParticipantManager/useParticipantManagerActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,16 @@ export function useParticipantManagerActions() {
});
}

function getItemActions() {
// take participant as a parameter
function getItemActions(participant) {
const {t} = useLocalize();

const actions = [];
console.log('Participant ID:', participant.id, 'canLoginAs:', participant.canLoginAs, 'Type:', typeof participant.canLoginAs);


// [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR],
const {hasCurrentUserAtLeastOneRole} = useCurrentUser();

const canAdminister = hasCurrentUserAtLeastOneRole([
pkp.const.ROLE_ID_MANAGER,
pkp.const.ROLE_ID_SITE_ADMIN,
Expand All @@ -197,12 +199,15 @@ export function useParticipantManagerActions() {
icon: 'Email',
});

// TODO https://github.com/pkp/pkp-lib/issues/10290
actions.push({
label: t('grid.action.logInAs'),
name: Actions.PARTICIPANT_LOGIN_AS,
icon: 'LoginAs',
});
// show "Login As" if participant.canLoginAs is true
if (
participant.canLoginAs === true) {
actions.push({
label: t('grid.action.logInAs'),
name: Actions.PARTICIPANT_LOGIN_AS,
icon: 'LoginAs',
});
}

if (canAdminister) {
actions.push({
Expand Down
12 changes: 7 additions & 5 deletions src/managers/ReviewerManager/useReviewerManagerActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ export function useReviewerManagerActions() {
});

// Login as TODO condition
actions.push({
label: t('grid.action.logInAs'),
name: Actions.REVIEWER_LOGIN_AS,
icon: 'LoginAs',
});
if (reviewAssignment.canLoginAs) {
actions.push({
label: t('grid.action.logInAs'),
name: Actions.REVIEWER_LOGIN_AS,
icon: 'LoginAs',
});
}

// Gossip TODO condition
actions.push({
Expand Down
Loading