#469 - DM warning text should vary based on BE setting

This commit is contained in:
dave 2019-04-02 10:26:14 -04:00
parent ac28e8c2f9
commit c9a9b3122d
4 changed files with 8 additions and 2 deletions

View File

@ -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.

View File

@ -179,6 +179,10 @@ const PostStatusForm = {
},
postFormats () {
return this.$store.state.instance.postFormats || []
},
showDirectWarning () {
console.log(this.$store.state.instance)
return this.$store.state.instance.safeDM && this.newStatus.visibility === 'direct'
}
},
methods: {

View File

@ -9,7 +9,7 @@
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="showDirectWarning" class="visibility-notice">{{ $t('post_status.direct_warning') }}</p>
<EmojiInput
v-if="newStatus.spoilerText || alwaysShowSubject"
type="text"

View File

@ -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',