Commit 92d0dc39 authored by Marcelo Rivera's avatar Marcelo Rivera

(fix): it should take the value from the session!

1 merge request!776Allow users to permanently hide "share" buttons in settings
Pipeline #117604470 running with stages
......@@ -157,7 +157,7 @@
<m-social-icons
[url]="blog.perma_url"
[title]="blog.title"
*ngIf="!blog.ownerObj.hide_share_buttons"
*ngIf="!session.getLoggedInUser().hide_share_buttons"
>
</m-social-icons>
......
......@@ -45,9 +45,7 @@ describe('Blog view component', () => {
guid: '1',
title: 'test blog',
description: 'description',
ownerObj: {
hide_share_buttons: false,
},
ownerObj: {},
allow_comments: true,
perma_url: '/perma',
thumbnail: '/thumbnail',
......@@ -84,6 +82,9 @@ describe('Blog view component', () => {
fixture = TestBed.createComponent(BlogView);
comp = fixture.componentInstance;
comp.blog = blog;
sessionMock.user.hide_share_buttons = false;
fixture.detectChanges();
});
......@@ -96,9 +97,7 @@ describe('Blog view component', () => {
expect(socialIcons).not.toBeNull();
const blog = Object.assign({}, comp.blog);
blog.ownerObj.hide_share_buttons = true;
comp.blog = blog;
sessionMock.user.hide_share_buttons = true;
fixture.detectChanges();
......
......@@ -330,7 +330,7 @@
*ngIf="
entity &&
!attachment.shouldBeBlurred(entity) &&
!entity.ownerObj?.hide_share_buttons
!session.getLoggedInUser().hide_share_buttons
"
>
</m-social-icons>
......
......@@ -47,6 +47,6 @@
[url]="siteUrl + 'newsfeed/' + activity?.guid"
[title]="activity?.title || ''"
[embed]="activity"
*ngIf="!activity?.ownerObj.hide_share_buttons"
*ngIf="!session.getLoggedInUser().hide_share_buttons"
>
</m-social-icons>
......@@ -111,6 +111,7 @@ describe('NewsfeedSingleComponent', () => {
};
sessionMock.user.admin = false;
sessionMock.user.hide_share_buttons = false;
featuresServiceMock.mock('sync-feeds', false);
fixture.detectChanges();
......@@ -199,9 +200,7 @@ describe('NewsfeedSingleComponent', () => {
expect(socialIcons).not.toBeNull();
const activity = Object.assign({}, comp.activity);
activity.ownerObj.hide_share_buttons = true;
comp.activity = activity;
sessionMock.user.hide_share_buttons = true;
fixture.detectChanges();
......
......@@ -12,6 +12,7 @@ export let sessionMock = new (function() {
disabled_boost: false,
username: 'test',
show_boosts: true,
hide_share_buttons: false,
};
this.loggedIn = true;
this.isAdmin = () => {
......
Please register or to comment