Skip to content

Commit

Permalink
Connect Faye when clicking linking in alternate channels (#18)
Browse files Browse the repository at this point in the history
* connect faye when clicking on a channel with a link in alternate

* check if linkable
  • Loading branch information
lemieux committed Jun 15, 2016
1 parent 824244e commit 7b47271
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/js/services/app-service.js
Expand Up @@ -62,15 +62,16 @@ export function hideSettings() {
export function showChannelPage(channelType) {
const {user, app: {integrations}} = store.getState();
const channelDetails = CHANNELS_DETAILS[channelType];
const openLink = channelDetails.getURL && (!channelDetails.Component || isChannelLinked(user.clients, channelType));
const isLinked = isChannelLinked(user.clients, channelType);
const openLink = channelDetails.getURL && (!channelDetails.Component || isLinked);

if (openLink) {
const appChannel = getIntegration(integrations, channelType);
const link = channelDetails.getURL(user, appChannel, isChannelLinked(user.clients, channelType));
const link = channelDetails.getURL(user, appChannel, isLinked);

if (link) {
window.open(link);
return Promise.resolve();
return isLinked || !channelDetails.isLinkable ? Promise.resolve() : connectToFayeUser();
}
}

Expand Down

0 comments on commit 7b47271

Please sign in to comment.