Skip to content

Commit ab9e907

Browse files
committed
pkp/pkp-lib#4787 consider case when adding new reviewer who is an existing suggestion
1 parent 4691f08 commit ab9e907

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

src/components/ListPanel/users/SelectReviewerSuggestionListItem.vue

+19
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
<!-- TODO: check alternative of v-html as v-strip-unsafe-html not working -->
1515
<div v-html="suggestionReason"></div>
1616
</div>
17+
18+
<div v-if="currentlyAssigned" class="listPanel__item--reviewer__notice">
19+
<Icon icon="Error" class="me-1 h-4 w-4" :inline="true" />
20+
<span class="align-middle">{{ currentlyAssignedLabel }}</span>
21+
</div>
1722
</div>
1823

1924
<div class="listPanel__itemActions">
@@ -30,6 +35,7 @@
3035

3136
<script>
3237
import PkpButton from '@/components/Button/Button.vue';
38+
import Icon from '@/components/Icon/Icon.vue';
3339
import ajaxError from '@/mixins/ajaxError';
3440
import dialog from '@/mixins/dialog.js';
3541
import {useLegacyGridUrl} from '@/composables/useLegacyGridUrl';
@@ -38,6 +44,7 @@ import {useLocalize} from '@/composables/useLocalize';
3844
export default {
3945
components: {
4046
PkpButton,
47+
Icon,
4148
},
4249
mixins: [ajaxError, dialog],
4350
props: {
@@ -61,6 +68,14 @@ export default {
6168
type: String,
6269
required: true,
6370
},
71+
currentlyAssigned: {
72+
type: Boolean,
73+
required: true,
74+
},
75+
currentlyAssignedLabel: {
76+
type: String,
77+
required: true,
78+
},
6479
},
6580
data() {
6681
return {};
@@ -75,6 +90,10 @@ export default {
7590
* @return {Boolean}
7691
*/
7792
canSelect() {
93+
if (this.currentlyAssigned) {
94+
return false;
95+
}
96+
7897
if (this.approvedAt === null || this.approvedAt === undefined) {
7998
return true;
8099
}

src/managers/ReviewerSuggestionManager/reviewerSuggestionManagerStore.js

+17-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(
1717
const submissionId = ref(props.submission.id);
1818

1919
const relativeUrl = computed(() => {
20-
return `submissions/${encodeURIComponent(submissionId.value)}/reviewers/suggestions?approved=false`;
20+
if (props.reviewRoundId) {
21+
return `submissions/${encodeURIComponent(submissionId.value)}/reviewers/suggestions?approved=false`;
22+
}
23+
return `submissions/${encodeURIComponent(submissionId.value)}/reviewers/suggestions`;
2124
});
2225

2326
const {apiUrl: reviewerSuggestionApiUrl} = useUrl(relativeUrl);
@@ -45,16 +48,20 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(
4548

4649
const list = [];
4750

48-
reviewerSuggestions.value.items.forEach((reviewerSuggestion) => {
49-
list.push({
50-
id: reviewerSuggestion.id,
51-
fullName: localize(reviewerSuggestion.fullName),
52-
affiliation: localize(reviewerSuggestion.affiliation),
53-
suggestionReason: localize(reviewerSuggestion.suggestionReason),
54-
existingReviewerRole: reviewerSuggestion.existingReviewerRole,
55-
existingUserId: reviewerSuggestion.existingUserId,
51+
reviewerSuggestions.value.items
52+
.filter((reviewerSuggestion) =>
53+
props.reviewRoundId ? !reviewerSuggestion.reviewerId : true,
54+
)
55+
.forEach((reviewerSuggestion) => {
56+
list.push({
57+
id: reviewerSuggestion.id,
58+
fullName: localize(reviewerSuggestion.fullName),
59+
affiliation: localize(reviewerSuggestion.affiliation),
60+
suggestionReason: localize(reviewerSuggestion.suggestionReason),
61+
existingReviewerRole: reviewerSuggestion.existingReviewerRole,
62+
existingUserId: reviewerSuggestion.existingUserId,
63+
});
5664
});
57-
});
5865

5966
return list;
6067
});

0 commit comments

Comments
 (0)