From e95f2c2b687e3494229b3a2d6429e93fe801d269 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 8 Mar 2024 11:35:18 +0100 Subject: [PATCH] Add a glitch-soc local setting to make the post publish toast optional (#2666) --- app/javascript/flavours/glitch/actions/compose.js | 14 ++++++++------ .../glitch/features/local_settings/page/index.jsx | 8 ++++++++ app/javascript/flavours/glitch/locales/en.json | 1 + .../flavours/glitch/reducers/local_settings.js | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 06f0d79874..9e65df7b39 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -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)); }); diff --git a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx index 849a553e06..ea599afb6a 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/index.jsx @@ -224,6 +224,14 @@ class LocalSettingsPage extends PureComponent { > + + + state.mergeDeep(localSettings);