From c9a9b3122db9c2c089e36930ed2a252f80de71cd Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Tue, 2 Apr 2019 10:26:14 -0400
Subject: [PATCH 1/5] #469 - DM warning text should vary based on BE setting

---
 src/boot/after_store.js                              | 3 ++-
 src/components/post_status_form/post_status_form.js  | 4 ++++
 src/components/post_status_form/post_status_form.vue | 2 +-
 src/modules/instance.js                              | 1 +
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 862a534d..f2c1aa0f 100644
--- 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
index 40e2610e..d52abeee 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -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: {
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 3d3a1082..2f70a2ad 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -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"
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 3a559ba0..d4185f6a 100644
--- 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',

From 9d5ed04147388fbc29de3135b0d20102d786f966 Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Tue, 2 Apr 2019 10:28:38 -0400
Subject: [PATCH 2/5] #469 - clean up

---
 src/components/post_status_form/post_status_form.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index d52abeee..e0bb191c 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -181,7 +181,6 @@ const PostStatusForm = {
       return this.$store.state.instance.postFormats || []
     },
     showDirectWarning () {
-      console.log(this.$store.state.instance)
       return this.$store.state.instance.safeDM && this.newStatus.visibility === 'direct'
     }
   },

From 67258571c59c9e037d121b807f0a75c26e612c01 Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Tue, 2 Apr 2019 11:19:45 -0400
Subject: [PATCH 3/5] #469 - update behavior of safe_dm

---
 src/components/post_status_form/post_status_form.js  | 4 ++--
 src/components/post_status_form/post_status_form.vue | 7 +++++--
 src/i18n/en.json                                     | 3 ++-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index e0bb191c..c65c27e2 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -180,8 +180,8 @@ const PostStatusForm = {
     postFormats () {
       return this.$store.state.instance.postFormats || []
     },
-    showDirectWarning () {
-      return this.$store.state.instance.safeDM && this.newStatus.visibility === 'direct'
+    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
index 2f70a2ad..1ce2b647 100644
--- 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="showDirectWarning" 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
index 026546cc..0ce751bb 100644
--- 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 user at the beginning of the message.",
     "posting": "Posting",
     "scope": {
       "direct": "Direct - Post to mentioned users only",

From 70071b870f9a99e40295207de31f01910ec44a11 Mon Sep 17 00:00:00 2001
From: dave <starpumadev@gmail.com>
Date: Tue, 2 Apr 2019 12:46:22 -0400
Subject: [PATCH 4/5] #469 - update text copy

---
 src/i18n/en.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/i18n/en.json b/src/i18n/en.json
index 0ce751bb..1e82cd0a 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -81,7 +81,7 @@
     "content_warning": "Subject (optional)",
     "default": "Just landed in L.A.",
     "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 user at the beginning of the message.",
+    "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",

From 7259e02a10c1a4b0156dbc401c486e0fa6382d71 Mon Sep 17 00:00:00 2001
From: Maksim <parallel588@gmail.com>
Date: Mon, 8 Apr 2019 16:49:51 +0000
Subject: [PATCH 5/5] remove debug message

---
 src/modules/interface.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/modules/interface.js b/src/modules/interface.js
index 71554787..5b2762e5 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -48,7 +48,6 @@ const interfaceMod = {
       commit('setNotificationPermission', permission)
     },
     setMobileLayout ({ commit }, value) {
-      console.log('setMobileLayout called')
       commit('setMobileLayout', value)
     }
   }