Skip to content

Commit c6b7957

Browse files
koyuawsmbrtnhiyuki2578
authored andcommitted
Added logout to dropdown menu (mastodon#11353)
* Added logout to dropdown menu * Triggering build-and-test with empty commit as it seems it failed due to some internal failure * Looks fine, ready to review * Added changes from review * method can be null without any problems * Also target can be null
1 parent 10dec94 commit c6b7957

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

app/javascript/mastodon/components/dropdown_menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ class DropdownMenu extends React.PureComponent {
122122
return <li key={`sep-${i}`} className='dropdown-menu__separator' />;
123123
}
124124

125-
const { text, href = '#' } = option;
125+
const { text, href = '#', target = '_blank', method } = option;
126126

127127
return (
128128
<li className='dropdown-menu__item' key={`${text}-${i}`}>
129-
<a href={href} target='_blank' rel='noopener' role='button' tabIndex='0' ref={i === 0 ? this.setFocusRef : null} onClick={this.handleClick} onKeyDown={this.handleItemKeyDown} data-index={i}>
129+
<a href={href} target={target} data-method={method} rel='noopener' role='button' tabIndex='0' ref={i === 0 ? this.setFocusRef : null} onClick={this.handleClick} onKeyDown={this.handleItemKeyDown} data-index={i}>
130130
{text}
131131
</a>
132132
</li>

app/javascript/mastodon/features/compose/components/action_bar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const messages = defineMessages({
1515
domain_blocks: { id: 'navigation_bar.domain_blocks', defaultMessage: 'Hidden domains' },
1616
mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
1717
filters: { id: 'navigation_bar.filters', defaultMessage: 'Muted words' },
18+
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
1819
});
1920

2021
export default @injectIntl
@@ -42,6 +43,8 @@ class ActionBar extends React.PureComponent {
4243
menu.push({ text: intl.formatMessage(messages.blocks), to: '/blocks' });
4344
menu.push({ text: intl.formatMessage(messages.domain_blocks), to: '/domain_blocks' });
4445
menu.push({ text: intl.formatMessage(messages.filters), href: '/filters' });
46+
menu.push(null);
47+
menu.push({ text: intl.formatMessage(messages.logout), href: '/auth/sign_out', target: null, method: 'delete' });
4548

4649
return (
4750
<div className='compose__action-bar'>

0 commit comments

Comments
 (0)