diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 138a5b51..903785a9 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -203,6 +203,9 @@ const EmojiInput = { const pickerInput = pickerEl.querySelector('input') if (pickerInput) pickerInput.focus() }, + triggerShowContentWarning () { + this.triggerShowContentWarning() + }, triggerShowPicker () { this.showPicker = true this.$nextTick(() => { diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index f7fef499..7f496db4 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -100,6 +100,7 @@ const PostStatusForm = { 'isRedraft' ], emits: [ + 'contentWarningFieldVisible', 'posted', 'resize', 'mediaplay', @@ -198,6 +199,7 @@ const PostStatusForm = { } return { + showingContentWarning: false, dropFiles: [], uploadingFiles: false, error: null, @@ -244,6 +246,9 @@ const PostStatusForm = { customEmoji () { return this.$store.state.instance.customEmoji || [] }, + contentWarningFieldVisible () { + return this.$store.state.instance.showingContentWarning + }, statusLength () { return this.newStatus.status.length }, @@ -345,6 +350,12 @@ const PostStatusForm = { if (this.preview) this.previewStatus() }, async postStatus (event, newStatus, opts = {}) { + + // If the Content warning Field is not visible, then do not post a content warning + if (this.showingContentWarning === false) { + this.newStatus.spoilerText = '' + } + if (this.posting && !this.optimisticPosting) { return } if (this.disableSubmit) { return } if (this.emojiInputShown) { return } @@ -675,7 +686,15 @@ const PostStatusForm = { this.$refs['textarea'].focus() this.$refs['emoji-input'].triggerShowPicker() }, - clearError () { + showContentWarningField() { + if (this.showingContentWarning === true) { + console.log(this.showingContentWarning) + this.$refs['contentWarningField'].focus() + } + console.log('button clicked') + this.showingContentWarning = !this.showingContentWarning + }, + clearError () { this.error = null }, changeVis (visibility) { diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 02468f17..b848f4ac 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -117,14 +117,19 @@ class="preview-status" /> + + + + + + + +