Add a glitch-soc local setting to make the post publish toast optional (#2666)

pull/2677/head
Claire 2024-03-08 11:35:18 +01:00 committed by GitHub
parent d002458c7b
commit e95f2c2b68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View File

@ -266,12 +266,14 @@ export function submitCompose(routerHistory, overridePrivacy = null) {
insertIfOnline('direct'); insertIfOnline('direct');
} }
dispatch(showAlert({ if (getState().getIn(['local_settings', 'show_published_toast'])) {
message: statusId === null ? messages.published : messages.saved, dispatch(showAlert({
action: messages.open, message: statusId === null ? messages.published : messages.saved,
dismissAfter: 10000, action: messages.open,
onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`), dismissAfter: 10000,
})); onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`),
}));
}
}).catch(function (error) { }).catch(function (error) {
dispatch(submitComposeFail(error)); dispatch(submitComposeFail(error));
}); });

View File

@ -224,6 +224,14 @@ class LocalSettingsPage extends PureComponent {
> >
<FormattedMessage id='settings.show_content_type_choice' defaultMessage='Show content-type choice when authoring toots' /> <FormattedMessage id='settings.show_content_type_choice' defaultMessage='Show content-type choice when authoring toots' />
</LocalSettingsPageItem> </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 <LocalSettingsPageItem
settings={settings} settings={settings}
item={['side_arm']} item={['side_arm']}

View File

@ -127,6 +127,7 @@
"settings.shared_settings_link": "user preferences", "settings.shared_settings_link": "user preferences",
"settings.show_action_bar": "Show action buttons in collapsed toots", "settings.show_action_bar": "Show action buttons in collapsed toots",
"settings.show_content_type_choice": "Show content-type choice when authoring 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.show_reply_counter": "Display an estimate of the reply count",
"settings.side_arm": "Secondary toot button:", "settings.side_arm": "Secondary toot button:",
"settings.side_arm.none": "None", "settings.side_arm.none": "None",

View File

@ -61,6 +61,7 @@ const initialState = ImmutableMap({
media: true, media: true,
visibility: true, visibility: true,
}), }),
show_published_toast: true,
}); });
const hydrate = (state, localSettings) => state.mergeDeep(localSettings); const hydrate = (state, localSettings) => state.mergeDeep(localSettings);