132 lines
4.7 KiB
Diff
132 lines
4.7 KiB
Diff
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 }}
|
|
</span>
|
|
+ <teleport to="#modal">
|
|
+ <confirm-modal
|
|
+ v-if="showingConfirmDialog"
|
|
+ :title="$t('status.favorite_confirm_title')"
|
|
+ :confirm-text="$t('status.favorite_confirm_accept_button')"
|
|
+ :cancel-text="$t('status.favorite_confirm_cancel_button')"
|
|
+ @accepted="doFavorite"
|
|
+ @cancelled="hideConfirmDialog"
|
|
+ >
|
|
+ {{ $t('status.favorite_confirm') }}
|
|
+ </confirm-modal>
|
|
+ </teleport>
|
|
</div>
|
|
</template>
|
|
|
|
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
|
|
index 64950f8a..b09c6d9f 100644
|
|
--- a/src/components/settings_modal/tabs/general_tab.vue
|
|
+++ b/src/components/settings_modal/tabs/general_tab.vue
|
|
@@ -282,6 +282,11 @@
|
|
{{ $t('settings.confirm_dialogs_repeat') }}
|
|
</BooleanSetting>
|
|
</li>
|
|
+ <li>
|
|
+ <BooleanSetting path="modalOnFavorite">
|
|
+ {{ $t('settings.confirm_dialogs_favorite') }}
|
|
+ </BooleanSetting>
|
|
+ </li>
|
|
<li>
|
|
<BooleanSetting path="modalOnUnfollow">
|
|
{{ $t('settings.confirm_dialogs_unfollow') }}
|
|
diff --git a/src/i18n/en.json b/src/i18n/en.json
|
|
index 965cddb0..ed140e5a 100644
|
|
--- a/src/i18n/en.json
|
|
+++ b/src/i18n/en.json
|
|
@@ -510,6 +510,7 @@
|
|
"confirm_dialogs_deny_follow": "Rejecting a follow request",
|
|
"confirm_dialogs_mute": "Muting someone",
|
|
"confirm_dialogs_repeat": "Repeating a post",
|
|
+ "confirm_dialogs_favorite": "Favoriting a post",
|
|
"confirm_dialogs_unfollow": "Unfollowing someone",
|
|
"confirm_new_password": "Confirm new password",
|
|
"confirmation_dialogs": "Confirmation options",
|
|
@@ -975,6 +976,10 @@
|
|
"expand": "Expand",
|
|
"external_source": "External source",
|
|
"favorites": "Favorites",
|
|
+ "favorite_confirm": "Do you really want to favorite this post?",
|
|
+ "favorite_confirm_accept_button": "Yes, favorite it",
|
|
+ "favorite_confirm_cancel_button": "No, don't favorite",
|
|
+ "favorite_confirm_title": "Confirm favorite",
|
|
"hide_attachment": "Hide attachment",
|
|
"hide_content": "Hide content",
|
|
"hide_full_subject": "Hide full content warning",
|
|
diff --git a/src/modules/config.js b/src/modules/config.js
|
|
index 551b5bb6..0e78c749 100644
|
|
--- a/src/modules/config.js
|
|
+++ b/src/modules/config.js
|
|
@@ -83,6 +83,7 @@ export const defaultState = {
|
|
// This hides statuses filtered via a word filter
|
|
hideFilteredStatuses: undefined, // instance default
|
|
modalOnRepeat: undefined, // instance default
|
|
+ modalOnFavorite: undefined, // instance default
|
|
modalOnUnfollow: undefined, // instance default
|
|
modalOnBlock: undefined, // instance default
|
|
modalOnMute: undefined, // instance default
|