Skip to content

Commit ed77972

Browse files
committed
Merge branch 'feat/discovery-cluster-recs-2263' into 'master'
(feat): Added check for new discovery top experiment and updated endpoint to call if active engine#2263 See merge request minds/front!1843
2 parents c8b6c7c + f33110e commit ed77972

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/app/modules/default-feed/feed/feed.component.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,21 @@ export class DefaultFeedComponent implements OnInit {
4646

4747
/**
4848
* Loads the feed.
49-
* @param { boolean } - are we refreshing?
5049
* @returns { void }
50+
* @param refresh
5151
*/
5252
private load(refresh: boolean = false): void {
5353
if (refresh) {
5454
this.feedsService.clear(true);
5555
}
5656

5757
try {
58+
let endpoint = `api/v3/newsfeed/default-feed`;
59+
if (this.isDiscoveryTopExperimentActive()) {
60+
endpoint = `api/v3/newsfeed/feed/clustered-recommendations`;
61+
}
5862
this.feedsService
59-
.setEndpoint(`api/v3/newsfeed/default-feed`)
63+
.setEndpoint(endpoint)
6064
.setLimit(12)
6165
.fetch(refresh);
6266
} catch (e) {
@@ -87,4 +91,16 @@ export class DefaultFeedComponent implements OnInit {
8791
// show after the 3rd post
8892
return index === 2;
8993
}
94+
95+
/**
96+
* Check if the discovery top experiment is active for the current session
97+
* @returns boolean
98+
*/
99+
private isDiscoveryTopExperimentActive(): boolean {
100+
if (!this.location) {
101+
return false;
102+
}
103+
104+
return this.experiments.hasVariation('minds-2263-clustered-recs', true);
105+
}
90106
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<m-discovery__tabs></m-discovery__tabs>
2+
<m-defaultFeed location="discovery-feed"></m-defaultFeed>

src/app/modules/discovery/top/top.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import { Component } from '@angular/core';
77
@Component({
88
selector: 'm-discovery__top',
99
styleUrls: ['top.component.ng.scss'],
10-
template: `
11-
<m-discovery__tabs></m-discovery__tabs>
12-
<m-defaultFeed location="discovery-feed"></m-defaultFeed>
13-
`,
10+
templateUrl: './top.component.html',
1411
})
1512
export class DiscoveryTopComponent {}

0 commit comments

Comments
 (0)