Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
Preferred hashtag remembered in local storage
#1366
· 44ca320e
Ben
authored
Dec 06, 2019
and
Xander Miller
committed
Dec 06, 2019
44ca320e
Merge branch 'feat/default-disc-tags-1366' into 'master'
· 2e8a9896
Xander Miller
authored
Dec 06, 2019
Preferred hashtag remembered in local storage
#1366
Closes
#1302
See merge request
!645
2e8a9896
Hide whitespace changes
Inline
Side-by-side
src/app/modules/hashtags/sidebar-selector/sidebar-selector.component.ts
View file @
2e8a9896
...
...
@@ -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
'
,
});
...
...
src/app/modules/newsfeed/feeds/sorted.component.ts
View file @
2e8a9896
...
...
@@ -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
'
])
{
...
...
src/app/modules/newsfeed/newsfeed.component.html
View file @
2e8a9896
...
...
@@ -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>
...
...