diff --git a/app/soapbox/actions/auth.js b/app/soapbox/actions/auth.js index e99ad9fdb..8f6345508 100644 --- a/app/soapbox/actions/auth.js +++ b/app/soapbox/actions/auth.js @@ -190,8 +190,8 @@ export function logOut() { }; } -export function switchAccount(accountId) { - return { type: SWITCH_ACCOUNT, accountId }; +export function switchAccount(accountId, reload = true) { + return { type: SWITCH_ACCOUNT, accountId, reload }; } export function fetchOwnAccounts() { diff --git a/app/soapbox/components/dropdown_menu.js b/app/soapbox/components/dropdown_menu.js index abaea33fe..2f2412928 100644 --- a/app/soapbox/components/dropdown_menu.js +++ b/app/soapbox/components/dropdown_menu.js @@ -117,21 +117,40 @@ class DropdownMenu extends React.PureComponent { } } + handleMiddleClick = e => { + const i = Number(e.currentTarget.getAttribute('data-index')); + const { middleClick } = this.props.items[i]; + + this.props.onClose(); + + if (e.button === 1 && typeof middleClick === 'function') { + e.preventDefault(); + middleClick(e); + } + } + + handleAuxClick = e => { + if (e.button === 1) { + this.handleMiddleClick(e); + } + } + renderItem(option, i) { if (option === null) { return
; } - const { text, href = '#', newTab, isLogout } = option; + const { text, href, to, newTab, isLogout } = option; return (