Norm
aedd0794a4
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
From: https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1419
This is the frontend side of AkkomaGang/akkoma#198 (merged in a6d85003fe
).
Co-authored-by: Tusooa Zhu <tusooa@kazv.moe>
Reviewed-on: AkkomaGang/pleroma-fe#168
Co-authored-by: Norm <normandy@biribiri.dev>
Co-committed-by: Norm <normandy@biribiri.dev>
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
import { faRetweet } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
library.add(faRetweet)
|
|
|
|
const RetweetButton = {
|
|
props: ['status', 'loggedIn', 'visibility'],
|
|
components: {
|
|
ConfirmModal
|
|
},
|
|
data () {
|
|
return {
|
|
animated: false,
|
|
showingConfirmDialog: false
|
|
}
|
|
},
|
|
methods: {
|
|
retweet () {
|
|
if (!this.status.repeated && this.shouldConfirmRepeat) {
|
|
this.showConfirmDialog()
|
|
} else {
|
|
this.doRetweet()
|
|
}
|
|
},
|
|
doRetweet () {
|
|
if (!this.status.repeated) {
|
|
this.$store.dispatch('retweet', { id: this.status.id })
|
|
} else {
|
|
this.$store.dispatch('unretweet', { id: this.status.id })
|
|
}
|
|
this.animated = true
|
|
setTimeout(() => {
|
|
this.animated = false
|
|
}, 500)
|
|
this.hideConfirmDialog()
|
|
},
|
|
showConfirmDialog () {
|
|
this.showingConfirmDialog = true
|
|
},
|
|
hideConfirmDialog () {
|
|
this.showingConfirmDialog = false
|
|
}
|
|
},
|
|
computed: {
|
|
isOwn () {
|
|
return this.status.user.id === this.$store.state.users.currentUser.id
|
|
},
|
|
mergedConfig () {
|
|
return this.$store.getters.mergedConfig
|
|
},
|
|
shouldConfirmRepeat () {
|
|
return this.mergedConfig.modalOnRepeat
|
|
},
|
|
remoteInteractionLink () {
|
|
return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
|
|
}
|
|
}
|
|
}
|
|
|
|
export default RetweetButton
|