diff --git a/src/composables/useApp.js b/src/composables/useApp.js new file mode 100644 index 000000000..a1063717c --- /dev/null +++ b/src/composables/useApp.js @@ -0,0 +1,13 @@ +export function useApp() { + function isOJS() { + return pkp.context.app === 'ojs2'; + } + function isOMP() { + return pkp.context.app === 'omp'; + } + function isOPS() { + return pkp.context.app === 'ops'; + } + + return {isOJS, isOMP, isOPS}; +} diff --git a/src/managers/GalleyManager/useGalleyManagerConfiguration.js b/src/managers/GalleyManager/useGalleyManagerConfiguration.js index dc641310a..0825e48b4 100644 --- a/src/managers/GalleyManager/useGalleyManagerConfiguration.js +++ b/src/managers/GalleyManager/useGalleyManagerConfiguration.js @@ -1,10 +1,11 @@ import {useLocalize} from '@/composables/useLocalize'; +import {useApp} from '@/composables/useApp'; export function useGalleyManagerConfiguration() { const {t} = useLocalize(); - + const {isOPS} = useApp(); function getGalleyGridComponent() { - if (pkp.context.app === 'ops') { + if (isOPS()) { return 'grid.preprintGalleys.PreprintGalleyGridHandler'; } else { return 'grid.articleGalleys.ArticleGalleyGridHandler'; diff --git a/src/pages/workflow/components/primary/WorkflowNotificationDisplay.vue b/src/pages/workflow/components/primary/WorkflowNotificationDisplay.vue index cc42af2b4..1a283c5f1 100644 --- a/src/pages/workflow/components/primary/WorkflowNotificationDisplay.vue +++ b/src/pages/workflow/components/primary/WorkflowNotificationDisplay.vue @@ -9,10 +9,12 @@ import {computed, watch} from 'vue'; import {useUrl} from '@/composables/useUrl'; import {useFetch} from '@/composables/useFetch'; +import {useApp} from '@/composables/useApp'; const props = defineProps({submission: {type: Object, required: true}}); const {pageUrl} = useUrl(`notification/fetchNotification`); +const {isOJS, isOMP} = useApp(); function getRequestOptionsPerStage(stageId) { switch (stageId) { @@ -31,24 +33,36 @@ function getRequestOptionsPerStage(stageId) { [pkp.const.NOTIFICATION_LEVEL_TRIVIAL]: 0, }; case pkp.const.WORKFLOW_STAGE_ID_PRODUCTION: - return { - [pkp.const.NOTIFICATION_LEVEL_NORMAL]: { - /** OMP specific */ - [pkp.const.NOTIFICATION_TYPE_VISIT_CATALOG]: { - assocType: pkp.const.ASSOC_TYPE_SUBMISSION, - assocId: props.submission.id, - }, - [pkp.const.NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER]: { - assocType: pkp.const.ASSOC_TYPE_SUBMISSION, - assocId: props.submission.id, + if (isOJS()) { + return { + [pkp.const.NOTIFICATION_LEVEL_NORMAL]: { + [pkp.const.NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER]: { + assocType: pkp.const.ASSOC_TYPE_SUBMISSION, + assocId: props.submission.id, + }, + [pkp.const.NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS]: { + assocType: pkp.const.ASSOC_TYPE_SUBMISSION, + assocId: props.submission.id, + }, }, - [pkp.const.NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS]: { - assocType: pkp.const.ASSOC_TYPE_SUBMISSION, - assocId: props.submission.id, + [pkp.const.NOTIFICATION_LEVEL_TRIVIAL]: 0, + }; + } else if (isOMP()) { + return { + [pkp.const.NOTIFICATION_LEVEL_NORMAL]: { + [pkp.const.NOTIFICATION_TYPE_VISIT_CATALOG]: { + assocType: pkp.const.ASSOC_TYPE_SUBMISSION, + assocId: props.submission.id, + }, + [pkp.const.NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION]: { + assocType: pkp.const.ASSOC_TYPE_SUBMISSION, + assocId: props.submission.id, + }, }, - }, - [pkp.const.NOTIFICATION_LEVEL_TRIVIAL]: 0, - }; + [pkp.const.NOTIFICATION_LEVEL_TRIVIAL]: 0, + }; + } + return null; default: return null; }