Skip to content

Commit

Permalink
pkp/pkp-lib#4787 consider case when adding new reviewer who is an exi…
Browse files Browse the repository at this point in the history
…sting suggestion
  • Loading branch information
touhidurabir committed Dec 24, 2024
1 parent d8eb252 commit 6453f57
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<!-- TODO: check alternative of v-html as v-strip-unsafe-html not working -->
<div v-html="suggestionReason"></div>
</div>

<div v-if="currentlyAssigned" class="listPanel__item--reviewer__notice">
<Icon icon="Error" class="me-1 h-4 w-4" :inline="true" />
<span class="align-middle">{{ currentlyAssignedLabel }}</span>
</div>
</div>

<div class="listPanel__itemActions">
Expand All @@ -30,6 +35,7 @@

<script>
import PkpButton from '@/components/Button/Button.vue';
import Icon from '@/components/Icon/Icon.vue';
import ajaxError from '@/mixins/ajaxError';
import dialog from '@/mixins/dialog.js';
import {useLegacyGridUrl} from '@/composables/useLegacyGridUrl';
Expand All @@ -38,6 +44,7 @@ import {useLocalize} from '@/composables/useLocalize';
export default {
components: {
PkpButton,
Icon,
},
mixins: [ajaxError, dialog],
props: {
Expand All @@ -61,6 +68,14 @@ export default {
type: String,
required: true,
},
currentlyAssigned: {
type: Boolean,
required: true,
},
currentlyAssignedLabel: {
type: String,
required: true,
},
},
data() {
return {};
Expand All @@ -75,6 +90,10 @@ export default {
* @return {Boolean}
*/
canSelect() {
if (this.currentlyAssigned) {
return false;
}
if (this.approvedAt === null || this.approvedAt === undefined) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(
const submissionId = ref(props.submission.id);

const relativeUrl = computed(() => {
return `submissions/${encodeURIComponent(submissionId.value)}/reviewers/suggestions?approved=false`;
if (props.reviewRoundId) {
return `submissions/${encodeURIComponent(submissionId.value)}/reviewers/suggestions?approved=false`;
}
return `submissions/${encodeURIComponent(submissionId.value)}/reviewers/suggestions`;
});

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

const list = [];

reviewerSuggestions.value.items.forEach((reviewerSuggestion) => {
list.push({
id: reviewerSuggestion.id,
fullName: localize(reviewerSuggestion.fullName),
affiliation: localize(reviewerSuggestion.affiliation),
suggestionReason: localize(reviewerSuggestion.suggestionReason),
existingReviewerRole: reviewerSuggestion.existingReviewerRole,
existingUserId: reviewerSuggestion.existingUserId,
reviewerSuggestions.value.items
.filter((reviewerSuggestion) =>
props.reviewRoundId ? !reviewerSuggestion.reviewerId : true,
)
.forEach((reviewerSuggestion) => {
list.push({
id: reviewerSuggestion.id,
fullName: localize(reviewerSuggestion.fullName),
affiliation: localize(reviewerSuggestion.affiliation),
suggestionReason: localize(reviewerSuggestion.suggestionReason),
existingReviewerRole: reviewerSuggestion.existingReviewerRole,
existingUserId: reviewerSuggestion.existingUserId,
});
});
});

return list;
});
Expand Down

0 comments on commit 6453f57

Please sign in to comment.