diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 6eee23ce..7cf65211 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -14,6 +14,7 @@ import suggestor from '../emoji_input/suggestor.js'
import { mapGetters, mapState } from 'vuex'
import Checkbox from '../checkbox/checkbox.vue'
import Select from '../select/select.vue'
+import ConfirmModal from '../confirm_modal/confirm_modal.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
@@ -35,6 +36,10 @@ library.add(
faCircleNotch
)
+var finEvent
+var finNewStatus
+var finOpts
+
const buildMentionsString = ({ user, attentions = [] }, currentUser) => {
let allAttentions = [...attentions]
@@ -122,7 +127,8 @@ const PostStatusForm = {
Select,
Attachment,
StatusContent,
- Gallery
+ Gallery,
+ ConfirmModal
},
mounted () {
this.updateIdempotencyKey()
@@ -236,7 +242,8 @@ const PostStatusForm = {
idempotencyKey: '',
activeEmojiInput: undefined,
activeTextInput: undefined,
- subjectVisible: showSubject
+ subjectVisible: showSubject,
+ showingPostConfirmDialog: false
}
},
computed: {
@@ -770,6 +777,32 @@ const PostStatusForm = {
}
}
return this.$store.state.users.currentUser.default_scope
+ },
+ hideDenyConfirmDialog () {
+ this.showingPostConfirmDialog = false
+
+ finEvent = null
+ finNewStatus = null
+ finOpts = null
+ },
+ doPostYes () {
+ this.showingPostConfirmDialog = false
+ this.postStatus(finEvent, finNewStatus, finOpts)
+ },
+ handlePost (event, newStatus, opts = {}) {
+ if (this.mergedConfig.modalOnPubPost) {
+ if (newStatus.visibility === "public" || newStatus.visibility === "unlisted" || newStatus.visibility === "local") {
+ finEvent = event
+ finNewStatus = newStatus
+ finOpts = opts
+
+ this.showingPostConfirmDialog = true
+ } else {
+ this.postStatus(event, newStatus, opts = {})
+ }
+ } else {
+ this.postStatus(event, newStatus, opts = {})
+ }
}
}
}
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 79049f05..ebab96ab 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -171,9 +171,9 @@
:disabled="posting && !optimisticPosting"
class="form-post-body"
:class="{ 'scrollable-form': !!maxHeight, '-has-subject': subjectVisible }"
- @keydown.exact.enter="submitOnEnter && postStatus($event, newStatus)"
- @keydown.meta.enter="postStatus($event, newStatus)"
- @keydown.ctrl.enter="!submitOnEnter && postStatus($event, newStatus)"
+ @keydown.exact.enter="submitOnEnter && handlePost($event, newStatus)"
+ @keydown.meta.enter="handlePost($event, newStatus)"
+ @keydown.ctrl.enter="!submitOnEnter && handlePost($event, newStatus)"
@input="resize"
@compositionupdate="resize"
@paste="paste"
@@ -317,7 +317,7 @@
v-else
:disabled="uploadingFiles || disableSubmit"
class="btn button-default"
- @click.stop.prevent="postStatus($event, newStatus)"
+ @click.stop.prevent="handlePost($event, newStatus)"
>
{{ $t('post_status.post') }}
@@ -371,6 +371,18 @@
+