Skip to content
Commits on Source (20)
......@@ -75,7 +75,7 @@ import { AnalyticsModule } from "./modules/analytics/analytics.module";
ReactiveFormsModule,
FormsModule,
HttpClientModule,
RouterModule.forRoot(MindsAppRoutes),
RouterModule.forRoot(MindsAppRoutes, { onSameUrlNavigation: "reload" }),
CaptchaModule,
CommonModule,
AnalyticsModule,
......
......@@ -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();
......
......@@ -257,7 +257,7 @@ m-channel{
display:inline-block;
vertical-align:middle;
}
h2{
h2 {
letter-spacing: 0.25px;
font-weight: 800;
width: calc(100% - 64px);
......@@ -268,6 +268,12 @@ m-channel{
grid-row: 1 / span 1;
grid-column: 1 / span 2;
}
.minds-button-edit > button {
font-size:16px;
}
minds-user-dropdown > button {
font-size:24px;
}
button{
border:0;
font-size:16px;
......
......@@ -134,6 +134,18 @@ export class GroupProfileFeedSortedComponent {
}
this.entities.unshift(activity);
let feedItem = {
entity: activity,
urn: activity.urn,
guid: activity.guid
};
this.feedsService.rawFeed.next([
... [ feedItem ],
... this.feedsService.rawFeed.getValue()
]);
this.detectChanges();
}
......
......@@ -19,6 +19,7 @@ import { BlockListService } from "../../../../common/services/block-list.service
<ng-container *ngIf="session.getLoggedInUser().guid != user.guid">
<li class="mdl-menu__item" [hidden]="user.blocked" (click)="block()" i18n="@@MINDS__BUTTONS__USER_DROPDOWN__BLOCK">Block @{{user.username}}</li>
<li class="mdl-menu__item" [hidden]="!user.blocked" (click)="unBlock()" i18n="@@MINDS__BUTTONS__USER_DROPDOWN__UNBLOCK">Un-Block @{{user.username}}</li>
<li class="mdl-menu__item" [hidden]="user.subscribed" (click)="subscribe()" i18n="@@MINDS__BUTTONS__USER_DROPDOWN__SUBSCRIBE">Subscribe</li>
<li class="mdl-menu__item" [hidden]="!user.subscribed" (click)="unSubscribe()" i18n="@@MINDS__BUTTONS__USER_DROPDOWN__UNSUBSCRIBE">Unsubscribe</li>
</ng-container>
<li class="mdl-menu__item" *ngIf="session.isAdmin()" [hidden]="user.banned !== 'yes'" (click)="unBan()" i18n="@@MINDS__BUTTONS__USER_DROPDOWN__UNBAN_GLOBALLY">Un-ban globally</li>
......@@ -189,6 +190,17 @@ export class UserDropdownButton {
this.showMenu = false;
}
subscribe() {
this.user.subscribed = true;
this.client.post('api/v1/subscribe/' + this.user.guid, {})
.then((response: any) => {
this.user.subscribed = true;
})
.catch((e) => {
this.user.subscribed = false;
});
}
unSubscribe() {
this.user.subscribed = false;
this.client.delete('api/v1/subscribe/' + this.user.guid, {})
......
......@@ -221,6 +221,7 @@ export class RemindMock {
@Input() object;
@Input() events;
@Input() boosted;
@Output() matureVisibilityChange: EventEmitter<any> = new EventEmitter<any>();
}
@Component({
......
......@@ -61,14 +61,14 @@
<div m-read-more class="mdl-card__supporting-text message m-mature-message" [class.m-activity--message-remind]="activity.remind_object"
[hidden]="!activity.message || editing">
<a class="m-mature-text-toggle" (click)="activity.mature_visibility = !activity.mature_visibility"
<a class="m-mature-text-toggle" (click)="toggleMatureVisibility()"
*ngIf="attachment.shouldBeBlurred(activity) || attachment.isForcefullyShown(activity)"
[ngClass]="{ 'mdl-color-text--red-500': attachment.isForcefullyShown(activity) }">
<i class="material-icons m-material-icons-inline">explicit</i>
</a>
<span class="m-mature-message-content" [innerHtml]="activity.message | tags" [ngClass]="{ 'm-mature-text': attachment.shouldBeBlurred(activity) }"
(click)="activity.mature && !activity.mature_visibility ? activity.mature_visibility = !activity.mature_visibility : null">
(click)="activity.mature && !activity.mature_visibility ? toggleMatureVisibility(): null">
</span>
<m-read-more--button></m-read-more--button>
</div>
......@@ -127,7 +127,7 @@
<div class="m-rich-embed"
*ngIf="activity.perma_url && activity.title"
[ngClass]="{ 'm-mature-content': attachment.shouldBeBlurred(activity), 'm-mature-content-shown': attachment.isForcefullyShown(activity) }">
<div class="m-mature-overlay" (click)="activity.mature_visibility = !activity.mature_visibility">
<div class="m-mature-overlay" (click)="toggleMatureVisibility()">
<span class="m-mature-overlay-note">
<i class="material-icons" title="Mature content" i18n-title="@@M__COMMON__MATURE_CONTENT">explicit</i>
<span i18n="@@M__COMMON__CONFIRM_18">Click to confirm your are 18+</span>
......@@ -156,7 +156,7 @@
<div class="item item-image item-image-video m-activity--video"
[ngClass]="{ 'm-mature-content': attachment.shouldBeBlurred(activity), 'm-mature-content-shown': attachment.isForcefullyShown(activity) }"
*ngIf="activity.custom_type == 'video'">
<div class="m-mature-overlay" (click)="activity.mature_visibility = !activity.mature_visibility">
<div class="m-mature-overlay" (click)="toggleMatureVisibility()">
<span class="m-mature-overlay-note">
<i class="material-icons" title="Mature content" i18n-title="@@M__COMMON__MATURE_CONTENT">explicit</i>
<span i18n="@@M__COMMON__CONFIRM_18">Click to confirm your are 18+</span>
......@@ -181,7 +181,7 @@
<div class="item item-image allow-select m-activity--image"
[ngClass]="{ 'm-mature-content': attachment.shouldBeBlurred(activity), 'm-mature-content-shown': attachment.isForcefullyShown(activity) }"
*ngIf="activity.thumbnail_src && !activity.perma_url">
<div class="m-mature-overlay" (click)="activity.mature_visibility = !activity.mature_visibility">
<div class="m-mature-overlay" (click)="toggleMatureVisibility()">
<span class="m-mature-overlay-note">
<i class="material-icons" title="Mature content" i18n-title="@@M__COMMON__MATURE_CONTENT">explicit</i>
<span i18n="@@M__COMMON__CONFIRM_18">Click to confirm your are 18+</span>
......@@ -197,7 +197,7 @@
<div class="item item-image allow-select"
[ngClass]="{ 'm-mature-content': attachment.shouldBeBlurred(activity), 'm-mature-content-shown': attachment.isForcefullyShown(activity) }"
*ngIf="activity.custom_type == 'batch'">
<div class="m-mature-overlay" (click)="activity.mature_visibility = !activity.mature_visibility">
<div class="m-mature-overlay" (click)="toggleMatureVisibility()">
<span class="m-mature-overlay-note">
<i class="material-icons" title="Mature content" i18n-title="@@M__COMMON__MATURE_CONTENT">explicit</i>
<span i18n="@@M__COMMON__CONFIRM_18">Click to confirm your are 18+</span>
......@@ -214,7 +214,12 @@
<!-- Reminds -->
<div *ngIf="activity.remind_object">
<ng-container *ngIf="!isOwnerBlocked(activity.remind_object); else blockedRemindTemplate">
<minds-remind [object]="activity.remind_object" [events]="childEventsEmitter" [boosted]="activity.boosted"></minds-remind>
<minds-remind
[object]="activity.remind_object"
[events]="childEventsEmitter"
[boosted]="activity.boosted"
(matureVisibilityChange)="onRemindMatureVisibilityChange()"
></minds-remind>
</ng-container>
<ng-template #blockedRemindTemplate>
<div class="m-activity__blockedRemind">
......
......@@ -149,13 +149,13 @@ export class Activity implements OnInit {
this.activityAnalyticsOnViewService.setEntity(this.activity);
if (
this.activity.custom_type == 'batch'
&& this.activity.custom_data
this.activity.custom_type == 'batch'
&& this.activity.custom_data
&& this.activity.custom_data[0].src
) {
this.activity.custom_data[0].src = this.activity.custom_data[0].src.replace(this.minds.site_url, this.minds.cdn_url);
}
if (!this.activity.message) {
this.activity.message = '';
}
......@@ -413,6 +413,25 @@ export class Activity implements OnInit {
return activity && activity.pending && activity.pending !== '0';
}
toggleMatureVisibility() {
this.activity.mature_visibility = !this.activity.mature_visibility;
if (this.activity.remind_object) {
// this.activity.remind_object.mature_visibility = !this.activity.remind_object.mature_visibility;
this.activity.remind_object = Object.assign({}, {
...this.activity.remind_object,
mature_visibility: !this.activity.remind_object.mature_visibility
});
}
this.detectChanges();
}
onRemindMatureVisibilityChange() {
this.activity.mature_visibility = !this.activity.mature_visibility;
}
detectChanges() {
this.cd.markForCheck();
this.cd.detectChanges();
......
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, EventEmitter, Input } from '@angular/core';
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, EventEmitter, Input, Output } from '@angular/core';
import { Client } from '../../../../../services/api';
import { Session } from '../../../../../services/session';
......@@ -33,6 +33,8 @@ export class Remind {
menuOptions: any = [];
canDelete: boolean = false;
@Output('matureVisibilityChange') onMatureVisibilityChange: EventEmitter<any> = new EventEmitter<any>();
constructor(
public session: Session,
public client: Client,
......@@ -119,4 +121,10 @@ export class Remind {
togglePin() { /* NOOP */ }
menuOptionSelected(e) { /* NOOP */ }
toggleMatureVisibility() {
this.activity.mature_visibility = !this.activity.mature_visibility;
this.onMatureVisibilityChange.emit();
}
}
......@@ -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;
}
}
import { Component, Injector, SkipSelf, ViewChild } from '@angular/core';
import { Subscription, BehaviorSubject } from 'rxjs';
import { filter } from 'rxjs/operators';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute, Router, RouterEvent, NavigationEnd } from '@angular/router';
import { Client, Upload } from '../../../services/api';
import { MindsTitle } from '../../../services/ux/title';
......@@ -52,6 +53,7 @@ export class NewsfeedSubscribedComponent {
paramsSubscription: Subscription;
reloadFeedSubscription: Subscription;
routerSubscription: Subscription;
@ViewChild('poster', { static: true }) private poster: PosterComponent;
......@@ -79,6 +81,16 @@ export class NewsfeedSubscribedComponent {
}
ngOnInit() {
this.routerSubscription = this.router.events.pipe(
filter((event: RouterEvent) => event instanceof NavigationEnd)
).subscribe(() => {
this.showBoostRotator = false;
this.load(true, true);
setTimeout(() => {
this.showBoostRotator = true;
}, 100);
});
this.reloadFeedSubscription = this.newsfeedService.onReloadFeed.subscribe(() => {
this.load(true, true);
});
......@@ -92,14 +104,6 @@ export class NewsfeedSubscribedComponent {
}
this.newUserPromo = !!params['newUser'];
if (params['ts']) {
this.showBoostRotator = false;
this.load(true);
setTimeout(() => {
this.showBoostRotator = true;
}, 300);
}
});
this.context.set('activity');
......@@ -108,6 +112,7 @@ export class NewsfeedSubscribedComponent {
ngOnDestroy() {
this.paramsSubscription.unsubscribe();
this.reloadFeedSubscription.unsubscribe();
this.routerSubscription.unsubscribe();
}
load(refresh: boolean = false, forceSync: boolean = false) {
......
......@@ -398,7 +398,7 @@
<!-- Boost revoked -->
<ng-template ngSwitchCase="boost_revoked">
<a [routerLink]="notification.entityObj.type == 'activity' ? ['/newsfeed', notification.entityObj.guid] : ['/boost/console/content']">
<a [routerLink]="notification.entityObj && notification.entityObj.type == 'activity' ? ['/newsfeed', notification.entityObj.guid] : ['/boost/console/content']">
<p><ng-container i18n="@@NOTIFICATIONS__NOTIFICATION__BOOST_REVOKED__BOOST_FOR">You revoked your boost <span *ngIf="notification.entityObj">for </span></ng-container>
<span class="pseudo-link mdl-color-text--blue-grey-400" *ngIf="notification.entityObj && notification.entityObj.title">{{notification.entityObj.title | excerpt}}</span>
<span class="pseudo-link mdl-color-text--blue-grey-400" *ngIf="notification.entityObj && !notification.entityObj.title && notification.entityObj.name">{{notification.entityObj.name}}</span>
......