File tree 3 files changed +21
-6
lines changed
3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -46,17 +46,21 @@ export class DefaultFeedComponent implements OnInit {
46
46
47
47
/**
48
48
* Loads the feed.
49
- * @param { boolean } - are we refreshing?
50
49
* @returns { void }
50
+ * @param refresh
51
51
*/
52
52
private load ( refresh : boolean = false ) : void {
53
53
if ( refresh ) {
54
54
this . feedsService . clear ( true ) ;
55
55
}
56
56
57
57
try {
58
+ let endpoint = `api/v3/newsfeed/default-feed` ;
59
+ if ( this . isDiscoveryTopExperimentActive ( ) ) {
60
+ endpoint = `api/v3/newsfeed/feed/clustered-recommendations` ;
61
+ }
58
62
this . feedsService
59
- . setEndpoint ( `api/v3/newsfeed/default-feed` )
63
+ . setEndpoint ( endpoint )
60
64
. setLimit ( 12 )
61
65
. fetch ( refresh ) ;
62
66
} catch ( e ) {
@@ -87,4 +91,16 @@ export class DefaultFeedComponent implements OnInit {
87
91
// show after the 3rd post
88
92
return index === 2 ;
89
93
}
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
+ }
90
106
}
Original file line number Diff line number Diff line change
1
+ < m-discovery __tabs > </ m-discovery __tabs>
2
+ < m-defaultFeed location ="discovery-feed "> </ m-defaultFeed >
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ import { Component } from '@angular/core';
7
7
@Component ( {
8
8
selector : 'm-discovery__top' ,
9
9
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' ,
14
11
} )
15
12
export class DiscoveryTopComponent { }
You can’t perform that action at this time.
0 commit comments