Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
845
Issues
845
List
Boards
Labels
Service Desk
Milestones
Merge Requests
44
Merge Requests
44
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
cab96c03
Commit
cab96c03
authored
4 hours ago
by
Marcelo Rivera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): show sidebar boosts campaigns && put new endpoints behind feature flags
parent
4ebf3598
goal/boost-campaigns-e24
1 merge request
!387
WIP: Boost Campaigns (&24)
Pipeline
#73556573
passed with stages
in 31 minutes and 53 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
5 deletions
+46
-5
boost.ts
src/app/modules/ads/boost.ts
+41
-2
boost-rotator.component.ts
...modules/newsfeed/boost-rotator/boost-rotator.component.ts
+5
-3
No files found.
src/app/modules/ads/boost.ts
View file @
cab96c03
...
...
@@ -5,6 +5,9 @@ import { Session } from '../../services/session';
import
{
Storage
}
from
'
../../services/storage
'
;
import
{
Subscription
}
from
'
rxjs
'
;
import
{
SettingsService
}
from
'
../settings/settings.service
'
;
import
{
FeedsService
}
from
"
../../common/services/feeds.service
"
;
import
{
first
}
from
"
rxjs/operators
"
;
import
{
FeaturesService
}
from
"
../../services/features.service
"
;
@
Component
({
selector
:
'
m-ads-boost
'
,
...
...
@@ -32,7 +35,13 @@ export class BoostAds implements OnInit, OnDestroy {
ratingSubscription
:
Subscription
;
constructor
(
public
client
:
Client
,
public
session
:
Session
,
private
storage
:
Storage
,
private
settingsService
:
SettingsService
)
{
constructor
(
public
client
:
Client
,
public
session
:
Session
,
public
feedsService
:
FeedsService
,
private
featureService
:
FeaturesService
,
private
storage
:
Storage
,
private
settingsService
:
SettingsService
)
{
}
ngOnInit
()
{
...
...
@@ -40,6 +49,16 @@ export class BoostAds implements OnInit, OnDestroy {
this
.
ratingSubscription
=
this
.
settingsService
.
ratingChanged
.
subscribe
((
rating
)
=>
{
this
.
onRatingChanged
(
rating
);
});
this
.
feedsService
.
feed
.
subscribe
(
async
boosts
=>
{
if
(
!
boosts
.
length
)
return
;
for
(
const
boost
of
boosts
)
{
if
(
boost
)
this
.
boosts
.
push
(
await
boost
.
pipe
(
first
()).
toPromise
());
}
});
this
.
fetch
();
}
...
...
@@ -47,7 +66,7 @@ export class BoostAds implements OnInit, OnDestroy {
this
.
ratingSubscription
.
unsubscribe
();
}
fetch
()
{
loadLegacy
()
{
if
(
this
.
storage
.
get
(
'
boost:offset:sidebar
'
))
this
.
offset
=
this
.
storage
.
get
(
'
boost:offset:sidebar
'
);
this
.
client
.
get
(
'
api/v1/boost/fetch/
'
+
this
.
handler
,
{
...
...
@@ -66,9 +85,29 @@ export class BoostAds implements OnInit, OnDestroy {
});
}
load
()
{
this
.
feedsService
.
setEndpoint
(
'
api/v2/boost/fetch/campaigns/content
'
)
.
setParams
({
rating
:
this
.
rating
,
})
.
setLimit
(
this
.
limit
)
.
setOffset
(
0
)
.
fetch
();
}
fetch
()
{
if
(
this
.
featureService
.
has
(
'
boost-campaigns
'
))
{
this
.
load
();
}
else
{
this
.
loadLegacy
();
}
}
onRatingChanged
(
rating
:
number
)
{
this
.
rating
=
rating
;
this
.
storage
.
destroy
(
'
boost:offset:sidebar
'
);
this
.
boosts
=
[];
this
.
offset
=
''
;
this
.
fetch
();
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/newsfeed/boost-rotator/boost-rotator.component.ts
View file @
cab96c03
...
...
@@ -66,13 +66,14 @@ export class NewsfeedBoostRotatorComponent {
public
scroll
:
ScrollService
,
public
newsfeedService
:
NewsfeedService
,
public
settingsService
:
SettingsService
,
private
storage
:
Storage
,
public
element
:
ElementRef
,
public
service
:
NewsfeedBoostService
,
public
feedsService
:
FeedsService
,
private
cd
:
ChangeDetectorRef
,
private
storage
:
Storage
,
protected
featuresService
:
FeaturesService
,
public
feedsService
:
FeedsService
,
protected
clientMetaService
:
ClientMetaService
,
protected
featureService
:
FeaturesService
,
@
SkipSelf
()
injector
:
Injector
,
)
{
...
...
@@ -112,9 +113,10 @@ export class NewsfeedBoostRotatorComponent {
load
()
{
try
{
const
url
=
this
.
featureService
.
has
(
'
boost-campaigns
'
)
?
'
api/v2/boost/fetch/campaigns
'
:
'
api/v2/boost/feed
'
;
this
.
feedsService
.
setEndpoint
(
'
api/v2/boost/fetch/campaigns
'
)
.
setEndpoint
(
url
)
.
setParams
({
rating
:
this
.
rating
,
})
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment