...
 
Commits (3)
......@@ -66,12 +66,13 @@ export class FeaturedContentComponent implements OnInit {
update() {
this.clear();
const {component, injector} = this.resolve();
if (!this.dynamicHost) {
console.log('tried to load a boost but no dynamicHost found', this.entity);
return;
}
const {component, injector} = this.resolve();
if (component) {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
......
import { Injectable } from "@angular/core";
import { filter, first, map, switchMap } from 'rxjs/operators';
import { filter, first, map, switchMap, mergeMap, skip, take } from 'rxjs/operators';
import { FeedsService } from "../../services/feeds.service";
@Injectable()
......@@ -11,21 +11,27 @@ export class FeaturedContentService {
protected feedsService: FeedsService,
) {
this.feedsService
.setLimit(50)
.setLimit(12)
.setOffset(0)
.setEndpoint('api/v2/boost/feed')
.fetch();
}
async fetch() {
if (this.offset >= this.feedsService.rawFeed.getValue().length) {
this.offset = -1;
}
return await this.feedsService.feed
.pipe(
filter(feed => feed.length > 0),
first(),
map(feed => feed[this.offset++]),
mergeMap(feed => feed),
skip(this.offset++),
take(1),
switchMap(async entity => {
if (!entity)
if (!entity) {
return false;
}
return await entity.pipe(first()).toPromise();
}),
).toPromise();
......
......@@ -295,10 +295,10 @@ export class NewsfeedSortedComponent implements OnInit, OnDestroy {
}
shouldShowBoost(i: number) {
if (this.query) {
return false;
}
//if (this.query) {
// return false;
//}
return (i > 0 && (i % 8) === 0 && i <= 40) || i === 2;
return (i > 0 && (i % 5) === 0 && i <= 80) || i === 1;
}
}