2022-02-10 05:49:39 +09:00
|
|
|
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
|
2020-10-20 01:38:49 +09:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
2022-01-16 15:01:19 +09:00
|
|
|
import {
|
|
|
|
faRetweet,
|
|
|
|
faPlus,
|
|
|
|
faMinus,
|
|
|
|
faCheck
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
2020-10-20 01:38:49 +09:00
|
|
|
|
2022-01-16 15:01:19 +09:00
|
|
|
library.add(
|
|
|
|
faRetweet,
|
|
|
|
faPlus,
|
|
|
|
faMinus,
|
|
|
|
faCheck
|
|
|
|
)
|
2019-09-30 04:33:15 +09:00
|
|
|
|
2016-11-14 00:42:56 +09:00
|
|
|
const RetweetButton = {
|
2018-08-10 01:46:18 +09:00
|
|
|
props: ['status', 'loggedIn', 'visibility'],
|
2022-02-10 05:49:39 +09:00
|
|
|
components: {
|
|
|
|
ConfirmModal
|
|
|
|
},
|
2017-03-09 13:45:40 +09:00
|
|
|
data () {
|
|
|
|
return {
|
2022-02-10 05:49:39 +09:00
|
|
|
animated: false,
|
|
|
|
showingConfirmDialog: false
|
2017-03-09 13:45:40 +09:00
|
|
|
}
|
|
|
|
},
|
2016-11-14 00:42:56 +09:00
|
|
|
methods: {
|
|
|
|
retweet () {
|
2022-02-10 05:49:39 +09:00
|
|
|
if (!this.status.repeated && this.shouldConfirmRepeat) {
|
|
|
|
this.showConfirmDialog()
|
|
|
|
} else {
|
|
|
|
this.doRetweet()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
doRetweet () {
|
2016-11-14 01:09:16 +09:00
|
|
|
if (!this.status.repeated) {
|
2019-07-05 16:02:14 +09:00
|
|
|
this.$store.dispatch('retweet', { id: this.status.id })
|
2018-06-14 18:00:11 +09:00
|
|
|
} else {
|
2019-07-05 16:02:14 +09:00
|
|
|
this.$store.dispatch('unretweet', { id: this.status.id })
|
2016-11-14 01:09:16 +09:00
|
|
|
}
|
2017-03-09 13:45:40 +09:00
|
|
|
this.animated = true
|
|
|
|
setTimeout(() => {
|
|
|
|
this.animated = false
|
|
|
|
}, 500)
|
2022-02-10 05:49:39 +09:00
|
|
|
this.hideConfirmDialog()
|
|
|
|
},
|
|
|
|
showConfirmDialog () {
|
|
|
|
this.showingConfirmDialog = true
|
|
|
|
},
|
|
|
|
hideConfirmDialog () {
|
|
|
|
this.showingConfirmDialog = false
|
2016-11-14 00:42:56 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2020-09-29 19:18:37 +09:00
|
|
|
mergedConfig () {
|
|
|
|
return this.$store.getters.mergedConfig
|
2021-12-29 08:30:34 +09:00
|
|
|
},
|
|
|
|
remoteInteractionLink () {
|
|
|
|
return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
|
2022-02-10 05:49:39 +09:00
|
|
|
},
|
|
|
|
shouldConfirmRepeat () {
|
|
|
|
return this.mergedConfig.modalOnRepeat
|
2020-09-29 19:18:37 +09:00
|
|
|
}
|
2016-11-14 00:42:56 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default RetweetButton
|