Skip to content
Permalink
Browse files

Add open in new window option to sidebar groups #1074

  • Loading branch information...
Thomas101 committed Aug 8, 2019
1 parent be8e336 commit 9b39bbf62aab201c9c50ab55884100d5951a37e9
@@ -48,7 +48,7 @@ class LiveConfig {
get osRelease () { return this.config.osRelease }
get iEngine () { return this.config.iEngine }
get hasIEngine () { return !!this.iEngine }
get shimOutlookPDFPreview () { return this.config.wireConfigExperiments.shimOutlookPDFPreview !== false }
get shimOutlookPDFPreview () { return this.config.wireConfigExperiments.shimOutlookPDFPreview === true }
}

export default new LiveConfig()
@@ -33,8 +33,8 @@ import CompareArrowsIcon from '@material-ui/icons/CompareArrows'
const ITEM_TYPES = Object.freeze({
DIVIDER: 'DIVIDER',
INFO: 'INFO',
SERVICE_OPEN_NEW: 'SERVICE_OPEN_NEW',
SERVICE_OPEN_NEW_BLANK: 'SERVICE_OPEN_NEW_BLANK',
OPEN_NEW: 'OPEN_NEW',
OPEN_NEW_BLANK: 'OPEN_NEW_BLANK',
SERVICE_SLEEP: 'SERVICE_SLEEP',
MAILBOX_SLEEP: 'MAILBOX_SLEEP',
SERVICE_RELOAD: 'SERVICE_RELOAD',
@@ -331,20 +331,25 @@ export default class MailboxAndServiceContextMenuContent extends React.Component
* @param evt: the event that fired
*/
handleOpenInWindow = (evt) => {
const { mailboxShimService, service } = this.state
const { serviceId } = this.props
const actionServiceId = serviceId || mailboxShimService
const fallbackUrl = (service || {}).url || (accountStore.getState().getService(mailboxShimService) || {}).url
this.closePopover(evt)
const url = accountDispatch.getCurrentUrl(serviceId) || this.state.service.url
AccountLinker.openContentWindow(serviceId, url)
const url = accountDispatch.getCurrentUrl(actionServiceId) || fallbackUrl
AccountLinker.openContentWindow(actionServiceId, url)
}

/**
* Handles opening a blank window in this scope
* @param evt: the event that fired
*/
handleOpenBlankWindow = (evt) => {
const { mailboxShimService } = this.state
const { serviceId } = this.props
const actionServiceId = serviceId || mailboxShimService
this.closePopover(evt)
AccountLinker.openContentWindow(serviceId, '')
AccountLinker.openContentWindow(actionServiceId, '')
}

handleAddService = (evt) => {
@@ -450,14 +455,14 @@ export default class MailboxAndServiceContextMenuContent extends React.Component
} />
</MenuItem>
)
case ITEM_TYPES.SERVICE_OPEN_NEW:
case ITEM_TYPES.OPEN_NEW:
return (
<MenuItem onClick={this.handleOpenInWindow}>
<ListItemIcon><OpenInNewIcon /></ListItemIcon>
<ListItemText inset primary='Open in New Window' />
</MenuItem>
)
case ITEM_TYPES.SERVICE_OPEN_NEW_BLANK:
case ITEM_TYPES.OPEN_NEW_BLANK:
return (
<MenuItem onClick={this.handleOpenBlankWindow}>
<ListItemIcon><OpenInNewIcon /></ListItemIcon>
@@ -652,7 +657,8 @@ export default class MailboxAndServiceContextMenuContent extends React.Component
service,
serviceCount,
userHasSleepable,
serviceType
serviceType,
mailboxShimService
} = this.state
if (!mailbox) { return false }

@@ -663,8 +669,8 @@ export default class MailboxAndServiceContextMenuContent extends React.Component
{/* Info & Util */}
{this.renderItem(ITEM_TYPES.INFO)}
{serviceType === SERVICE_TYPES.GOOGLE_INBOX ? this.renderItem(ITEM_TYPES.GOOGLE_INBOX_CONVERT) : undefined}
{service ? this.renderItem(ITEM_TYPES.SERVICE_OPEN_NEW) : undefined}
{service ? this.renderItem(ITEM_TYPES.SERVICE_OPEN_NEW_BLANK) : undefined}
{service || mailboxShimService ? this.renderItem(ITEM_TYPES.OPEN_NEW) : undefined}
{service || mailboxShimService ? this.renderItem(ITEM_TYPES.OPEN_NEW_BLANK) : undefined}

{/* Sleep */}
{userHasSleepable && service ? this.renderItem(ITEM_TYPES.SERVICE_SLEEP) : undefined}
@@ -206,7 +206,7 @@ class CoreUserStore extends RemoteStore {
* @return true if we should shim the preview
*/
this.wireConfigShimOutlookPDFPreview = () => {
return this.wireConfigExperiments().shimOutlookPDFPreview !== false
return this.wireConfigExperiments().shimOutlookPDFPreview === true
}

/**

0 comments on commit 9b39bbf

Please sign in to comment.
You can’t perform that action at this time.