diff options
| author | scarlett <nia@netbsd.org> | 2018-08-25 22:18:43 +0100 |
|---|---|---|
| committer | scarlett <nia@netbsd.org> | 2018-08-25 22:18:43 +0100 |
| commit | a7811e7bd97cf7158971b88e8bccbf2f076676ee (patch) | |
| tree | 09927cfd3f5de6a074f586fb87c95ed423e685db /src | |
| parent | 30a6b7be5bf53611bb65cbabd18ad003989df8e3 (diff) | |
Add a checkbox for marking a post's attachments as NSFW
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/post_status_form/post_status_form.js | 2 | ||||
| -rw-r--r-- | src/components/post_status_form/post_status_form.vue | 5 | ||||
| -rw-r--r-- | src/i18n/messages.js | 2 | ||||
| -rw-r--r-- | src/services/api/api.service.js | 3 | ||||
| -rw-r--r-- | src/services/status_poster/status_poster.service.js | 4 |
5 files changed, 13 insertions, 3 deletions
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index ff3bb906..cbff7827 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -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 diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 2b84758b..9f8b2661 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -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> diff --git a/src/i18n/messages.js b/src/i18n/messages.js index a0b7f562..625ac1b6 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -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', diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 92013448..efea86cf 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -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) diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index 3381e9e2..c3bbbaa3 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -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) { |
