Added support for removing users from followers
This commit is contained in:
parent
4f837f75ea
commit
2453a338be
5 changed files with 28 additions and 0 deletions
|
@ -52,6 +52,9 @@ const AccountActions = {
|
||||||
unblockUser () {
|
unblockUser () {
|
||||||
this.$store.dispatch('unblockUser', this.user.id)
|
this.$store.dispatch('unblockUser', this.user.id)
|
||||||
},
|
},
|
||||||
|
removeUserFromFollowers () {
|
||||||
|
this.$store.dispatch('removeUserFromFollowers', this.user.id)
|
||||||
|
},
|
||||||
reportUser () {
|
reportUser () {
|
||||||
this.$store.dispatch('openUserReportingModal', { userId: this.user.id })
|
this.$store.dispatch('openUserReportingModal', { userId: this.user.id })
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
class="dropdown-divider"
|
class="dropdown-divider"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<button
|
||||||
|
v-if="relationship.followed_by"
|
||||||
|
class="btn button-default btn-block dropdown-item"
|
||||||
|
@click="removeUserFromFollowers"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.remove_this_follower') }}
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="relationship.blocking"
|
v-if="relationship.blocking"
|
||||||
class="btn button-default btn-block dropdown-item"
|
class="btn button-default btn-block dropdown-item"
|
||||||
|
|
|
@ -1124,6 +1124,7 @@
|
||||||
"note": "Private note",
|
"note": "Private note",
|
||||||
"per_day": "per day",
|
"per_day": "per day",
|
||||||
"remote_follow": "Remote follow",
|
"remote_follow": "Remote follow",
|
||||||
|
"remove_this_follower": "Remove this follower",
|
||||||
"replies": "With Replies",
|
"replies": "With Replies",
|
||||||
"report": "Report",
|
"report": "Report",
|
||||||
"show_repeats": "Show repeats",
|
"show_repeats": "Show repeats",
|
||||||
|
|
|
@ -54,6 +54,11 @@ const unblockUser = (store, id) => {
|
||||||
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeUserFromFollowers = (store, id) => {
|
||||||
|
return store.rootState.api.backendInteractor.removeUserFromFollowers({ id })
|
||||||
|
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
||||||
|
}
|
||||||
|
|
||||||
const muteUser = (store, id) => {
|
const muteUser = (store, id) => {
|
||||||
const predictedRelationship = store.state.relationships[id] || { id }
|
const predictedRelationship = store.state.relationships[id] || { id }
|
||||||
predictedRelationship.muting = true
|
predictedRelationship.muting = true
|
||||||
|
@ -317,6 +322,9 @@ const users = {
|
||||||
unblockUser (store, id) {
|
unblockUser (store, id) {
|
||||||
return unblockUser(store, id)
|
return unblockUser(store, id)
|
||||||
},
|
},
|
||||||
|
removeUserFromFollowers (store, id) {
|
||||||
|
return removeUserFromFollowers(store, id)
|
||||||
|
},
|
||||||
blockUsers (store, ids = []) {
|
blockUsers (store, ids = []) {
|
||||||
return Promise.all(ids.map(id => blockUser(store, id)))
|
return Promise.all(ids.map(id => blockUser(store, id)))
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,6 +68,7 @@ const MASTODON_BLOCK_USER_URL = id => `/api/v1/accounts/${id}/block`
|
||||||
const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
|
const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
|
||||||
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
|
||||||
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
|
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
|
||||||
|
const MASTODON_REMOVE_USER_FROM_FOLLOWERS = id => `/api/v1/accounts/${id}/remove_from_followers`
|
||||||
const MASTODON_SUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/subscribe`
|
const MASTODON_SUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/subscribe`
|
||||||
const MASTODON_UNSUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/unsubscribe`
|
const MASTODON_UNSUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/unsubscribe`
|
||||||
const MASTODON_SET_NOTE_URL = id => `/api/v1/accounts/${id}/note`
|
const MASTODON_SET_NOTE_URL = id => `/api/v1/accounts/${id}/note`
|
||||||
|
@ -305,6 +306,13 @@ const unblockUser = ({ id, credentials }) => {
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeUserFromFollowers = ({ id, credentials }) => {
|
||||||
|
return fetch(MASTODON_REMOVE_USER_FROM_FOLLOWERS(id), {
|
||||||
|
headers: authHeaders(credentials),
|
||||||
|
method: 'POST'
|
||||||
|
}).then((data) => data.json())
|
||||||
|
}
|
||||||
|
|
||||||
const approveUser = ({ id, credentials }) => {
|
const approveUser = ({ id, credentials }) => {
|
||||||
let url = MASTODON_APPROVE_USER_URL(id)
|
let url = MASTODON_APPROVE_USER_URL(id)
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
|
@ -1625,6 +1633,7 @@ const apiService = {
|
||||||
unmuteConversation,
|
unmuteConversation,
|
||||||
blockUser,
|
blockUser,
|
||||||
unblockUser,
|
unblockUser,
|
||||||
|
removeUserFromFollowers,
|
||||||
fetchUser,
|
fetchUser,
|
||||||
fetchUserRelationship,
|
fetchUserRelationship,
|
||||||
favorite,
|
favorite,
|
||||||
|
|
Loading…
Reference in a new issue