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 committed Mar 6, 2024
1 parent 8f4cc71 commit 1130e50
Show file tree
Hide file tree
Showing 3 changed files with 17 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/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 1130e50

Please sign in to comment.