diff --git a/src/app/core/suggestion-notifications/qa/models/quality-assurance-event.model.ts b/src/app/core/suggestion-notifications/qa/models/quality-assurance-event.model.ts
index 7517148def..02d86bab70 100644
--- a/src/app/core/suggestion-notifications/qa/models/quality-assurance-event.model.ts
+++ b/src/app/core/suggestion-notifications/qa/models/quality-assurance-event.model.ts
@@ -28,6 +28,8 @@ export interface OpenaireQualityAssuranceEventMessageObject {
*/
type: string;
+ reason: string;
+
/**
* The value suggested by Notifications
*/
diff --git a/src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.html b/src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.html
index 1201fbee6f..f0e248c647 100644
--- a/src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.html
+++ b/src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.html
@@ -7,8 +7,8 @@
-
- {{'item.qa-withdrawn-reinstate.create.modal.form.summary.label' | translate }}:
+
diff --git a/src/app/shared/dso-page/dso-edit-menu.resolver.ts b/src/app/shared/dso-page/dso-edit-menu.resolver.ts
index ed530286a6..2b270abc76 100644
--- a/src/app/shared/dso-page/dso-edit-menu.resolver.ts
+++ b/src/app/shared/dso-page/dso-edit-menu.resolver.ts
@@ -21,8 +21,7 @@ import { getDSORoute } from '../../app-routing-paths';
import { ResearcherProfileDataService } from '../../core/profile/researcher-profile-data.service';
import { NotificationsService } from '../notifications/notifications.service';
import { TranslateService } from '@ngx-translate/core';
-import { DsoWithdrawnModalService } from './dso-withdrawn-service/dso-withdrawn-modal.service';
-import { DsoReinstateModalService } from './dso-reinstate-service/dso-reinstate-modal.service';
+import { DsoWithdrawnReinstateModalService } from './dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service';
/**
* Creates the menus for the dspace object pages
@@ -41,8 +40,7 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
protected researcherProfileService: ResearcherProfileDataService,
protected notificationsService: NotificationsService,
protected translate: TranslateService,
- protected dsoWithdrawnModalService: DsoWithdrawnModalService,
- protected dsoReinstateModalService: DsoReinstateModalService
+ protected dsoWithdrawnReinstateModalService: DsoWithdrawnReinstateModalService
) {
}
@@ -129,8 +127,8 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
this.dsoVersioningModalService.getVersioningTooltipMessage(dso, 'item.page.version.hasDraft', 'item.page.version.create'),
this.authorizationService.isAuthorized(FeatureID.CanSynchronizeWithORCID, dso.self),
this.authorizationService.isAuthorized(FeatureID.CanClaimItem, dso.self),
- this.authorizationService.isAuthorized(FeatureID.WithdrawItem, dso.self),
- this.authorizationService.isAuthorized(FeatureID.ReinstateItem, dso.self),
+ this.authorizationService.isAuthorized(FeatureID.WithdrawItem, dso.self,),
+ this.authorizationService.isAuthorized(FeatureID.ReinstateItem, dso.self)
]).pipe(
map(([canCreateVersion, disableVersioning, versionTooltip, canSynchronizeWithOrcid, canClaimItem, canWithdrawItem, canReinstateItem]) => {
const isPerson = this.getDsoType(dso) === 'person';
@@ -184,7 +182,7 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
type: MenuItemType.ONCLICK,
text:'item.page.withdrawn',
function: () => {
- this.dsoWithdrawnModalService.openCreateWithdrawnModal(dso, canWithdrawItem);
+ this.dsoWithdrawnReinstateModalService.openCreateWithdrawnReinstateModal(dso, 'request-withdrawn', canWithdrawItem);
}
} as OnClickMenuItemModel,
icon: 'lock',
@@ -198,7 +196,7 @@ export class DSOEditMenuResolver implements Resolve<{ [key: string]: MenuSection
type: MenuItemType.ONCLICK,
text:'item.page.reinstate',
function: () => {
- this.dsoReinstateModalService.openCreateReinstateModal(dso, canReinstateItem);
+ this.dsoWithdrawnReinstateModalService.openCreateWithdrawnReinstateModal(dso, 'request-reinstate', canWithdrawItem);
}
} as OnClickMenuItemModel,
icon: 'unlock-keyhole',
diff --git a/src/app/shared/dso-page/dso-reinstate-service/dso-reinstate-modal.service.ts b/src/app/shared/dso-page/dso-reinstate-service/dso-reinstate-modal.service.ts
deleted file mode 100644
index dfb8c3da10..0000000000
--- a/src/app/shared/dso-page/dso-reinstate-service/dso-reinstate-modal.service.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-import { Injectable } from '@angular/core';
-import { Router } from '@angular/router';
-import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
-import { ItemDataService } from '../../../core/data/item-data.service';
-import { NotificationsService } from '../../notifications/notifications.service';
-import { TranslateService } from '@ngx-translate/core';
-import {
- QualityAssuranceEventDataService
-} from '../../../core/suggestion-notifications/qa/events/quality-assurance-event-data.service';
-import { ItemWithdrawnReinstateModalComponent } from '../../correction-suggestion/withdrawn-reinstate-modal.component';
-import { take } from 'rxjs/operators';
-import { RemoteData } from '../../../core/data/remote-data';
-import {
- QualityAssuranceEventObject
-} from '../../../core/suggestion-notifications/qa/models/quality-assurance-event.model';
-import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
-
-
-@Injectable({
- providedIn: 'root'
-})
-export class DsoReinstateModalService {
-
- constructor(
- protected router: Router,
- protected modalService: NgbModal,
- protected itemService: ItemDataService,
- private notificationsService: NotificationsService,
- private translateService: TranslateService,
- protected qaEventDataService: QualityAssuranceEventDataService
- ) {}
-
- /**
- * Open the reinstat modal for the provided dso
- */
- openCreateReinstateModal(dso, state: boolean): void {
- const target = dso.id;
-
- // Open modal
- const activeModal = this.modalService.open(ItemWithdrawnReinstateModalComponent);
- (activeModal.componentInstance as ItemWithdrawnReinstateModalComponent).setReinstate(!state);
- (activeModal.componentInstance as ItemWithdrawnReinstateModalComponent).createQAEvent
- .pipe(
- take(1)
- ).subscribe(
- (reason) => {
- this.sendQARequest(target, reason);
- activeModal.close();
- }
- );
- }
-
- sendQARequest(target: string, reason: string): void {
- this.qaEventDataService.postData(target, 'request-reinstate','', reason)
- .pipe (
- getFirstCompletedRemoteData()
- )
- .subscribe((res: RemoteData
) => {
- if (res.hasSucceeded) {
- const message = 'reinstate';
- this.notificationsService.success(this.translateService.get(message));
- } else {
- this.notificationsService.error(this.translateService.get('correction-type.manage-relation.action.notification.error'));
- }
- });
- }
-
-}
-
diff --git a/src/app/shared/dso-page/dso-withdrawn-service/dso-withdrawn-modal.service.ts b/src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts
similarity index 72%
rename from src/app/shared/dso-page/dso-withdrawn-service/dso-withdrawn-modal.service.ts
rename to src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts
index b6d09cf803..ce491a89a5 100644
--- a/src/app/shared/dso-page/dso-withdrawn-service/dso-withdrawn-modal.service.ts
+++ b/src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts
@@ -14,17 +14,19 @@ import { TranslateService } from '@ngx-translate/core';
import { NotificationsService } from '../../notifications/notifications.service';
import { take } from 'rxjs/operators';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
+import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
@Injectable({
providedIn: 'root'
})
-export class DsoWithdrawnModalService {
+export class DsoWithdrawnReinstateModalService {
constructor(
protected router: Router,
protected modalService: NgbModal,
protected itemService: ItemDataService,
private notificationsService: NotificationsService,
+ protected authorizationService: AuthorizationDataService,
private translateService: TranslateService,
protected qaEventDataService: QualityAssuranceEventDataService
) {}
@@ -32,7 +34,7 @@ export class DsoWithdrawnModalService {
/**
* Open the create withdrawn modal for the provided dso
*/
- openCreateWithdrawnModal(dso, state: boolean): void {
+ openCreateWithdrawnReinstateModal(dso, correctionType: string, state: boolean): void {
const target = dso.id;
// Open modal
const activeModal = this.modalService.open(ItemWithdrawnReinstateModalComponent);
@@ -42,21 +44,24 @@ export class DsoWithdrawnModalService {
take(1)
).subscribe(
(reasone) => {
- this.sendQARequest(target, reasone);
+ this.sendQARequest(target, correctionType, reasone);
activeModal.close();
}
);
}
- sendQARequest(target: string, reason: string): void {
- this.qaEventDataService.postData(target, 'request-withdrawn', '', reason)
+ sendQARequest(target: string, correctionType: string, reason: string): void {
+ this.qaEventDataService.postData(target, correctionType, '', reason)
.pipe (
getFirstCompletedRemoteData()
)
.subscribe((res: RemoteData) => {
if (res.hasSucceeded) {
- const message = 'withdrawn';
+ const withdrawnMessage = 'Withdrawn request sent.';
+ const reinstateMessage = 'Reinstate request sent.';
+ const message = (correctionType === 'request-withdrawn') ? withdrawnMessage : reinstateMessage;
this.notificationsService.success(this.translateService.get(message));
+ this.authorizationService.invalidateAuthorizationsRequestCache();
} else {
this.notificationsService.error(this.translateService.get('correction-type.manage-relation.action.notification.error'));
}
diff --git a/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.html b/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.html
index f942bf0ef6..aa416ec2c0 100644
--- a/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.html
+++ b/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.html
@@ -37,12 +37,12 @@
{{'quality-assurance.event.table.trust' | translate}} |
{{'quality-assurance.event.table.publication' | translate}} |
-
- {{'quality-assurance.event.table.details' | translate}}
- |
{{'quality-assurance.event.table.project-details' | translate}}
|
+
+ {{'quality-assurance.event.table.reasons' | translate}}
+ |
{{'quality-assurance.event.table.actions' | translate}} |
@@ -79,6 +79,15 @@
{{ (showMore ? 'quality-assurance.event.table.less': 'quality-assurance.event.table.more') | translate }}
+
+
+
+
+ {{eventElement.event.message.reason}}
+
+
+ |
+
{{'quality-assurance.event.table.suggestedProject' | translate}}
diff --git a/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.ts b/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.ts
index e34c121f35..18d0517285 100644
--- a/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.ts
+++ b/src/app/suggestion-notifications/qa/events/quality-assurance-events.component.ts
@@ -151,9 +151,11 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
*/
public hasDetailColumn(): boolean {
return (this.showTopic.indexOf('/PROJECT') !== -1 ||
- this.showTopic.indexOf('/PID') !== -1 ||
- this.showTopic.indexOf('/SUBJECT') !== -1 ||
- this.showTopic.indexOf('/ABSTRACT') !== -1
+ this.showTopic.indexOf('/PID') !== -1 ||
+ this.showTopic.indexOf('/SUBJECT') !== -1 ||
+ this.showTopic.indexOf('/WITHDRAWN') !== -1 ||
+ this.showTopic.indexOf('/REINSTATE') !== -1 ||
+ this.showTopic.indexOf('/ABSTRACT') !== -1
);
}
diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5
index 4b03ce208f..435e0a3058 100644
--- a/src/assets/i18n/en.json5
+++ b/src/assets/i18n/en.json5
@@ -2594,7 +2594,7 @@
"item.version.create.modal.form.summary.label": "Summary",
- "item.qa-withdrawn-reinstate.create.modal.form.summary.label": "Summary",
+ "item.qa-withdrawn-reinstate.create.modal.form.summary.label": "Reason",
"item.version.create.modal.form.summary.placeholder": "Insert the summary for the new version",
@@ -3158,6 +3158,8 @@
"quality-assurance.event.table.project-details": "Project details",
+ "quality-assurance.event.table.reasons": "Reasons",
+
"quality-assurance.event.table.actions": "Actions",
"quality-assurance.event.action.accept": "Accept suggestion",
|