forked from AkkomaGang/akkoma-fe
Add a checkbox for marking a post's attachments as NSFW
This commit is contained in:
parent
30a6b7be5b
commit
a7811e7bd9
5 changed files with 13 additions and 3 deletions
src
components/post_status_form
i18n
services
|
@ -53,6 +53,7 @@ const PostStatusForm = {
|
|||
highlighted: 0,
|
||||
newStatus: {
|
||||
status: statusText,
|
||||
nsfw: false,
|
||||
files: [],
|
||||
visibility: this.messageScope || this.$store.state.users.currentUser.default_scope
|
||||
},
|
||||
|
@ -204,6 +205,7 @@ const PostStatusForm = {
|
|||
status: newStatus.status,
|
||||
spoilerText: newStatus.spoilerText || null,
|
||||
visibility: newStatus.visibility,
|
||||
sensitive: newStatus.nsfw,
|
||||
media: newStatus.files,
|
||||
store: this.$store,
|
||||
inReplyToStatusId: this.replyTo
|
||||
|
|
|
@ -75,6 +75,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload_settings" v-if="newStatus.files.length > 0">
|
||||
<input type="checkbox" id="filesSensitive" v-model="newStatus.nsfw">
|
||||
<label for="filesSensitive" v-if="newStatus.nsfw">{{$t('post_status.attachments_sensitive')}}</label>
|
||||
<label for="filesSensitive" v-else v-html="$t('post_status.attachments_not_sensitive')"></label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -384,6 +384,8 @@ const en = {
|
|||
account_not_locked_warning: 'Your account is not {0}. Anyone can follow you to view your follower-only posts.',
|
||||
account_not_locked_warning_link: 'locked',
|
||||
direct_warning: 'This post will only be visible to all the mentioned users.',
|
||||
attachments_sensitive: 'Attachments marked sensitive',
|
||||
attachments_not_sensitive: 'Attachments <strong>not</strong> marked sensitive',
|
||||
scope: {
|
||||
public: 'Public - Post to public timelines',
|
||||
unlisted: 'Unlisted - Do not post to public timelines',
|
||||
|
|
|
@ -373,7 +373,7 @@ const unretweet = ({ id, credentials }) => {
|
|||
})
|
||||
}
|
||||
|
||||
const postStatus = ({credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId}) => {
|
||||
const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId}) => {
|
||||
const idsText = mediaIds.join(',')
|
||||
const form = new FormData()
|
||||
|
||||
|
@ -381,6 +381,7 @@ const postStatus = ({credentials, status, spoilerText, visibility, mediaIds, inR
|
|||
form.append('source', 'Pleroma FE')
|
||||
if (spoilerText) form.append('spoiler_text', spoilerText)
|
||||
if (visibility) form.append('visibility', visibility)
|
||||
if (sensitive) form.append('sensitive', sensitive)
|
||||
form.append('media_ids', idsText)
|
||||
if (inReplyToStatusId) {
|
||||
form.append('in_reply_to_status_id', inReplyToStatusId)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { map } from 'lodash'
|
||||
import apiService from '../api/api.service.js'
|
||||
|
||||
const postStatus = ({ store, status, spoilerText, visibility, media = [], inReplyToStatusId = undefined }) => {
|
||||
const postStatus = ({ store, status, spoilerText, visibility, sensitive, media = [], inReplyToStatusId = undefined }) => {
|
||||
const mediaIds = map(media, 'id')
|
||||
|
||||
return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, mediaIds, inReplyToStatusId})
|
||||
return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId})
|
||||
.then((data) => data.json())
|
||||
.then((data) => {
|
||||
if (!data.error) {
|
||||
|
|
Loading…
Reference in a new issue