@@ -9,8 +9,11 @@ import {
99 OnInit ,
1010 ViewEncapsulation ,
1111} from '@angular/core' ;
12- import { Router } from '@angular/router' ;
13- import { TranslateModule } from '@ngx-translate/core' ;
12+ import { ActivatedRoute , Router } from '@angular/router' ;
13+ import {
14+ TranslateModule ,
15+ TranslateService ,
16+ } from '@ngx-translate/core' ;
1417import {
1518 BehaviorSubject ,
1619 Observable ,
@@ -30,8 +33,9 @@ import { LinkHeadService } from '../../core/services/link-head.service';
3033import { getFirstCompletedRemoteData } from '../../core/shared/operators' ;
3134import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service' ;
3235import { PaginatedSearchOptions } from '../search/models/paginated-search-options.model' ;
33-
34-
36+ import { SearchFilter } from '../search/models/search-filter.model' ;
37+ import { hasValue } from '../empty.util' ;
38+ import { isUndefined } from 'lodash' ;
3539/**
3640 * The Rss feed button componenet.
3741 */
@@ -51,6 +55,8 @@ export class RSSComponent implements OnInit, OnDestroy {
5155
5256 isEnabled$ : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( null ) ;
5357
58+ isActivated$ : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
59+
5460 uuid : string ;
5561 configuration$ : Observable < string > ;
5662
@@ -61,7 +67,9 @@ export class RSSComponent implements OnInit, OnDestroy {
6167 private configurationService : ConfigurationDataService ,
6268 private searchConfigurationService : SearchConfigurationService ,
6369 private router : Router ,
64- protected paginationService : PaginationService ) {
70+ private route : ActivatedRoute ,
71+ protected paginationService : PaginationService ,
72+ protected translateService : TranslateService ) {
6573 }
6674 /**
6775 * Removes the linktag created when the component gets removed from the page.
@@ -78,8 +86,11 @@ export class RSSComponent implements OnInit, OnDestroy {
7886 * Generates the link tags and the url to opensearch when the component is loaded.
7987 */
8088 ngOnInit ( ) : void {
81- this . configuration$ = this . searchConfigurationService . getCurrentConfiguration ( 'default' ) ;
82-
89+ if ( hasValue ( this . route . snapshot . data ?. enableRSS ) ) {
90+ this . isActivated$ . next ( this . route . snapshot . data . enableRSS ) ;
91+ } else if ( isUndefined ( this . route . snapshot . data ?. enableRSS ) ) {
92+ this . isActivated$ . next ( false ) ;
93+ }
8394 this . subs . push ( this . configurationService . findByPropertyName ( 'websvc.opensearch.enable' ) . pipe (
8495 getFirstCompletedRemoteData ( ) ,
8596 ) . subscribe ( ( result ) => {
0 commit comments