commit: 9e111f14fd088d4281b8ac6067313c63df924f84
parent: 30a6b7be5bf53611bb65cbabd18ad003989df8e3
Author: kaniini <nenolod@gmail.com>
Date: Sat, 25 Aug 2018 22:25:04 +0000
Merge branch 'nsfw-attachment-marking' into 'develop'
Add a checkbox for marking a post's attachments as NSFW
See merge request pleroma/pleroma-fe!317
Diffstat:
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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) {