Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WITHDRAW / REINSTATE requests for an item #2759

Merged
merged 43 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
752cb4d
[CST-11178] show allowed correction types
Micheleboychuk Oct 30, 2023
bf67fee
[CST-11178][CST-11179] page to select the target item for "relation" …
Micheleboychuk Oct 30, 2023
d49185e
[CST-11178][CST-11179] POST action of correction suggestion
Micheleboychuk Oct 30, 2023
eeefd86
[CST-11179][CST-11178] Fixes
Micheleboychuk Oct 30, 2023
d7857a6
[CST-11179][CST-11178] fix
alisaismailati Aug 9, 2023
c50dd72
[CST-11178][CST-11179] allow access for authorized user only
alisaismailati Aug 10, 2023
f76e224
[CST-11178]CST-11179] small fix
alisaismailati Aug 10, 2023
8157c47
[CST-11178] Fix correction-type-menu.component visualization
atarix83 Aug 28, 2023
5f63e30
[CST-11178] Fix issue with correction type routing
Micheleboychuk Oct 30, 2023
b907c81
[CST-11178] Fix issue with link
atarix83 Aug 29, 2023
ac7cf5b
[CST-11178] Fix issue while retrieving the id
atarix83 Aug 29, 2023
1a525df
[CST-11179] Fixed breadcrumb & refresh & labels & redirection from /f…
Micheleboychuk Oct 30, 2023
143916c
[CST-11178][CST-11179] fixed pagination for relationship management
alisaismailati Sep 6, 2023
9094d82
[CST-12109] implemented withdrawn-reinstate requests
Micheleboychuk Nov 1, 2023
0b39197
[CST-12109] added new labels
Micheleboychuk Nov 1, 2023
6dc3528
[CTS-12109] refactoring
Micheleboychuk Nov 2, 2023
ef1bd9f
[CST-12109] improve code
Micheleboychuk Nov 3, 2023
5589c76
[CST-12109] porting of box thatallows undo of QAEvent request
Micheleboychuk Nov 7, 2023
1c3776b
[CST-12109] porting missing code
Micheleboychuk Nov 24, 2023
101cd0a
[CST-12109] improvement code
Micheleboychuk Nov 27, 2023
3ecc1ca
Merge branch 'main' into CST-12109-WITHDRAWN-REINSTATE-requests
alisaismailati Jan 17, 2024
805e98b
[CST-12109] fixed failing unit tests after merge
alisaismailati Jan 17, 2024
a4b0c5a
cherry-picked "[CST-12791] changed the route for suggestions to be be…
alisaismailati Nov 30, 2023
80a0cd4
[CST-12109] "refresh" page on item withdrawn from details page
alisaismailati Jan 18, 2024
415bdea
cherry-picked "[CST-12145] get qa-sources by target for item-page & r…
alisaismailati Nov 2, 2023
e4858f2
[CST-12109] fixes
alisaismailati Jan 18, 2024
ad5e3af
[CST-12109] "refresh" page refactor
alisaismailati Jan 22, 2024
8cc45e8
[CST-12109] request reinstate for normal users
alisaismailati Jan 23, 2024
2f43bb7
[CST-12109] small fixes
alisaismailati Jan 23, 2024
ac6c890
[CST-12109] tests & translations
alisaismailati Jan 23, 2024
1b5007a
[CST-12109] display user's email info on topic list
alisaismailati Jan 24, 2024
f916bd7
[CST-12109] fixes
alisaismailati Feb 5, 2024
d72610f
Merge branch 'main' into CST-12109-WITHDRAWN-REINSTATE-requests
alisaismailati Feb 12, 2024
8d0971d
Merge branch 'main' into CST-12109-WITHDRAWN-REINSTATE-requests
alisaismailati Feb 21, 2024
7350fdd
[CST-12109] qa-event notification box fixes
alisaismailati Feb 21, 2024
c34a49e
[CST-12109] lint fix
alisaismailati Feb 21, 2024
6c73a2e
Merge branch 'main' into CST-12109-WITHDRAWN-REINSTATE-requests
alisaismailati Feb 22, 2024
e7579b7
[CST-12109] fix of text messages / source image
alisaismailati Feb 23, 2024
37dc8cc
[CST-12109] logo alignment
alisaismailati Feb 23, 2024
49a3310
[CST-12109] rewrite unit test case
alisaismailati Feb 23, 2024
d0ed405
[CST-12109] added discernable text to delete button for non-admin users
alisaismailati Feb 26, 2024
447b275
[CST-12109] Updated notification text messages
alisaismailati Feb 27, 2024
e4b2814
Merge branch 'main' of https://bitbucket.org/4Science/dspace-angular …
alisaismailati Feb 27, 2024
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
3 changes: 2 additions & 1 deletion src/app/item-page/alerts/item-alerts.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('ItemAlertsComponent', () => {
});
});

it('should return true when user is not an admin and there is at least one correction with topic REQUEST_REINSTATE', fakeAsync(() => {
it('should return true when user is not an admin and there is at least one correction with topic REQUEST_REINSTATE', fakeAsync((done) => {
const isAdmin = false;
const correction = [{ topic: 'REQUEST_REINSTATE' }];
authorizationService.isAuthorized.and.returnValue(of(isAdmin));
Expand All @@ -119,6 +119,7 @@ describe('ItemAlertsComponent', () => {
tick();
result$.subscribe((result) => {
expect(result).toBeTrue();
done();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is still there, you can still change this to toBeFalse() and get the test to pass

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored

});
}));
});
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<ng-container *ngIf="(sources$ | async) as sources">
<ng-container *ngFor="let source of sources">
<div class="alert alert-info d-flex flex-row" *ngIf="source.totalEvents > 0">
<div class="col-2">
<img class="source-logo"
src="assets/images/qa-{{(source.id | dsSplit: ':')[0]}}-logo.png"
alt="{{source.id}} logo"
onerror="this.src='assets/images/dspace-logo.svg'">
</div>
<div class="w-100 d-flex justify-content-between">
<div class="pl-4 align-self-center">
<ng-container *ngIf="this.item.isArchived; else reinstate">
<span>
{{
(isAdmin$ | async) ? ('qa-event-notification.check.notification-withdrawn.admin' | translate : { source: (source.id | dsSplit: ':')[0], num: source.totalEvents })
: ('qa-event-notification.check.notification-withdrawn.user' | translate : { num: source.totalEvents })
}}
</span>
</ng-container>
<ng-template #reinstate>
{{ 'qa-event-notification.check.notification-reinstate' | translate: { num: source.totalEvents } }}
</ng-template>
{{'item.qa-event-notification.check.notification-info' | translate : {num: source.totalEvents } }}
</div>
<button [routerLink]="[ getQualityAssuranceRoute(), (source.id | dsSplit: ':')[0], 'target', item.id]"
[queryParams]="{ forward: true }"
class="btn btn-primary align-self-center">{{ this.item.isArchived ? ('qa-event-notification-undo-withdrawn.check.button' | translate)
: ('qa-event-notification-undo-reinstate.check.button' | translate) }}</button>
class="btn btn-primary align-self-center">
{{'item.qa-event-notification-info.check.button' | translate}}
</button>
</div>
</div>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data
import { provideMockStore } from '@ngrx/store/testing';
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
import { HALEndpointServiceStub } from '../../../shared/testing/hal-endpoint-service.stub';
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
import { of } from 'rxjs';
import { By } from '@angular/platform-browser';
import { SplitPipe } from 'src/app/shared/utils/split.pipe';
Expand All @@ -22,7 +21,6 @@ describe('QaEventNotificationComponent', () => {
let component: QaEventNotificationComponent;
let fixture: ComponentFixture<QaEventNotificationComponent>;
let qualityAssuranceSourceDataServiceStub: any;
let authorizationService: AuthorizationDataService;

const obj = Object.assign(new QualityAssuranceSourceObject(), {
id: 'sourceName:target',
Expand All @@ -34,9 +32,6 @@ describe('QaEventNotificationComponent', () => {
const objPL = createSuccessfulRemoteDataObject$(createPaginatedList([obj]));
const item = Object.assign({ uuid: '1234' });
beforeEach(async () => {
authorizationService = jasmine.createSpyObj('authorizationService', {
isAuthorized: of(true)
});

qualityAssuranceSourceDataServiceStub = {
getSourcesByTarget: () => objPL
Expand All @@ -49,7 +44,6 @@ describe('QaEventNotificationComponent', () => {
{ provide: RequestService, useValue: {} },
{ provide: NotificationsService, useValue: {} },
{ provide: HALEndpointService, useValue: new HALEndpointServiceStub('test') },
{ provide: AuthorizationDataService, useValue: authorizationService },
ObjectCacheService,
RemoteDataBuildService,
provideMockStore({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/mod
import { catchError, map } from 'rxjs/operators';
import { RemoteData } from '../../../core/data/remote-data';
import { getNotificatioQualityAssuranceRoute } from '../../../admin/admin-routing-paths';
import { PaginatedList } from 'src/app/core/data/paginated-list.model';
import { AuthorizationDataService } from 'src/app/core/data/feature-authorization/authorization-data.service';
import { FeatureID } from 'src/app/core/data/feature-authorization/feature-id';
import { PaginatedList } from '../../../core/data/paginated-list.model';

@Component({
selector: 'ds-qa-event-notification',
Expand All @@ -33,17 +31,10 @@ export class QaEventNotificationComponent implements OnChanges {
* An observable that emits an array of QualityAssuranceSourceObject.
*/
sources$: Observable<QualityAssuranceSourceObject[]>;
/**
* An observable that emits a boolean representing whether the current user is an admin.
*/
isAdmin$: Observable<boolean>;

constructor(
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService,
private authService: AuthorizationDataService,
) {
this.isAdmin$ = this.authService.isAuthorized(FeatureID.AdministratorOf);
}
) {}

/**
* Detect changes to the item input and update the sources$ observable.
Expand Down
78 changes: 38 additions & 40 deletions src/app/menu.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ export class MenuResolver implements Resolve<boolean> {
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.authorizationService.isAuthorized(FeatureID.CanSubmit),
this.authorizationService.isAuthorized(FeatureID.CanEditItem),
]).subscribe(([isCollectionAdmin, isCommunityAdmin, isSiteAdmin, canSubmit, canEditItem]) => {
this.authorizationService.isAuthorized(FeatureID.CanSeeQA)
]).subscribe(([isCollectionAdmin, isCommunityAdmin, isSiteAdmin, canSubmit, canEditItem, canSeeQa]) => {
const newSubMenuList = [
{
id: 'new_community',
Expand Down Expand Up @@ -362,6 +363,40 @@ export class MenuResolver implements Resolve<boolean> {
icon: 'heartbeat',
index: 11
},
/* Notifications */
{
id: 'notifications',
active: false,
visible: canSeeQa || isSiteAdmin,
model: {
type: MenuItemType.TEXT,
text: 'menu.section.notifications'
} as TextMenuItemModel,
icon: 'bell',
index: 4
},
{
id: 'notifications_quality-assurance',
parentID: 'notifications',
active: false,
visible: canSeeQa,
model: {
type: MenuItemType.LINK,
text: 'menu.section.quality-assurance',
link: '/notifications/quality-assurance'
} as LinkMenuItemModel,
},
{
id: 'notifications_publication-claim',
parentID: 'notifications',
active: false,
visible: isSiteAdmin,
model: {
type: MenuItemType.LINK,
text: 'menu.section.notifications_publication-claim',
link: '/notifications/' + PUBLICATION_CLAIMS_PATH
} as LinkMenuItemModel,
},
];
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, {
shouldPersistOnRouteChange: true
Expand Down Expand Up @@ -531,46 +566,9 @@ export class MenuResolver implements Resolve<boolean> {
* Create menu sections dependent on whether or not the current user is a site administrator
*/
createSiteAdministratorMenuSections() {
combineLatest([
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.authorizationService.isAuthorized(FeatureID.CanSeeQA)
])
.subscribe(([authorized, canSeeQA]) => {
this.authorizationService.isAuthorized(FeatureID.AdministratorOf)
.subscribe((authorized) => {
const menuList = [
/* Notifications */
{
id: 'notifications',
active: false,
visible: authorized && canSeeQA,
model: {
type: MenuItemType.TEXT,
text: 'menu.section.notifications'
} as TextMenuItemModel,
icon: 'bell',
index: 4
},
{
id: 'notifications_quality-assurance',
parentID: 'notifications',
active: false,
visible: authorized,
model: {
type: MenuItemType.LINK,
text: 'menu.section.quality-assurance',
link: '/notifications/quality-assurance'
} as LinkMenuItemModel,
},
{
id: 'notifications_publication-claim',
parentID: 'notifications',
active: false,
visible: authorized,
model: {
type: MenuItemType.LINK,
text: 'menu.section.notifications_publication-claim',
link: '/admin/notifications/' + PUBLICATION_CLAIMS_PATH
} as LinkMenuItemModel,
},
/* Admin Search */
{
id: 'admin_search',
Expand Down
2 changes: 1 addition & 1 deletion src/app/my-dspace-page/my-dspace-page.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="container">
<ds-suggestions-notification></ds-suggestions-notification>
<ds-my-dspace-qa-events-notifications></ds-my-dspace-qa-events-notifications>
<ds-my-dspace-new-submission *dsShowOnlyForRole="[roleTypeEnum.Submitter]"></ds-my-dspace-new-submission>
<ds-suggestions-notification></ds-suggestions-notification>
</div>

<ds-themed-search *ngIf="configuration && context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</div>
<button
[routerLink]="[getQualityAssuranceRoute(), source.id]"
[queryParams]="{ forward: true }"
class="btn btn-primary align-self-center"
>
{{ "mydspace.qa-event-notification-info.check.button" | translate }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.source-logo {
max-height: var(--ds-header-logo-height);
}

.sections-gap {
gap: 1rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { QualityAssuranceSourceDataService } from '../../core/notifications/qa/source/quality-assurance-source-data.service';
import { getFirstCompletedRemoteData, getPaginatedListPayload, getRemoteDataPayload } from '../../core/shared/operators';
import { Observable, of } from 'rxjs';
import { QualityAssuranceSourceObject } from 'src/app/core/notifications/qa/models/quality-assurance-source.model';
import { QualityAssuranceSourceObject } from './../../core/notifications/qa/models/quality-assurance-source.model';
import { getNotificatioQualityAssuranceRoute } from '../../admin/admin-routing-paths';

@Component({
Expand All @@ -16,6 +16,7 @@ export class MyDspaceQaEventsNotificationsComponent implements OnInit {
* An Observable that emits an array of QualityAssuranceSourceObject.
*/
sources$: Observable<QualityAssuranceSourceObject[]> = of([]);

constructor(private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService) { }

ngOnInit(): void {
Expand Down
12 changes: 1 addition & 11 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,7 @@

"qa-withdrown.modal.form.summary.placeholder": "Enter the reason for the withdrawal",

"qa-reinstate.modal.form.summary.placeholder": "Enter the reason for the reinstate",
"qa-reinstate.modal.form.summary.placeholder": "Enter the reason for the reinstatement",

"item.version.create.modal.submitted.header": "Creating new version...",

Expand All @@ -2712,16 +2712,6 @@

"correction-type.manage-relation.action.notification.withdrawn": "Withdraw request sent.",

"qa-event-notification.check.notification-withdrawn.user": "There are {{num}} items pending review(s) to check.",

"qa-event-notification.check.notification-withdrawn.admin": "There are {{num}} {{source}} feedback(s) pending.",

"qa-event-notification.check.notification-reinstate": "There are {{num}} pending reinstatement(s) pending for this item.",

"qa-event-notification-undo-withdrawn.check.button": "Check",

"qa-event-notification-undo-reinstate.check.button": "Check",

"item.version.create.modal.submitted.text": "The new version is being created. This may take some time if the item has a lot of relationships.",

"item.version.create.notification.success": "New version has been created with version number {{version}}",
Expand Down
Binary file added src/assets/images/qa-DSpaceUsers-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.