Skip to content

Commit e953e4d

Browse files
Fix: show the subscription options and statistics without reloading the page.
1 parent 5719bae commit e953e4d

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,22 @@ export class SubscribeMenuProvider extends DSpaceObjectPageMenuProvider {
6060
if (!isPlatformBrowser(this.platformId)) {
6161
return of([]);
6262
}
63-
64-
// 1. Crear un ID único desde el principio
65-
const sectionId = `subscribe-section-${dso.uuid}`;
63+
const sectionId = `subscribe-btn-${dso.uuid}`;
6664

6765
return this.refresh$.pipe(
68-
startWith(null), // Inicializar el flujo
66+
startWith(null),
6967
switchMap(() => combineLatest([
7068
this.authorizationService.isAuthorized(FeatureID.CanSubscribe, dso.self),
7169
this.authService.getAuthenticatedUserFromStore().pipe(first()),
7270
])),
7371
switchMap(([canSubscribe, user]) => {
74-
// 2. Siempre retornar estructura con ID incluso si no hay permiso
7572
const baseSection = {
7673
id: sectionId,
7774
visible: false,
7875
model: null,
7976
} as PartialMenuSection;
8077

8178
if (!canSubscribe || !user) {
82-
// 3. Emitir sección oculta pero con ID válido
8379
return of([baseSection]);
8480
}
8581

@@ -103,10 +99,9 @@ export class SubscribeMenuProvider extends DSpaceObjectPageMenuProvider {
10399
icon: 'bell',
104100
}];
105101
}),
106-
catchError(() => of([baseSection])),// 4. En errores mantener sección oculta
102+
catchError(() => of([baseSection])),
107103
);
108104
}),
109-
// 5. Inicializar con la estructura básica
110105
startWith([{
111106
id: sectionId,
112107
visible: false,

0 commit comments

Comments
 (0)