Skip to content

Commit

Permalink
Merge pull request #658 from hypothesis/hide-direct-link-cta-for-thir…
Browse files Browse the repository at this point in the history
…d-party-accounts

Hide the direct-link CTA for third party accounts
  • Loading branch information
seanh authored Jan 30, 2018
2 parents b916ee2 + ad67c28 commit 69a9c2b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sidebar/components/sidebar-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var SearchClient = require('../search-client');
var events = require('../events');
var isThirdPartyService = require('../util/is-third-party-service');
var memoize = require('../util/memoize');
var tabs = require('../tabs');
var uiConstants = require('../ui-constants');
Expand Down Expand Up @@ -292,6 +293,12 @@ function SidebarContentController(
return false;
}

// The CTA text and links are only applicable when using Hypothesis
// accounts.
if (isThirdPartyService(settings)) {
return false;
}

// The user is logged out and has landed on a direct linked
// annotation. If there is an annotation selection and that
// selection is available to the user, show the CTA.
Expand Down
11 changes: 11 additions & 0 deletions src/sidebar/components/test/sidebar-content-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,17 @@ describe('sidebar.components.sidebar-content', function () {
$scope.$digest();
assert.isFalse(ctrl.shouldShowLoggedOutMessage());
});

it('does not show loggedout message if using third-party accounts', function () {
fakeSettings.services = [{ authority: 'publisher.com' }];
addFrame();
ctrl.auth = { status: 'logged-out' };
annotationUI.addAnnotations([{id: '123'}]);
annotationUI.selectAnnotations(['123']);
$scope.$digest();

assert.isFalse(ctrl.shouldShowLoggedOutMessage());
});
});

describe('deferred websocket connection', function () {
Expand Down

0 comments on commit 69a9c2b

Please sign in to comment.