2016-11-13 07:42:56 -08:00
|
|
|
const RetweetButton = {
|
2018-08-09 09:46:18 -07:00
|
|
|
props: ['status', 'loggedIn', 'visibility'],
|
2017-03-08 20:45:40 -08:00
|
|
|
data () {
|
|
|
|
return {
|
2018-10-16 06:15:04 -07:00
|
|
|
hidePostStatsLocal: typeof this.$store.state.config.hidePostStats === 'undefined'
|
2018-10-16 06:09:29 -07:00
|
|
|
? this.$store.state.instance.hidePostStats
|
|
|
|
: this.$store.state.config.hidePostStats,
|
2017-03-08 20:45:40 -08:00
|
|
|
animated: false
|
|
|
|
}
|
|
|
|
},
|
2016-11-13 07:42:56 -08:00
|
|
|
methods: {
|
|
|
|
retweet () {
|
2016-11-13 08:09:16 -08:00
|
|
|
if (!this.status.repeated) {
|
2019-07-05 00:02:14 -07:00
|
|
|
this.$store.dispatch('retweet', { id: this.status.id })
|
2018-06-14 02:00:11 -07:00
|
|
|
} else {
|
2019-07-05 00:02:14 -07:00
|
|
|
this.$store.dispatch('unretweet', { id: this.status.id })
|
2016-11-13 08:09:16 -08:00
|
|
|
}
|
2017-03-08 20:45:40 -08:00
|
|
|
this.animated = true
|
|
|
|
setTimeout(() => {
|
|
|
|
this.animated = false
|
|
|
|
}, 500)
|
2016-11-13 07:42:56 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
classes () {
|
|
|
|
return {
|
2017-03-08 20:45:40 -08:00
|
|
|
'retweeted': this.status.repeated,
|
2018-06-14 14:17:36 -07:00
|
|
|
'retweeted-empty': !this.status.repeated,
|
2017-03-08 20:45:40 -08:00
|
|
|
'animate-spin': this.animated
|
2016-11-13 07:42:56 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default RetweetButton
|