Skip to content
Commits on Source (2)
......@@ -37,8 +37,6 @@ export class SidebarSelectorComponent implements OnInit {
showExtendedList: boolean = false;
showTrending: boolean = false;
protected lastPreferredEmission: boolean;
constructor(
protected topbarHashtagsService: TopbarHashtagsService,
protected changeDetectorRef: ChangeDetectorRef,
......@@ -46,7 +44,9 @@ export class SidebarSelectorComponent implements OnInit {
) {}
ngOnInit() {
this.lastPreferredEmission = this.preferred;
this.preferred = this.storage.get('preferred_hashtag_state')
? this.storage.get('preferred_hashtag_state') === '1'
: false;
this.init();
}
......@@ -131,15 +131,11 @@ export class SidebarSelectorComponent implements OnInit {
});
} else {
this.currentHashtag = null;
this.preferred = this.lastPreferredEmission;
this.preferredChange();
}
}
preferredChange() {
this.lastPreferredEmission = this.preferred;
this.storage.set('preferred_hashtag_state', this.preferred ? '1' : '0');
this.filterChange.emit({
type: this.preferred ? 'preferred' : 'all',
});
......
......@@ -113,7 +113,10 @@ export class NewsfeedSortedComponent implements OnInit, OnDestroy {
if (typeof params['hashtag'] !== 'undefined') {
this.hashtag = params['hashtag'] || null;
this.all = false;
} else if (typeof params['all'] !== 'undefined') {
} else if (
typeof params['all'] !== 'undefined' ||
this.storage.get('preferred_hashtag_state') !== '1'
) {
this.hashtag = null;
this.all = true;
} else if (params['query']) {
......
......@@ -95,7 +95,6 @@
<m-hashtags--sidebar-selector
[disabled]="!isSorted"
[currentHashtag]="hashtag"
[preferred]="!all && !hashtag"
(filterChange)="hashtagFilterChange($event)"
(switchAttempt)="navigateToGlobal()"
></m-hashtags--sidebar-selector>
......@@ -211,7 +210,6 @@
[compact]="true"
[disabled]="!isSorted"
[currentHashtag]="hashtag"
[preferred]="!all && !hashtag"
(filterChange)="hashtagFilterChange($event)"
(switchAttempt)="navigateToGlobal()"
></m-hashtags--sidebar-selector>
......