-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2145 from jpevarnek/login-common
Move some of the common login functionality to a common location
- Loading branch information
Showing
4 changed files
with
69 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/// <reference path='./context.d.ts' /> | ||
/// <reference path='../../../../third_party/typings/es6-promise/es6-promise.d.ts' /> | ||
/// <reference path='../../../../third_party/typings/lodash/lodash.d.ts' /> | ||
|
||
import _ = require('lodash'); | ||
|
||
var ui = ui_context.ui; | ||
var core = ui_context.core; | ||
var model = ui_context.model; | ||
|
||
//TODO: remove this when we switch to roster-as-default | ||
var loginCommon = { | ||
copypaste: function() { | ||
// Logout of all other social networks before starting | ||
// copypaste connection. | ||
var getConfirmation = Promise.resolve<void>(); | ||
if (model.onlineNetworks.length > 0) { | ||
var confirmationMessage = | ||
ui.i18n_t('CONFIRM_LOGOUT_FOR_COPYPASTE'); | ||
getConfirmation = ui.getConfirmation('', confirmationMessage); | ||
} | ||
|
||
getConfirmation.then(ui.logoutAll).then(() => { | ||
if (this.closeInviteUserPanel) { | ||
this.closeInviteUserPanel(); | ||
} | ||
this.fire('core-signal', { name: 'copypaste-init' }); | ||
}); | ||
}, | ||
updateNetworkButtonNames: function() { | ||
this.networkButtonNames = _.filter(model.networkNames, (name) => { | ||
// we do not want a button for Quiver | ||
return name !== 'Quiver'; | ||
}); | ||
this.supportsQuiver = model.hasQuiverSupport(); | ||
}, | ||
}; | ||
export = loginCommon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters