add biting support for users and notes
This commit is contained in:
parent
0e25b94186
commit
bb3cc22732
8 changed files with 61 additions and 2 deletions
|
@ -9,7 +9,8 @@ import {
|
||||||
faShareAlt,
|
faShareAlt,
|
||||||
faExternalLinkAlt,
|
faExternalLinkAlt,
|
||||||
faHistory,
|
faHistory,
|
||||||
faFilePen
|
faFilePen,
|
||||||
|
faTooth
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import {
|
import {
|
||||||
faBookmark as faBookmarkReg,
|
faBookmark as faBookmarkReg,
|
||||||
|
@ -27,7 +28,8 @@ library.add(
|
||||||
faExternalLinkAlt,
|
faExternalLinkAlt,
|
||||||
faFlag,
|
faFlag,
|
||||||
faHistory,
|
faHistory,
|
||||||
faFilePen
|
faFilePen,
|
||||||
|
faTooth
|
||||||
)
|
)
|
||||||
|
|
||||||
const ExtraButtons = {
|
const ExtraButtons = {
|
||||||
|
@ -163,6 +165,9 @@ const ExtraButtons = {
|
||||||
},
|
},
|
||||||
hideRedraftStatusConfirmDialog () {
|
hideRedraftStatusConfirmDialog () {
|
||||||
this.showingRedraftDialog = false
|
this.showingRedraftDialog = false
|
||||||
|
},
|
||||||
|
biteNote () {
|
||||||
|
this.$store.dispatch('biteNote', this.status.id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -9,6 +9,17 @@
|
||||||
>
|
>
|
||||||
<template #content="{close}">
|
<template #content="{close}">
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
|
<button
|
||||||
|
v-if="!ownStatus"
|
||||||
|
class="button-default dropdown-item dropdown-item-icon"
|
||||||
|
@click.prevent="biteNote"
|
||||||
|
@click="close"
|
||||||
|
>
|
||||||
|
<FAIcon
|
||||||
|
fixed-width
|
||||||
|
icon="tooth"
|
||||||
|
/><span>{{ $t("status.bite_note") }}</span>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="canMute && !status.thread_muted"
|
v-if="canMute && !status.thread_muted"
|
||||||
class="button-default dropdown-item dropdown-item-icon"
|
class="button-default dropdown-item dropdown-item-icon"
|
||||||
|
|
|
@ -193,6 +193,9 @@ export default {
|
||||||
},
|
},
|
||||||
mentionUser () {
|
mentionUser () {
|
||||||
this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user })
|
this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user })
|
||||||
|
},
|
||||||
|
biteUser () {
|
||||||
|
return this.$store.dispatch('biteUser', this.user.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,15 @@
|
||||||
{{ $t('user_card.mention') }}
|
{{ $t('user_card.mention') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="btn button-default btn-block"
|
||||||
|
:disabled="user.deactivated || relationship.blocked_by"
|
||||||
|
@click="biteUser"
|
||||||
|
>
|
||||||
|
{{ $t('user_card.bite') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<ModerationTools
|
<ModerationTools
|
||||||
v-if="loggedIn.role === 'admin'"
|
v-if="loggedIn.role === 'admin'"
|
||||||
:user="user"
|
:user="user"
|
||||||
|
|
|
@ -961,6 +961,7 @@
|
||||||
"ancestor_follow": "See {numReplies} other reply under this post | See {numReplies} other replies under this post",
|
"ancestor_follow": "See {numReplies} other reply under this post | See {numReplies} other replies under this post",
|
||||||
"ancestor_follow_with_icon": "{icon} {text}",
|
"ancestor_follow_with_icon": "{icon} {text}",
|
||||||
"attachment_stop_flash": "Stop Flash player",
|
"attachment_stop_flash": "Stop Flash player",
|
||||||
|
"bite_note": "Bite",
|
||||||
"bookmark": "Bookmark",
|
"bookmark": "Bookmark",
|
||||||
"collapse_attachments": "Collapse attachments",
|
"collapse_attachments": "Collapse attachments",
|
||||||
"copy_link": "Copy link to post",
|
"copy_link": "Copy link to post",
|
||||||
|
@ -1124,6 +1125,7 @@
|
||||||
"approve_confirm_accept_button": "Yes, accept",
|
"approve_confirm_accept_button": "Yes, accept",
|
||||||
"approve_confirm_cancel_button": "No, cancel",
|
"approve_confirm_cancel_button": "No, cancel",
|
||||||
"approve_confirm_title": "Approve follow request",
|
"approve_confirm_title": "Approve follow request",
|
||||||
|
"bite": "Bite",
|
||||||
"block": "Block",
|
"block": "Block",
|
||||||
"block_confirm": "Are you sure you want to block {user}?",
|
"block_confirm": "Are you sure you want to block {user}?",
|
||||||
"block_confirm_accept_button": "Yes, block",
|
"block_confirm_accept_button": "Yes, block",
|
||||||
|
|
|
@ -776,6 +776,9 @@ const statuses = {
|
||||||
},
|
},
|
||||||
setVirtualHeight ({ commit }, { statusId, height }) {
|
setVirtualHeight ({ commit }, { statusId, height }) {
|
||||||
commit('setVirtualHeight', { statusId, height })
|
commit('setVirtualHeight', { statusId, height })
|
||||||
|
},
|
||||||
|
biteNote (store, id) {
|
||||||
|
return store.rootState.api.backendInteractor.biteNote({ id })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations
|
mutations
|
||||||
|
|
|
@ -54,6 +54,10 @@ const unblockUser = (store, id) => {
|
||||||
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const biteUser = (store, id) => {
|
||||||
|
return store.rootState.api.backendInteractor.biteUser({ id })
|
||||||
|
}
|
||||||
|
|
||||||
const removeUserFromFollowers = (store, id) => {
|
const removeUserFromFollowers = (store, id) => {
|
||||||
return store.rootState.api.backendInteractor.removeUserFromFollowers({ id })
|
return store.rootState.api.backendInteractor.removeUserFromFollowers({ id })
|
||||||
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
.then((relationship) => store.commit('updateUserRelationship', [relationship]))
|
||||||
|
@ -380,6 +384,9 @@ const users = {
|
||||||
unblockUsers (store, ids = []) {
|
unblockUsers (store, ids = []) {
|
||||||
return Promise.all(ids.map(id => unblockUser(store, id)))
|
return Promise.all(ids.map(id => unblockUser(store, id)))
|
||||||
},
|
},
|
||||||
|
biteUser (store, id) {
|
||||||
|
return biteUser(store, id)
|
||||||
|
},
|
||||||
fetchMutes (store, args) {
|
fetchMutes (store, args) {
|
||||||
const { reset } = args || {}
|
const { reset } = args || {}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ 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_BITE_USER_URL = id => `/api/v1/users/${id}/bite`
|
||||||
|
const MASTODON_BITE_NOTE_URL = id => `/api/v1/statuses/${id}/bite`
|
||||||
const MASTODON_REMOVE_USER_FROM_FOLLOWERS = id => `/api/v1/accounts/${id}/remove_from_followers`
|
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`
|
||||||
|
@ -314,6 +316,21 @@ const unblockUser = ({ id, credentials }) => {
|
||||||
}).then((data) => data.json())
|
}).then((data) => data.json())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const biteUser = ({ id, credentials }) => {
|
||||||
|
return fetch(MASTODON_BITE_USER_URL(id), {
|
||||||
|
headers: authHeaders(credentials),
|
||||||
|
method: 'POST'
|
||||||
|
}).then((data) => data.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
const biteNote = ({ id, credentials }) => {
|
||||||
|
return fetch(MASTODON_BITE_NOTE_URL(id), {
|
||||||
|
headers: authHeaders(credentials),
|
||||||
|
method: 'POST'
|
||||||
|
}).then((data) => data.json())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const removeUserFromFollowers = ({ id, credentials }) => {
|
const removeUserFromFollowers = ({ id, credentials }) => {
|
||||||
return fetch(MASTODON_REMOVE_USER_FROM_FOLLOWERS(id), {
|
return fetch(MASTODON_REMOVE_USER_FROM_FOLLOWERS(id), {
|
||||||
headers: authHeaders(credentials),
|
headers: authHeaders(credentials),
|
||||||
|
@ -1760,6 +1777,8 @@ const apiService = {
|
||||||
unmuteConversation,
|
unmuteConversation,
|
||||||
blockUser,
|
blockUser,
|
||||||
unblockUser,
|
unblockUser,
|
||||||
|
biteUser,
|
||||||
|
biteNote,
|
||||||
removeUserFromFollowers,
|
removeUserFromFollowers,
|
||||||
fetchUser,
|
fetchUser,
|
||||||
fetchUserRelationship,
|
fetchUserRelationship,
|
||||||
|
|
Loading…
Add table
Reference in a new issue