Skip to content

Commit

Permalink
Add a glitch-soc local setting to make the post publish toast optional (
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored Mar 8, 2024
1 parent d002458 commit e95f2c2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/javascript/flavours/glitch/actions/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ export function submitCompose(routerHistory, overridePrivacy = null) {
insertIfOnline('direct');
}

dispatch(showAlert({
message: statusId === null ? messages.published : messages.saved,
action: messages.open,
dismissAfter: 10000,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`),
}));
if (getState().getIn(['local_settings', 'show_published_toast'])) {
dispatch(showAlert({
message: statusId === null ? messages.published : messages.saved,
action: messages.open,
dismissAfter: 10000,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`),
}));
}
}).catch(function (error) {
dispatch(submitComposeFail(error));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ class LocalSettingsPage extends PureComponent {
>
<FormattedMessage id='settings.show_content_type_choice' defaultMessage='Show content-type choice when authoring toots' />
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['show_published_toast']}
id='mastodon-settings--show_published_toast'
onChange={onChange}
>
<FormattedMessage id='settings.show_published_toast' defaultMessage='Display toast when publishing/saving a post' />
</LocalSettingsPageItem>
<LocalSettingsPageItem
settings={settings}
item={['side_arm']}
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"settings.shared_settings_link": "user preferences",
"settings.show_action_bar": "Show action buttons in collapsed toots",
"settings.show_content_type_choice": "Show content-type choice when authoring toots",
"settings.show_published_toast": "Display toast when publishing/saving a post",
"settings.show_reply_counter": "Display an estimate of the reply count",
"settings.side_arm": "Secondary toot button:",
"settings.side_arm.none": "None",
Expand Down
1 change: 1 addition & 0 deletions app/javascript/flavours/glitch/reducers/local_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const initialState = ImmutableMap({
media: true,
visibility: true,
}),
show_published_toast: true,
});

const hydrate = (state, localSettings) => state.mergeDeep(localSettings);
Expand Down

0 comments on commit e95f2c2

Please sign in to comment.