Removed "Always show Content Warning" option

This commit is contained in:
Soulfire Jarexi Backblaze 2023-03-22 08:14:54 -04:00
parent 85abc62213
commit cd5a09935e
No known key found for this signature in database
GPG key ID: DC549C721638D6A9
4 changed files with 42 additions and 10 deletions

View file

@ -203,6 +203,9 @@ const EmojiInput = {
const pickerInput = pickerEl.querySelector('input') const pickerInput = pickerEl.querySelector('input')
if (pickerInput) pickerInput.focus() if (pickerInput) pickerInput.focus()
}, },
triggerShowContentWarning () {
this.triggerShowContentWarning()
},
triggerShowPicker () { triggerShowPicker () {
this.showPicker = true this.showPicker = true
this.$nextTick(() => { this.$nextTick(() => {

View file

@ -100,6 +100,7 @@ const PostStatusForm = {
'isRedraft' 'isRedraft'
], ],
emits: [ emits: [
'contentWarningFieldVisible',
'posted', 'posted',
'resize', 'resize',
'mediaplay', 'mediaplay',
@ -198,6 +199,7 @@ const PostStatusForm = {
} }
return { return {
showingContentWarning: false,
dropFiles: [], dropFiles: [],
uploadingFiles: false, uploadingFiles: false,
error: null, error: null,
@ -244,6 +246,9 @@ const PostStatusForm = {
customEmoji () { customEmoji () {
return this.$store.state.instance.customEmoji || [] return this.$store.state.instance.customEmoji || []
}, },
contentWarningFieldVisible () {
return this.$store.state.instance.showingContentWarning
},
statusLength () { statusLength () {
return this.newStatus.status.length return this.newStatus.status.length
}, },
@ -345,6 +350,12 @@ const PostStatusForm = {
if (this.preview) this.previewStatus() if (this.preview) this.previewStatus()
}, },
async postStatus (event, newStatus, opts = {}) { 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.posting && !this.optimisticPosting) { return }
if (this.disableSubmit) { return } if (this.disableSubmit) { return }
if (this.emojiInputShown) { return } if (this.emojiInputShown) { return }
@ -675,6 +686,14 @@ const PostStatusForm = {
this.$refs['textarea'].focus() this.$refs['textarea'].focus()
this.$refs['emoji-input'].triggerShowPicker() this.$refs['emoji-input'].triggerShowPicker()
}, },
showContentWarningField() {
if (this.showingContentWarning === true) {
console.log(this.showingContentWarning)
this.$refs['contentWarningField'].focus()
}
console.log('button clicked')
this.showingContentWarning = !this.showingContentWarning
},
clearError () { clearError () {
this.error = null this.error = null
}, },

View file

@ -117,14 +117,19 @@
class="preview-status" class="preview-status"
/> />
</div> </div>
<!-- Content warning -->
<EmojiInput <EmojiInput
v-if="!disableSubject && (newStatus.spoilerText || alwaysShowSubject)" ref="contentWarning"
v-if="showingContentWarning && (newStatus.spoilerText || alwaysShowSubject)"
v-model="newStatus.spoilerText" v-model="newStatus.spoilerText"
enable-emoji-picker enable-emoji-picker
:suggest="emojiSuggestor" :suggest="emojiSuggestor"
class="form-control" class="form-control"
> >
<input <input
ref="contentWarningField"
v-if="showingContentWarning"
v-model="newStatus.spoilerText" v-model="newStatus.spoilerText"
type="text" type="text"
:placeholder="$t('post_status.content_warning')" :placeholder="$t('post_status.content_warning')"
@ -133,6 +138,8 @@
class="form-post-subject" class="form-post-subject"
@input="onSubjectInput" @input="onSubjectInput"
> >
<!-- Post Field -->
</EmojiInput> </EmojiInput>
<i18n-t <i18n-t
v-if="newStatus.files.length !== 0 && newStatus.nsfw === false && newStatus.spoilerText !== ''" v-if="newStatus.files.length !== 0 && newStatus.nsfw === false && newStatus.spoilerText !== ''"
@ -186,6 +193,8 @@
v-if="!disableScopeSelector" v-if="!disableScopeSelector"
class="visibility-tray" class="visibility-tray"
> >
<!-- Scope selector - Allows determining the privacy level of a post -->
<scope-selector <scope-selector
v-if="!disableVisibilitySelector" v-if="!disableVisibilitySelector"
:user-default="userDefaultScope" :user-default="userDefaultScope"
@ -260,6 +269,14 @@
@upload-failed="uploadFailed" @upload-failed="uploadFailed"
@all-uploaded="finishedUploadingFiles" @all-uploaded="finishedUploadingFiles"
/> />
<!-- Content Warning Button -->
<button
class="emoji-icon button-unstyled"
:title="$t('Add content warning')"
@click="showContentWarningField"
>
<FAIcon icon="eye" />
</button>
<button <button
class="emoji-icon button-unstyled" class="emoji-icon button-unstyled"
:title="$t('emoji.add_emoji')" :title="$t('emoji.add_emoji')"

View file

@ -562,14 +562,7 @@
{{ $t('settings.sensitive_if_subject') }} {{ $t('settings.sensitive_if_subject') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting
path="alwaysShowSubjectInput"
expert="1"
>
{{ $t('settings.subject_input_always_show') }}
</BooleanSetting>
</li>
<li> <li>
<ChoiceSetting <ChoiceSetting
id="subjectLineBehavior" id="subjectLineBehavior"