Skip to content

Commit

Permalink
Merge pull request #470 from hypothesis/allow-oauth-enabled-override
Browse files Browse the repository at this point in the history
Allow "oauthEnabled" setting to be overridden in client config
  • Loading branch information
seanh authored Jun 28, 2017
2 parents eb093f7 + 7a15733 commit 6f3d331
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/annotator/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ function configFrom(window_) {
enableMultiFrameSupport: settings.hostPageSetting('enableMultiFrameSupport'),
embedScriptUrl: settings.hostPageSetting('embedScriptUrl'),
subFrameInstance: settings.hostPageSetting('subFrameInstance'),

// Temporary feature flag override for 1st-party OAuth
oauthEnabled: settings.hostPageSetting('oauthEnabled'),
};
}

Expand Down
1 change: 1 addition & 0 deletions src/annotator/config/test/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ describe('annotator.config.index', function() {
var settings = {
'openLoginForm': 'OPEN_LOGIN_FORM_SETTING',
'openSidebar': 'OPEN_SIDEBAR_SETTING',
'oauthEnabled': true,
'branding': 'BRANDING_SETTING',
'services': 'SERVICES_SETTING',
};
Expand Down
6 changes: 5 additions & 1 deletion src/sidebar/host-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function hostPageConfig(window) {
var paramWhiteList = [
// Direct-linked annotation ID
'annotations',

// Default query passed by url
'query',

Expand All @@ -31,6 +31,10 @@ function hostPageConfig(window) {
'showHighlights',
'services',
'branding',

// OAuth feature flag override.
// This should be removed once OAuth is enabled for first party accounts.
'oauthEnabled',
];

return Object.keys(config).reduce(function (result, key) {
Expand Down
2 changes: 2 additions & 0 deletions src/sidebar/test/host-config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('hostPageConfig', function () {
var window_ = fakeWindow({
annotations: '1234',
appType: 'bookmarklet',
oauthEnabled: true,
openSidebar: true,
openLoginForm: true,
showHighlights: true,
Expand All @@ -26,6 +27,7 @@ describe('hostPageConfig', function () {
assert.deepEqual(hostPageConfig(window_), {
annotations: '1234',
appType: 'bookmarklet',
oauthEnabled: true,
openSidebar: true,
openLoginForm: true,
showHighlights: true,
Expand Down

0 comments on commit 6f3d331

Please sign in to comment.