commit: 8c7f765dff8b66ff27aeeab5bc09cd715ab328a9
parent: ac28e8c2f981b6584f0103e10b0a5f5b025fcaae
Author: Shpuld Shpludson <shp@cock.li>
Date: Thu, 4 Apr 2019 19:38:03 +0000
Merge branch 'issue-469-safe-dm-from-BE' into 'develop'
Issue 469 safe dm from be
Closes #469
See merge request pleroma/pleroma-fe!726
Diffstat:
5 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
@@ -9,12 +9,13 @@ const getStatusnetConfig = async ({ store }) => {
const res = await window.fetch('/api/statusnet/config.json')
if (res.ok) {
const data = await res.json()
- const { name, closed: registrationClosed, textlimit, uploadlimit, server, vapidPublicKey } = data.site
+ const { name, closed: registrationClosed, textlimit, uploadlimit, server, vapidPublicKey, safeDMMentionsEnabled } = data.site
store.dispatch('setInstanceOption', { name: 'name', value: name })
store.dispatch('setInstanceOption', { name: 'registrationOpen', value: (registrationClosed === '0') })
store.dispatch('setInstanceOption', { name: 'textlimit', value: parseInt(textlimit) })
store.dispatch('setInstanceOption', { name: 'server', value: server })
+ store.dispatch('setInstanceOption', { name: 'safeDM', value: safeDMMentionsEnabled !== '0' })
// TODO: default values for this stuff, added if to not make it break on
// my dev config out of the box.
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
@@ -179,6 +179,9 @@ const PostStatusForm = {
},
postFormats () {
return this.$store.state.instance.postFormats || []
+ },
+ safeDMEnabled () {
+ return this.$store.state.instance.safeDM
}
},
methods: {
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
@@ -3,13 +3,16 @@
<form @submit.prevent="postStatus(newStatus)">
<div class="form-group" >
<i18n
- v-if="!this.$store.state.users.currentUser.locked && this.newStatus.visibility == 'private'"
+ v-if="!$store.state.users.currentUser.locked && newStatus.visibility == 'private'"
path="post_status.account_not_locked_warning"
tag="p"
class="visibility-notice">
<router-link :to="{ name: 'user-settings' }">{{ $t('post_status.account_not_locked_warning_link') }}</router-link>
</i18n>
- <p v-if="this.newStatus.visibility == 'direct'" class="visibility-notice">{{ $t('post_status.direct_warning') }}</p>
+ <p v-if="newStatus.visibility === 'direct'" class="visibility-notice">
+ <span v-if="safeDMEnabled">{{ $t('post_status.direct_warning_to_first_only') }}</span>
+ <span v-else>{{ $t('post_status.direct_warning_to_all') }}</span>
+ </p>
<EmojiInput
v-if="newStatus.spoilerText || alwaysShowSubject"
type="text"
diff --git a/src/i18n/en.json b/src/i18n/en.json
@@ -80,7 +80,8 @@
},
"content_warning": "Subject (optional)",
"default": "Just landed in L.A.",
- "direct_warning": "This post will only be visible to all the mentioned users.",
+ "direct_warning_to_all": "This post will be visible to all the mentioned users.",
+ "direct_warning_to_first_only": "This post will only be visible to the mentioned users at the beginning of the message.",
"posting": "Posting",
"scope": {
"direct": "Direct - Post to mentioned users only",
diff --git a/src/modules/instance.js b/src/modules/instance.js
@@ -5,6 +5,7 @@ const defaultState = {
// Stuff from static/config.json and apiConfig
name: 'Pleroma FE',
registrationOpen: true,
+ safeDM: true,
textlimit: 5000,
server: 'http://localhost:4040/',
theme: 'pleroma-dark',