Add support selectable visibility of repeat
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
This commit is contained in:
parent
8afbe5e3bc
commit
4313b386f0
4 changed files with 20 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
||||
import ScopeSelector from '../scope_selector/scope_selector.vue'
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { faRetweet } from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
|
@ -7,12 +8,14 @@ library.add(faRetweet)
|
|||
const RetweetButton = {
|
||||
props: ['status', 'loggedIn', 'visibility'],
|
||||
components: {
|
||||
ConfirmModal
|
||||
ConfirmModal,
|
||||
ScopeSelector
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
animated: false,
|
||||
showingConfirmDialog: false
|
||||
showingConfirmDialog: false,
|
||||
retweetVisibility: this.$store.state.users.currentUser.default_scope
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -25,7 +28,7 @@ const RetweetButton = {
|
|||
},
|
||||
doRetweet () {
|
||||
if (!this.status.repeated) {
|
||||
this.$store.dispatch('retweet', { id: this.status.id })
|
||||
this.$store.dispatch('retweet', { id: this.status.id, visibility: this.retweetVisibility })
|
||||
} else {
|
||||
this.$store.dispatch('unretweet', { id: this.status.id })
|
||||
}
|
||||
|
@ -40,6 +43,9 @@ const RetweetButton = {
|
|||
},
|
||||
hideConfirmDialog () {
|
||||
this.showingConfirmDialog = false
|
||||
},
|
||||
changeVis (visibility) {
|
||||
this.retweetVisibility = visibility
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -54,6 +60,9 @@ const RetweetButton = {
|
|||
},
|
||||
remoteInteractionLink () {
|
||||
return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
|
||||
},
|
||||
userDefaultScope () {
|
||||
return this.$store.state.users.currentUser.default_scope
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
@cancelled="hideConfirmDialog"
|
||||
>
|
||||
{{ $t('status.repeat_confirm') }}
|
||||
<scope-selector
|
||||
:user-default="userDefaultScope"
|
||||
:initial-scope="userDefaultScope"
|
||||
:on-scope-change="changeVis"
|
||||
/>
|
||||
</confirm-modal>
|
||||
</teleport>
|
||||
</div>
|
||||
|
|
|
@ -666,7 +666,7 @@ const statuses = {
|
|||
retweet ({ rootState, commit }, status) {
|
||||
// Optimistic retweeting...
|
||||
commit('setRetweeted', { status, value: true })
|
||||
rootState.api.backendInteractor.retweet({ id: status.id })
|
||||
rootState.api.backendInteractor.retweet({ id: status.id, visibility: status.visibility })
|
||||
.then(status => commit('setRetweetedConfirm', { status: status.retweeted_status, user: rootState.users.currentUser }))
|
||||
},
|
||||
unretweet ({ rootState, commit }, status) {
|
||||
|
|
|
@ -822,8 +822,8 @@ const unfavorite = ({ id, credentials }) => {
|
|||
.then((data) => parseStatus(data))
|
||||
}
|
||||
|
||||
const retweet = ({ id, credentials }) => {
|
||||
return promisedRequest({ url: MASTODON_RETWEET_URL(id), method: 'POST', credentials })
|
||||
const retweet = ({ id, visibility, credentials }) => {
|
||||
return promisedRequest({ url: MASTODON_RETWEET_URL(id), method: 'POST', payload: { visibility }, credentials })
|
||||
.then((data) => parseStatus(data))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue