Skip to content

Commit 8e04558

Browse files
fix: prevent button label flicker when opening subscription modal - 4195
1 parent 4d3a7a2 commit 8e04558

3 files changed

Lines changed: 11 additions & 18 deletions

File tree

cypress/e2e/collection-statistics.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { testA11y } from 'cypress/support/utils';
44
describe('Collection Statistics Page', () => {
55
const COLLECTIONSTATISTICSPAGE = '/statistics/collections/'.concat(Cypress.env('DSPACE_TEST_COLLECTION'));
66

7-
it.skip('should load if you click on "Statistics" from a Community page', () => {
8-
cy.visit('/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY')));
7+
it('should load if you click on "Statistics" from a Collection page', () => {
8+
cy.visit('/collections/'.concat(Cypress.env('DSPACE_TEST_COLLECTION')));
99
cy.get('ds-navbar ds-link-menu-item a[data-test="link-menu-item.menu.section.statistics"]').click();
1010
cy.location('pathname').should('eq', COLLECTIONSTATISTICSPAGE);
1111
});

cypress/e2e/community-statistics.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { testA11y } from 'cypress/support/utils';
44
describe('Community Statistics Page', () => {
55
const COMMUNITYSTATISTICSPAGE = '/statistics/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY'));
66

7-
it.skip('should load if you click on "Statistics" from a Community page', () => {
7+
it('should load if you click on "Statistics" from a Community page', () => {
88
cy.visit('/communities/'.concat(Cypress.env('DSPACE_TEST_COMMUNITY')));
99
cy.get('ds-navbar ds-link-menu-item a[data-test="link-menu-item.menu.section.statistics"]').click();
1010
cy.location('pathname').should('eq', COMMUNITYSTATISTICSPAGE);

src/app/shared/menu/providers/comcol-subscribe.menu.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { DSpaceObjectPageMenuProvider } from './helper-providers/dso.menu';
3535
*/
3636
@Injectable()
3737
export class SubscribeMenuProvider extends DSpaceObjectPageMenuProvider {
38-
3938
private refresh$ = new Subject<void>();
4039

4140
constructor(
@@ -50,7 +49,7 @@ export class SubscribeMenuProvider extends DSpaceObjectPageMenuProvider {
5049

5150
public getSectionsForContext(dso: DSpaceObject): Observable<PartialMenuSection[]> {
5251
return this.refresh$.pipe(
53-
startWith(undefined),
52+
startWith(undefined), // Disparamos siempre al inicio
5453
switchMap(() =>
5554
combineLatest([
5655
this.authorizationService.isAuthorized(FeatureID.CanSubscribe, dso.self),
@@ -72,19 +71,13 @@ export class SubscribeMenuProvider extends DSpaceObjectPageMenuProvider {
7271
type: MenuItemType.ONCLICK,
7372
text: key,
7473
function: () => {
75-
if (isSubscribed) {
76-
this.subscriptionService.deleteSubscription(subscription.id).subscribe(() => {
77-
this.refresh$.next();
78-
});
79-
} else {
80-
const modalRef = this.modalService.open(SubscriptionModalComponent);
81-
modalRef.componentInstance.dso = dso;
82-
modalRef.componentInstance.updated.subscribe(() => {
83-
this.refresh$.next();
84-
});
85-
modalRef.closed.subscribe(() => {
86-
});
87-
}
74+
const modalRef = this.modalService.open(SubscriptionModalComponent);
75+
modalRef.componentInstance.dso = dso;
76+
modalRef.componentInstance.updated.subscribe(() => {
77+
this.refresh$.next();
78+
});
79+
modalRef.closed.subscribe(() => {
80+
});
8881
},
8982
} as OnClickMenuItemModel,
9083
icon: 'bell',

0 commit comments

Comments
 (0)