logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: e7e35ead09589e1673dd6b6fdd24f7679ef108bf
parent a0c6d642af277954585b32724de4f2b157b02e42
Author: Tusooa Zhu <tusooa@kazv.moe>
Date:   Wed,  9 Feb 2022 16:21:19 -0500

Add confirmation for muting

Diffstat:

Msrc/components/user_card/user_card.js24++++++++++++++++++++++--
Msrc/components/user_card/user_card.vue18++++++++++++++++++
2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js @@ -8,6 +8,7 @@ import UserNote from '../user_note/user_note.vue' import Select from '../select/select.vue' import UserLink from '../user_link/user_link.vue' import RichContent from 'src/components/rich_content/rich_content.jsx' +import ConfirmModal from '../confirm_modal/confirm_modal.vue' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import { mapGetters } from 'vuex' import { library } from '@fortawesome/fontawesome-svg-core' @@ -46,7 +47,8 @@ export default { data () { return { followRequestInProgress: false, - betterShadow: this.$store.state.interface.browserSupport.cssFilter + betterShadow: this.$store.state.interface.browserSupport.cssFilter, + showingConfirmMute: false } }, created () { @@ -137,6 +139,9 @@ export default { supportsNote () { return 'note' in this.relationship }, + shouldConfirmMute () { + return this.mergedConfig.modalOnMute + }, ...mapGetters(['mergedConfig']) }, components: { @@ -149,11 +154,26 @@ export default { Select, RichContent, UserLink, - UserNote + UserNote, + ConfirmModal }, methods: { + showConfirmMute () { + this.showingConfirmMute = true + }, + hideConfirmMute () { + this.showingConfirmMute = false + }, muteUser () { + if (!this.shouldConfirmMute) { + this.doMuteUser() + } else { + this.showConfirmMute() + } + }, + doMuteUser () { this.$store.dispatch('muteUser', this.user.id) + this.hideConfirmMute() }, unmuteUser () { this.$store.dispatch('unmuteUser', this.user.id) diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue @@ -314,6 +314,24 @@ :handle-links="true" /> </div> + <confirm-modal + :showing="showingConfirmMute" + :title="$t('user_card.mute_confirm_title')" + :confirm-text="$t('user_card.mute_confirm_accept_button')" + :cancel-text="$t('user_card.mute_confirm_cancel_button')" + @accepted="doMuteUser" + @cancelled="hideConfirmMute" + > + <i18n + path="user_card.mute_confirm" + tag="span" + > + <span + place="user" + v-text="user.screen_name_ui" + /> + </i18n> + </confirm-modal> </div> </template>