Commit 26eb97c2 authored by Ben Hayward's avatar Ben Hayward

Fix for hiding blog content when paywall not met. #1916

1 merge request!573[Sprint/OldfashionedOwl](fix): Hiding blog content when paywall not met. #1916
Pipeline #84490883 running with stages
......@@ -91,7 +91,7 @@
</div>
</div>
<div style="width:100%; padding:8px; position:relative;">
<div style="width:100%; padding:8px; position:relative;" *ngIf="canView()">
<div
class="mdl-cell mdl-cell--12-col minds-blog-body"
[innerHtml]="blog.description | safe"
......@@ -140,7 +140,8 @@
<m-wire--lock-screen
[(entity)]="blog"
*ngIf="blog.paywall"
(update)="onUnlock($event)"
*ngIf="blog.paywall && !canView()"
#lockScreen
></m-wire--lock-screen>
......
......@@ -43,7 +43,7 @@ export class BlogView implements OnInit, OnDestroy {
inProgress: boolean = false;
moreData: boolean = true;
activeBlog: number = 0;
unlocked: boolean = false;
visible: boolean = false;
index: number = 0;
......@@ -218,4 +218,25 @@ export class BlogView implements OnInit, OnDestroy {
onResize(event: Event) {
this.calculateLockScreenHeight();
}
/**
* Called on wire-threshold component event.
* Sets local state to unlocked.
* @param $event
*/
onUnlock($event: any) {
this.unlocked = true;
}
/**
* Determines if a user can view the blog.
*/
canView() {
return (
!this.blog.paywall ||
this.unlocked ||
this.blog.ownerObj.guid === this.session.getLoggedInUser().guid ||
this.session.isAdmin()
);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment