Commit 53a61a3f authored by Robert Knight's avatar Robert Knight

Remove activity page links for third-party open groups

Activity pages are currently only supported for open groups belonging to
the h service's first party authority.

The team has agreed that the best way to resolve this would be to only
include the "activity page" link in the `/api/groups` response for
groups where that is supported. However to give us more time to hammer
out the API details, we are committing a small change to the client in
the interim.
parent 218177ad
'use strict';
var { isThirdPartyUser } = require('../util/account-id');
var isThirdPartyService = require('../util/is-third-party-service');
var serviceConfig = require('../service-config');
// @ngInject
......@@ -38,6 +39,8 @@ function GroupListController($window, analytics, groups, settings, serviceUrl) {
if (svc && svc.icon) {
this.thirdPartyGroupIcon = svc.icon;
}
this.isThirdPartyService = isThirdPartyService(settings);
}
module.exports = {
......
......@@ -79,11 +79,11 @@ describe('groupList', function () {
};
}));
function createGroupList() {
function createGroupList({ userid } = { userid: 'acct:person@example.com' }) {
return util.createDirective(document, 'groupList', {
auth: {
status: 'logged-in',
userid: 'acct:person@example.com',
status: userid ? 'logged-in' : 'logged-out',
userid,
},
});
}
......@@ -105,6 +105,30 @@ describe('groupList', function () {
assert.equal(link[1].href, GROUP_LINK);
});
[{
// Logged-in third party user.
firstPartyAuthDomain: 'example.com',
authDomain: 'publisher.org',
userid: 'acct:person@publisher.org',
},{
// Logged-out third party user.
firstPartyAuthDomain: 'example.com',
authDomain: 'publisher.org',
userid: null,
}].forEach(({ firstPartyAuthDomain, authDomain, userid }) => {
it('should not render share links for third-party groups', () => {
fakeSettings.authDomain = firstPartyAuthDomain;
fakeSettings.services = [{
authority: authDomain,
}];
var element = createGroupList({ userid });
var shareLinks = element.find('.share-link-container');
assert.equal(shareLinks.length, 0);
});
});
it('should track metrics when a user attempts to view a groups activity', function () {
var element = createGroupList();
var link = element.find('.share-link');
......
......@@ -43,7 +43,7 @@
{{group.name}}
</a>
</div>
<div class="share-link-container" ng-click="$event.stopPropagation()">
<div class="share-link-container" ng-click="$event.stopPropagation()" ng-if="!vm.isThirdPartyService">
<a class="share-link"
href="{{group.url}}"
target="_blank"
......
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