From e69dddee69f82f16e175cc13b9ac81d0bc1ae48e Mon Sep 17 00:00:00 2001 From: Eris Date: Thu, 25 Aug 2022 05:13:47 +0000 Subject: [PATCH] New option: Require confirmation for boosts --- .../retweet_button/retweet_button.js | 20 ++++++++++++++++--- .../settings_modal/tabs/general_tab.vue | 7 +++++++ src/i18n/en.json | 3 +++ src/modules/config.js | 1 + src/modules/instance.js | 1 + 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js index 4f71af0a..be0c4634 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.confirmRetweets) { + if (!this.status.repeated) { + const confirmed = window.confirm(this.$t('status.retweet_confirm')) + if (confirmed) { + this.$store.dispatch('retweet', { id: this.status.id }) + } + } else { + const confirmed = window.confirm(this.$t('status.unretweet_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 0655cdb4..39a6a167 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -164,6 +164,13 @@ {{ $t('settings.autohide_floating_post_button') }} +
  • + + {{ $t('settings.confirm_retweets') }} + +
  • diff --git a/src/i18n/en.json b/src/i18n/en.json index 21294c95..b4571184 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -518,6 +518,7 @@ "reply_visibility_following_short": "Show replies to my follows", "reply_visibility_self_short": "Show replies to self only", "autohide_floating_post_button": "Automatically hide New Post button (mobile)", + "confirm_retweets": "Require confirmation for boosts/unboosts", "saving_err": "Error saving settings", "saving_ok": "Settings saved", "search_user_to_block": "Search whom you want to block", @@ -804,6 +805,8 @@ "bookmark": "Bookmark", "unbookmark": "Unbookmark", "delete_confirm": "Do you really want to delete this status?", + "retweet_confirm": "Boost this status?", + "unretweet_confirm": "Undo boost?", "reply_to": "Reply to", "mentions": "Mentions", "replies_list": "Replies:", diff --git a/src/modules/config.js b/src/modules/config.js index 8f60ac44..5d953e29 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -42,6 +42,7 @@ export const defaultState = { hideSiteName: undefined, // instance default hideAttachments: false, hideAttachmentsInConv: false, + confirmRetweets: undefined, // instance default maxThumbnails: 16, hideNsfw: true, preloadImage: true, diff --git a/src/modules/instance.js b/src/modules/instance.js index ffd3f326..ce1d5fed 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -38,6 +38,7 @@ const defaultState = { hideSiteName: false, hideUserStats: false, muteBotStatuses: false, + confirmRetweets: false, loginMethod: 'password', logo: '/static/logo.svg', logoMargin: '.2em',