diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 7dec0c3d7c..acd93e0650 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -18,7 +18,8 @@ const AccountActions = { ], data () { return { - showingConfirmBlock: false + showingConfirmBlock: false, + showingConfirmRemoveFollower: false } }, components: { @@ -34,6 +35,12 @@ const AccountActions = { hideConfirmBlock () { this.showingConfirmBlock = false }, + showConfirmRemoveUserFromFollowers () { + this.showingConfirmRemoveFollower = true + }, + hideConfirmRemoveUserFromFollowers () { + this.showingConfirmRemoveFollower = false + }, showRepeats () { this.$store.dispatch('showReblogs', this.user.id) }, @@ -55,7 +62,15 @@ const AccountActions = { this.$store.dispatch('unblockUser', this.user.id) }, removeUserFromFollowers () { + if (!this.shouldConfirmRemoveUserFromFollowers) { + this.doRemoveUserFromFollowers() + } else { + this.showConfirmRemoveUserFromFollowers() + } + }, + doRemoveUserFromFollowers () { this.$store.dispatch('removeUserFromFollowers', this.user.id) + this.hideConfirmRemoveUserFromFollowers() }, reportUser () { this.$store.dispatch('openUserReportingModal', { userId: this.user.id }) @@ -71,6 +86,9 @@ const AccountActions = { shouldConfirmBlock () { return this.$store.getters.mergedConfig.modalOnBlock }, + shouldConfirmRemoveUserFromFollowers () { + return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers + }, ...mapState({ pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable }) diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index 161bab0999..ce19291a1d 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -95,6 +95,27 @@ + + + + + + + diff --git a/src/components/follow_card/follow_card.vue b/src/components/follow_card/follow_card.vue index eff69fb237..bdb6b80927 100644 --- a/src/components/follow_card/follow_card.vue +++ b/src/components/follow_card/follow_card.vue @@ -24,6 +24,7 @@ /> diff --git a/src/components/remove_follower_button/remove_follower_button.js b/src/components/remove_follower_button/remove_follower_button.js index e1a7531bfe..052a519ff2 100644 --- a/src/components/remove_follower_button/remove_follower_button.js +++ b/src/components/remove_follower_button/remove_follower_button.js @@ -1,10 +1,16 @@ +import ConfirmModal from '../confirm_modal/confirm_modal.vue' + export default { - props: ['relationship'], + props: ['user', 'relationship'], data () { return { - inProgress: false + inProgress: false, + showingConfirmRemoveFollower: false } }, + components: { + ConfirmModal + }, computed: { label () { if (this.inProgress) { @@ -12,14 +18,31 @@ export default { } else { return this.$t('user_card.remove_follower') } + }, + shouldConfirmRemoveUserFromFollowers () { + return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers } }, methods: { + showConfirmRemoveUserFromFollowers () { + this.showingConfirmRemoveFollower = true + }, + hideConfirmRemoveUserFromFollowers () { + this.showingConfirmRemoveFollower = false + }, onClick () { + if (!this.shouldConfirmRemoveUserFromFollowers) { + this.doRemoveUserFromFollowers() + } else { + this.showConfirmRemoveUserFromFollowers() + } + }, + doRemoveUserFromFollowers () { this.inProgress = true this.$store.dispatch('removeUserFromFollowers', this.relationship.id).then(() => { this.inProgress = false }) + this.hideConfirmRemoveUserFromFollowers() } } } diff --git a/src/components/remove_follower_button/remove_follower_button.vue b/src/components/remove_follower_button/remove_follower_button.vue index a3a4c24268..0012aebd13 100644 --- a/src/components/remove_follower_button/remove_follower_button.vue +++ b/src/components/remove_follower_button/remove_follower_button.vue @@ -7,6 +7,27 @@ @click="onClick" > {{ label }} + + + + + + + diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index 9de3ed81f3..703e94a0f5 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -191,6 +191,11 @@ {{ $t('settings.confirm_dialogs_deny_follow') }} +
  • + + {{ $t('settings.confirm_dialogs_remove_follower') }} + +
  • diff --git a/src/i18n/en.json b/src/i18n/en.json index 213f9cf012..ca022c8213 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -429,6 +429,7 @@ "confirm_dialogs_logout": "logging out", "confirm_dialogs_approve_follow": "approving a follower", "confirm_dialogs_deny_follow": "denying a follower", + "confirm_dialogs_remove_follower": "removing a follower", "mutes_and_blocks": "Mutes and Blocks", "data_import_export_tab": "Data import / export", "default_vis": "Default visibility scope", @@ -964,6 +965,10 @@ "per_day": "per day", "remote_follow": "Remote follow", "remove_follower": "Remove follower", + "remove_follower_confirm_title": "Remove follower confirmation", + "remove_follower_confirm_accept_button": "Remove", + "remove_follower_confirm_cancel_button": "Keep", + "remove_follower_confirm": "Do you really want to remove {user} from your followers?", "report": "Report", "statuses": "Statuses", "subscribe": "Subscribe", diff --git a/src/modules/config.js b/src/modules/config.js index 1df279a224..8e6b2c3de1 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -86,6 +86,7 @@ export const defaultState = { modalOnLogout: undefined, // instance default modalOnApproveFollow: undefined, // instance default modalOnDenyFollow: undefined, // instance default + modalOnRemoveUserFromFollowers: undefined, // instance default playVideosInModal: false, useOneClickNsfw: false, useContainFit: true, diff --git a/src/modules/instance.js b/src/modules/instance.js index fcb6eecc67..ce958907b0 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -79,6 +79,7 @@ const defaultState = { modalOnLogout: true, modalOnApproveFollow: false, modalOnDenyFollow: false, + modalOnRemoveUserFromFollowers: false, loginMethod: 'password', logo: '/static/logo.svg', logoMargin: '.2em',