diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js index 4f71af0a..308cd527 100644 --- a/src/components/retweet_button/retweet_button.js +++ b/src/components/retweet_button/retweet_button.js @@ -12,10 +12,24 @@ const RetweetButton = { }, methods: { retweet () { - if (!this.status.repeated) { - this.$store.dispatch('retweet', { id: this.status.id }) + if (this.mergedConfig.confirmRepeats) { + if (!this.status.repeated) { + const confirmed = window.confirm(this.$t('status.repeat_confirm')) + if (confirmed) { + this.$store.dispatch('retweet', { id: this.status.id }) + } + } else { + const confirmed = window.confirm(this.$t('status.unrepeat_confirm')) + if (confirmed) { + this.$store.dispatch('unretweet', { id: this.status.id }) + } + } } else { - this.$store.dispatch('unretweet', { id: this.status.id }) + if (!this.status.repeated) { + this.$store.dispatch('retweet', { id: this.status.id }) + } else { + this.$store.dispatch('unretweet', { id: this.status.id }) + } } this.animated = true setTimeout(() => { diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index 4f5a5bc7..d10bbb9c 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -172,6 +172,13 @@ {{ $t('settings.autohide_floating_post_button') }} +
  • + + {{ $t('settings.confirm_repeats') }} + +
  • diff --git a/src/i18n/en.json b/src/i18n/en.json index 84e4a185..841c3b21 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -396,6 +396,7 @@ "collapse_subject": "Collapse posts with subjects", "composing": "Composing", "confirm_new_password": "Confirm new password", + "confirm_repeats": "Require confirmation for repeats", "conversation_display": "Conversation display style", "conversation_display_linear": "Linear-style", "conversation_display_tree": "Tree-style", @@ -836,6 +837,8 @@ "pinned": "Pinned", "plus_more": "+{number} more", "remove_attachment": "Remove attachment", + "repeat_confirm": "Repeat this post?", + "unrepeat_confirm": "Undo repeat?", "repeats": "Repeats", "replies_list": "Replies:", "replies_list_with_others": "Replies (+{numReplies} other): | Replies (+{numReplies} others):", diff --git a/src/modules/config.js b/src/modules/config.js index 5b60520b..a398aa84 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -43,6 +43,7 @@ export const defaultState = { hideSiteName: undefined, // instance default hideAttachments: false, hideAttachmentsInConv: false, + confirmRepeats: undefined, // instance default maxThumbnails: 16, hideNsfw: true, preloadImage: true, diff --git a/src/modules/instance.js b/src/modules/instance.js index faa8692a..9b1c3c85 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -38,6 +38,7 @@ const defaultState = { hideSiteName: false, hideUserStats: false, muteBotStatuses: false, + confirmRepeats: false, loginMethod: 'password', logo: '/static/logo.svg', logoMargin: '.2em',