diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js
index d15699f7..cca8a479 100644
--- a/src/components/favorite_button/favorite_button.js
+++ b/src/components/favorite_button/favorite_button.js
@@ -1,4 +1,5 @@
import { mapGetters } from 'vuex'
+import ConfirmModal from '../confirm_modal/confirm_modal.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faStar } from '@fortawesome/free-solid-svg-icons'
import {
@@ -12,13 +13,24 @@ library.add(
const FavoriteButton = {
props: ['status', 'loggedIn'],
+ components: {
+ ConfirmModal
+ },
data () {
return {
- animated: false
+ animated: false,
+ showingConfirmDialog: false
}
},
methods: {
favorite () {
+ if (!this.status.repeated && this.shouldConfirmFavorite) {
+ this.showConfirmDialog()
+ } else {
+ this.doFavorite()
+ }
+ },
+ doFavorite () {
if (!this.status.favorited) {
this.$store.dispatch('favorite', { id: this.status.id })
} else {
@@ -28,12 +40,21 @@ const FavoriteButton = {
setTimeout(() => {
this.animated = false
}, 500)
+ },
+ showConfirmDialog () {
+ this.showingConfirmDialog = true
+ },
+ hideConfirmDialog () {
+ this.showingConfirmDialog = false
}
},
computed: {
...mapGetters(['mergedConfig']),
remoteInteractionLink () {
return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
+ },
+ shouldConfirmRepeat () {
+ return this.mergedConfig.modalOnRepeat
}
}
}
diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue
index 16bf441e..06ed7d59 100644
--- a/src/components/favorite_button/favorite_button.vue
+++ b/src/components/favorite_button/favorite_button.vue
@@ -32,6 +32,18 @@
>
{{ status.fave_num }}
+