logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 3c707608ce828a2221e496df48bd2b3f9aecd5d4
parent 12d8d1711bb41b14c35914cb82a6d5f41943e198
Author: Sean King <seanking2919@protonmail.com>
Date:   Sat, 17 Sep 2022 11:36:34 -0600

Change "Remove this follower" to "Remove Follower" and add a button to remove a follower in the followers tab for the logged in user

Diffstat:

Msrc/components/account_actions/account_actions.vue2+-
Msrc/components/follow_card/follow_card.js4+++-
Msrc/components/follow_card/follow_card.vue11+++++++++++
Asrc/components/remove_follower_button/remove_follower_button.js25+++++++++++++++++++++++++
Asrc/components/remove_follower_button/remove_follower_button.vue13+++++++++++++
Msrc/i18n/en.json2+-
6 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue @@ -34,7 +34,7 @@ class="btn button-default btn-block dropdown-item" @click="removeUserFromFollowers" > - {{ $t('user_card.remove_this_follower') }} + {{ $t('user_card.remove_follower') }} </button> <button v-if="relationship.blocking" diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js @@ -1,6 +1,7 @@ import BasicUserCard from '../basic_user_card/basic_user_card.vue' import RemoteFollow from '../remote_follow/remote_follow.vue' import FollowButton from '../follow_button/follow_button.vue' +import RemoveFollowerButton from '../remove_follower_button/remove_follower_button.vue' const FollowCard = { props: [ @@ -10,7 +11,8 @@ const FollowCard = { components: { BasicUserCard, RemoteFollow, - FollowButton + FollowButton, + RemoveFollowerButton }, computed: { isMe () { diff --git a/src/components/follow_card/follow_card.vue b/src/components/follow_card/follow_card.vue @@ -22,6 +22,11 @@ class="follow-card-follow-button" :user="user" /> + <RemoveFollowerButton + v-if="noFollowsYou && relationship.followed_by" + :relationship="relationship" + class="follow-card-button" + /> </template> </div> </basic-user-card> @@ -40,6 +45,12 @@ line-height: 1.5em; } + &-button { + margin-top: 0.5em; + padding: 0 1.5em; + margin-left: 1em; + } + &-follow-button { margin-top: 0.5em; margin-left: auto; diff --git a/src/components/remove_follower_button/remove_follower_button.js b/src/components/remove_follower_button/remove_follower_button.js @@ -0,0 +1,25 @@ +export default { + props: ['relationship'], + data () { + return { + inProgress: false + } + }, + computed: { + label () { + if (this.inProgress) { + return this.$t('user_card.follow_progress') + } else { + return this.$t('user_card.remove_follower') + } + } + }, + methods: { + onClick () { + this.inProgress = true + this.$store.dispatch('removeUserFromFollowers', this.relationship.id).then(() => { + this.inProgress = false + }) + } + } +} diff --git a/src/components/remove_follower_button/remove_follower_button.vue b/src/components/remove_follower_button/remove_follower_button.vue @@ -0,0 +1,13 @@ +<template> + <button + class="btn button-default follow-button" + :class="{ toggled: inProgress }" + :disabled="inProgress" + :title="$t('user_card.remove_follower')" + @click="onClick" + > + {{ label }} + </button> +</template> + +<script src="./remove_follower_button.js"></script> diff --git a/src/i18n/en.json b/src/i18n/en.json @@ -878,7 +878,7 @@ "muted": "Muted", "per_day": "per day", "remote_follow": "Remote follow", - "remove_this_follower": "Remove this follower", + "remove_follower": "Remove follower", "report": "Report", "statuses": "Statuses", "subscribe": "Subscribe",