From f1c16327b696666f291d5fb2afdf4033cf9ef76d Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Fri, 7 Sep 2018 18:17:17 +0300
Subject: Initial version

---
 src/components/settings/settings.vue | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index c106b79c..be7c64a7 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -1,7 +1,19 @@
 <template>
 <div class="settings panel panel-default">
   <div class="panel-heading">
-    {{$t('settings.settings')}}
+    <div class="title">
+      {{$t('settings.settings')}}
+    </div>
+
+    <template v-if="currentSaveStateNotice">
+      <div @click.prevent class="alert error" v-if="currentSaveStateNotice.error">
+        Errr
+      </div>
+
+      <div @click.prevent class="alert success" v-if="!currentSaveStateNotice.error">
+        Succ
+      </div>
+    </template>
   </div>
   <div class="panel-body">
     <tab-switcher>
-- 
cgit v1.2.3-70-g09d2


From 2db991fc7fb1eda11b94d585d3b56f9d94c81286 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 9 Sep 2018 19:36:13 +0300
Subject: some recategorization of options...

---
 src/App.js                                  |  6 ++--
 src/components/login_form/login_form.js     |  2 +-
 src/components/registration/registration.js |  4 +--
 src/components/settings/settings.js         |  3 +-
 src/components/settings/settings.vue        | 16 +++++----
 src/main.js                                 | 13 ++++---
 src/modules/config.js                       | 28 +--------------
 src/modules/interface.js                    | 53 +++++++++++++++++++++++++++++
 8 files changed, 78 insertions(+), 47 deletions(-)
 create mode 100644 src/modules/interface.js

(limited to 'src/components/settings/settings.vue')

diff --git a/src/App.js b/src/App.js
index be6548f3..251fdfca 100644
--- a/src/App.js
+++ b/src/App.js
@@ -60,10 +60,10 @@ export default {
     },
     logo () { return this.$store.state.config.logo },
     style () { return { 'background-image': `url(${this.background})` } },
-    sitename () { return this.$store.state.config.name },
+    sitename () { return this.$store.state.interface.name },
     chat () { return this.$store.state.chat.channel.state === 'joined' },
-    suggestionsEnabled () { return this.$store.state.config.suggestionsEnabled },
-    showInstanceSpecificPanel () { return this.$store.state.config.showInstanceSpecificPanel }
+    suggestionsEnabled () { return this.$store.state.interface.suggestionsEnabled },
+    showInstanceSpecificPanel () { return this.$store.state.interface.showInstanceSpecificPanel }
   },
   methods: {
     activatePanel (panelName) {
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js
index a117b76f..12144324 100644
--- a/src/components/login_form/login_form.js
+++ b/src/components/login_form/login_form.js
@@ -5,7 +5,7 @@ const LoginForm = {
   }),
   computed: {
     loggingIn () { return this.$store.state.users.loggingIn },
-    registrationOpen () { return this.$store.state.config.registrationOpen }
+    registrationOpen () { return this.$store.state.interface.registrationOpen }
   },
   methods: {
     submit () {
diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js
index 73840608..e53fa4e5 100644
--- a/src/components/registration/registration.js
+++ b/src/components/registration/registration.js
@@ -5,11 +5,11 @@ const registration = {
     registering: false
   }),
   created () {
-    if ((!this.$store.state.config.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
+    if ((!this.$store.state.interface.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
       this.$router.push('/main/all')
     }
     // Seems like this doesn't work at first page open for some reason
-    if (this.$store.state.config.registrationOpen && this.token) {
+    if (this.$store.state.interface.registrationOpen && this.token) {
       this.$router.push('/registration')
     }
   },
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 5e28c1af..6d481820 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -44,8 +44,7 @@ const settings = {
       return this.$store.state.users.currentUser
     },
     currentSaveStateNotice () {
-      console.log(this.$store.state.config._internal.currentSaveStateNotice && this.$store.state.config._internal.currentSaveStateNotice.error)
-      return this.$store.state.config._internal.currentSaveStateNotice
+      return this.$store.state.interface.settings.currentSaveStateNotice
     }
   },
   watch: {
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index be7c64a7..481cdf09 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -5,15 +5,17 @@
       {{$t('settings.settings')}}
     </div>
 
-    <template v-if="currentSaveStateNotice">
-      <div @click.prevent class="alert error" v-if="currentSaveStateNotice.error">
-        Errr
-      </div>
+    <transition name="fade">
+      <template v-if="currentSaveStateNotice">
+        <div @click.prevent class="alert error" v-if="!currentSaveStateNotice.error">
+          Errr
+        </div>
 
-      <div @click.prevent class="alert success" v-if="!currentSaveStateNotice.error">
-        Succ
-      </div>
+        <div @click.prevent class="alert success" v-if="!currentSaveStateNotice.error">
+          Succ
+        </div>
     </template>
+    </transition>
   </div>
   <div class="panel-body">
     <tab-switcher>
diff --git a/src/main.js b/src/main.js
index 75c2bab2..1f3c5da9 100644
--- a/src/main.js
+++ b/src/main.js
@@ -14,6 +14,7 @@ import Registration from './components/registration/registration.vue'
 import UserSettings from './components/user_settings/user_settings.vue'
 import FollowRequests from './components/follow_requests/follow_requests.vue'
 
+import interfaceModule from './modules/interface.js'
 import statusesModule from './modules/statuses.js'
 import usersModule from './modules/users.js'
 import apiModule from './modules/api.js'
@@ -67,8 +68,9 @@ const persistedStateOptions = {
   ]
 }
 
-const store = new Vuex.Store({
+const store = console.log('interfaceModule') || new Vuex.Store({
   modules: {
+    interface: interfaceModule,
     statuses: statusesModule,
     users: usersModule,
     api: apiModule,
@@ -92,10 +94,11 @@ window.fetch('/api/statusnet/config.json')
   .then((data) => {
     const {name, closed: registrationClosed, textlimit, server} = data.site
 
-    store.dispatch('setOption', { name: 'name', value: name })
-    store.dispatch('setOption', { name: 'registrationOpen', value: (registrationClosed === '0') })
-    store.dispatch('setOption', { name: 'textlimit', value: parseInt(textlimit) })
-    store.dispatch('setOption', { name: 'server', value: server })
+    console.log(store)
+    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 })
 
     var apiConfig = data.site.pleromafe
 
diff --git a/src/modules/config.js b/src/modules/config.js
index cb59acaa..375d0167 100644
--- a/src/modules/config.js
+++ b/src/modules/config.js
@@ -4,7 +4,6 @@ import StyleSetter from '../services/style_setter/style_setter.js'
 const browserLocale = (window.navigator.language || 'en').split('-')[0]
 
 const defaultState = {
-  name: 'Pleroma FE',
   colors: {},
   collapseMessageWithSubject: false,
   hideAttachments: false,
@@ -26,11 +25,7 @@ const defaultState = {
   },
   muteWords: [],
   highlight: {},
-  interfaceLanguage: browserLocale,
-  _internal: {
-    currentSaveStateNotice: {},
-    noticeClearTimeout: null
-  }
+  interfaceLanguage: browserLocale
 }
 
 const config = {
@@ -46,36 +41,15 @@ const config = {
       } else {
         del(state.highlight, user)
       }
-    },
-    settingsSaved (state, { success, error }) {
-      if (success) {
-        if (state.noticeClearTimeout) {
-          clearTimeout(state.noticeClearTimeout)
-        }
-        set(state._internal, 'currentSaveStateNotice', { error: false, data: success })
-        set(state._internal, 'noticeClearTimeout',
-            setTimeout(() => del(state._internal, 'currentSaveStateNotice'), 2000))
-      } else {
-        set(state._internal, 'currentSaveStateNotice', { error: true, errorData: error })
-      }
     }
   },
   actions: {
-    setPageTitle ({state}, option = '') {
-      document.title = `${option} ${state.name}`
-    },
     setHighlight ({ commit, dispatch }, { user, color, type }) {
       commit('setHighlight', {user, color, type})
     },
-    settingsSaved ({ commit, dispatch }, { success, error }) {
-      commit('settingsSaved', { success, error })
-    },
     setOption ({ commit, dispatch }, { name, value }) {
       commit('setOption', {name, value})
       switch (name) {
-        case 'name':
-          dispatch('setPageTitle')
-          break
         case 'theme':
           StyleSetter.setPreset(value, commit)
           break
diff --git a/src/modules/interface.js b/src/modules/interface.js
new file mode 100644
index 00000000..0067ee64
--- /dev/null
+++ b/src/modules/interface.js
@@ -0,0 +1,53 @@
+import { set, delete as del } from 'vue'
+
+const defaultState = {
+  name: 'Pleroma FE',
+  registrationOpen: true,
+  textlimit: 5000,
+  server: 'http://localhost:4040/',
+  settings: {
+    currentSaveStateNotice: null,
+    noticeClearTimeout: null
+  }
+}
+
+const interfaceMod = {
+  state: defaultState,
+  mutations: {
+    setInstanceOption (state, { name, value }) {
+      console.log(state)
+      console.log(name)
+      set(state, name, value)
+    },
+    settingsSaved (state, { success, error }) {
+      if (success) {
+        if (state.noticeClearTimeout) {
+          clearTimeout(state.noticeClearTimeout)
+        }
+        set(state.settings, 'currentSaveStateNotice', { error: false, data: success })
+        set(state.settings, 'noticeClearTimeout',
+            setTimeout(() => del(state.settings, 'currentSaveStateNotice'), 2000))
+      } else {
+        set(state.settings, 'currentSaveStateNotice', { error: true, errorData: error })
+      }
+    }
+  },
+  actions: {
+    setPageTitle ({state}, option = '') {
+      document.title = `${option} ${state.name}`
+    },
+    settingsSaved ({ commit, dispatch }, { success, error }) {
+      commit('settingsSaved', { success, error })
+    },
+    setInstanceOption ({ commit, dispatch }, { name, value }) {
+      commit('setInstanceOption', {name, value})
+      switch (name) {
+        case 'name':
+          dispatch('setPageTitle')
+          break
+      }
+    }
+  }
+}
+
+export default interfaceMod
-- 
cgit v1.2.3-70-g09d2


From 82fa5d08c4f441fa9df20edab214b99ecb7776b3 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 9 Sep 2018 21:21:23 +0300
Subject: more refactoring

---
 src/App.js                                         |  6 +--
 src/components/features_panel/features_panel.js    | 10 ++---
 src/components/login_form/login_form.js            |  2 +-
 .../post_status_form/post_status_form.js           |  8 ++--
 src/components/registration/registration.js        |  6 +--
 src/components/settings/settings.js                | 35 ++++++++--------
 src/components/settings/settings.vue               |  2 +-
 src/components/user_settings/user_settings.js      |  4 +-
 src/main.js                                        | 44 ++++++++++----------
 src/modules/instance.js                            | 47 ++++++++++++++++++++++
 src/modules/interface.js                           | 21 +---------
 11 files changed, 109 insertions(+), 76 deletions(-)
 create mode 100644 src/modules/instance.js

(limited to 'src/components/settings/settings.vue')

diff --git a/src/App.js b/src/App.js
index 251fdfca..a58a2bc5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -60,10 +60,10 @@ export default {
     },
     logo () { return this.$store.state.config.logo },
     style () { return { 'background-image': `url(${this.background})` } },
-    sitename () { return this.$store.state.interface.name },
+    sitename () { return this.$store.state.instance.name },
     chat () { return this.$store.state.chat.channel.state === 'joined' },
-    suggestionsEnabled () { return this.$store.state.interface.suggestionsEnabled },
-    showInstanceSpecificPanel () { return this.$store.state.interface.showInstanceSpecificPanel }
+    suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled },
+    showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel }
   },
   methods: {
     activatePanel (panelName) {
diff --git a/src/components/features_panel/features_panel.js b/src/components/features_panel/features_panel.js
index 80f5c966..945165bb 100644
--- a/src/components/features_panel/features_panel.js
+++ b/src/components/features_panel/features_panel.js
@@ -3,11 +3,11 @@ const FeaturesPanel = {
     chat: function () {
       return this.$store.state.config.chatAvailable && (!this.$store.state.chatDisabled)
     },
-    gopher: function () { return this.$store.state.config.gopherAvailable },
-    whoToFollow: function () { return this.$store.state.config.suggestionsEnabled },
-    mediaProxy: function () { return this.$store.state.config.mediaProxyAvailable },
-    scopeOptions: function () { return this.$store.state.config.scopeOptionsEnabled },
-    textlimit: function () { return this.$store.state.config.textlimit }
+    gopher: function () { return this.$store.state.instance.gopherAvailable },
+    whoToFollow: function () { return this.$store.state.instance.suggestionsEnabled },
+    mediaProxy: function () { return this.$store.state.instance.mediaProxyAvailable },
+    scopeOptions: function () { return this.$store.state.instance.scopeOptionsEnabled },
+    textlimit: function () { return this.$store.state.instance.textlimit }
   }
 }
 
diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js
index 12144324..4405fb92 100644
--- a/src/components/login_form/login_form.js
+++ b/src/components/login_form/login_form.js
@@ -5,7 +5,7 @@ const LoginForm = {
   }),
   computed: {
     loggingIn () { return this.$store.state.users.loggingIn },
-    registrationOpen () { return this.$store.state.interface.registrationOpen }
+    registrationOpen () { return this.$store.state.instance.registrationOpen }
   },
   methods: {
     submit () {
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 7babe236..dc92f009 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -120,10 +120,10 @@ const PostStatusForm = {
       return this.$store.state.users.users
     },
     emoji () {
-      return this.$store.state.config.emoji || []
+      return this.$store.state.instance.emoji || []
     },
     customEmoji () {
-      return this.$store.state.config.customEmoji || []
+      return this.$store.state.instance.customEmoji || []
     },
     statusLength () {
       return this.newStatus.status.length
@@ -141,10 +141,10 @@ const PostStatusForm = {
       return this.hasStatusLengthLimit && (this.statusLength > this.statusLengthLimit)
     },
     scopeOptionsEnabled () {
-      return this.$store.state.config.scopeOptionsEnabled
+      return this.$store.state.instance.scopeOptionsEnabled
     },
     formattingOptionsEnabled () {
-      return this.$store.state.config.formattingOptionsEnabled
+      return this.$store.state.instance.formattingOptionsEnabled
     }
   },
   methods: {
diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js
index e53fa4e5..8f59878d 100644
--- a/src/components/registration/registration.js
+++ b/src/components/registration/registration.js
@@ -5,16 +5,16 @@ const registration = {
     registering: false
   }),
   created () {
-    if ((!this.$store.state.interface.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
+    if ((!this.$store.state.instance.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
       this.$router.push('/main/all')
     }
     // Seems like this doesn't work at first page open for some reason
-    if (this.$store.state.interface.registrationOpen && this.token) {
+    if (this.$store.state.instance.registrationOpen && this.token) {
       this.$router.push('/registration')
     }
   },
   computed: {
-    termsofservice () { return this.$store.state.config.tos },
+    termsofservice () { return this.$store.state.instance.tos },
     token () { return this.$route.params.token }
   },
   methods: {
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 6d481820..856ca40e 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -6,25 +6,26 @@ import { filter, trim } from 'lodash'
 
 const settings = {
   data () {
-    const config = this.$store.state.config
+    const user = this.$store.state.config
+    const instance = this.$store.state.instance
 
     return {
-      hideAttachmentsLocal: config.hideAttachments,
-      hideAttachmentsInConvLocal: config.hideAttachmentsInConv,
-      hideNsfwLocal: config.hideNsfw,
-      notificationVisibilityLocal: config.notificationVisibility,
-      replyVisibilityLocal: config.replyVisibility,
-      loopVideoLocal: config.loopVideo,
-      loopVideoSilentOnlyLocal: config.loopVideoSilentOnly,
-      muteWordsString: config.muteWords.join('\n'),
-      autoLoadLocal: config.autoLoad,
-      streamingLocal: config.streaming,
-      pauseOnUnfocusedLocal: config.pauseOnUnfocused,
-      hoverPreviewLocal: config.hoverPreview,
-      collapseMessageWithSubjectLocal: typeof config.collapseMessageWithSubject === 'undefined'
-        ? config.defaultCollapseMessageWithSubject
-        : config.collapseMessageWithSubject,
-      stopGifs: config.stopGifs,
+      hideAttachmentsLocal: user.hideAttachments,
+      hideAttachmentsInConvLocal: user.hideAttachmentsInConv,
+      hideNsfwLocal: user.hideNsfw,
+      notificationVisibilityLocal: user.notificationVisibility,
+      replyVisibilityLocal: user.replyVisibility,
+      loopVideoLocal: user.loopVideo,
+      loopVideoSilentOnlyLocal: user.loopVideoSilentOnly,
+      muteWordsString: user.muteWords.join('\n'),
+      autoLoadLocal: user.autoLoad,
+      streamingLocal: user.streaming,
+      pauseOnUnfocusedLocal: user.pauseOnUnfocused,
+      hoverPreviewLocal: user.hoverPreview,
+      collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
+        ? instance.collapseMessageWithSubject
+        : user.collapseMessageWithSubject,
+      stopGifs: user.stopGifs,
       loopSilentAvailable:
         // Firefox
         Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 481cdf09..55ffa591 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -7,7 +7,7 @@
 
     <transition name="fade">
       <template v-if="currentSaveStateNotice">
-        <div @click.prevent class="alert error" v-if="!currentSaveStateNotice.error">
+        <div @click.prevent class="alert error" v-if="currentSaveStateNotice.error">
           Errr
         </div>
 
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 0b13a668..70463f2a 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -32,10 +32,10 @@ const UserSettings = {
       return this.$store.state.users.currentUser
     },
     pleromaBackend () {
-      return this.$store.state.config.pleromaBackend
+      return this.$store.state.instance.pleromaBackend
     },
     scopeOptionsEnabled () {
-      return this.$store.state.config.scopeOptionsEnabled
+      return this.$store.state.instance.scopeOptionsEnabled
     },
     vis () {
       return {
diff --git a/src/main.js b/src/main.js
index 1f3c5da9..23bd2cd3 100644
--- a/src/main.js
+++ b/src/main.js
@@ -15,6 +15,7 @@ import UserSettings from './components/user_settings/user_settings.vue'
 import FollowRequests from './components/follow_requests/follow_requests.vue'
 
 import interfaceModule from './modules/interface.js'
+import instanceModule from './modules/instance.js'
 import statusesModule from './modules/statuses.js'
 import usersModule from './modules/users.js'
 import apiModule from './modules/api.js'
@@ -68,9 +69,10 @@ const persistedStateOptions = {
   ]
 }
 
-const store = console.log('interfaceModule') || new Vuex.Store({
+const store = new Vuex.Store({
   modules: {
     interface: interfaceModule,
+    instance: instanceModule,
     statuses: statusesModule,
     users: usersModule,
     api: apiModule,
@@ -122,15 +124,15 @@ window.fetch('/api/statusnet/config.json')
       var formattingOptionsEnabled = (config.formattingOptionsEnabled)
       var defaultCollapseMessageWithSubject = (config.collapseMessageWithSubject)
 
-      store.dispatch('setOption', { name: 'theme', value: theme })
-      store.dispatch('setOption', { name: 'background', value: background })
-      store.dispatch('setOption', { name: 'logo', value: logo })
-      store.dispatch('setOption', { name: 'logoMask', value: logoMask })
-      store.dispatch('setOption', { name: 'logoMargin', value: logoMargin })
-      store.dispatch('setOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
-      store.dispatch('setOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
-      store.dispatch('setOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled })
-      store.dispatch('setOption', { name: 'defaultCollapseMessageWithSubject', value: defaultCollapseMessageWithSubject })
+      store.dispatch('setInstanceOption', { name: 'theme', value: theme })
+      store.dispatch('setInstanceOption', { name: 'background', value: background })
+      store.dispatch('setInstanceOption', { name: 'logo', value: logo })
+      store.dispatch('setInstanceOption', { name: 'logoMask', value: logoMask })
+      store.dispatch('setInstanceOption', { name: 'logoMargin', value: logoMargin })
+      store.dispatch('setInstanceOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel })
+      store.dispatch('setInstanceOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled })
+      store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled })
+      store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: defaultCollapseMessageWithSubject })
       if (chatDisabled) {
         store.dispatch('disableChat')
       }
@@ -180,7 +182,7 @@ window.fetch('/api/statusnet/config.json')
 window.fetch('/static/terms-of-service.html')
   .then((res) => res.text())
   .then((html) => {
-    store.dispatch('setOption', { name: 'tos', value: html })
+    store.dispatch('setInstanceOption', { name: 'tos', value: html })
   })
 
 window.fetch('/api/pleroma/emoji.json')
@@ -191,11 +193,11 @@ window.fetch('/api/pleroma/emoji.json')
           const emoji = Object.keys(values).map((key) => {
             return { shortcode: key, image_url: values[key] }
           })
-          store.dispatch('setOption', { name: 'customEmoji', value: emoji })
-          store.dispatch('setOption', { name: 'pleromaBackend', value: true })
+          store.dispatch('setInstanceOption', { name: 'customEmoji', value: emoji })
+          store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: true })
         },
         (failure) => {
-          store.dispatch('setOption', { name: 'pleromaBackend', value: false })
+          store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: false })
         }
       ),
     (error) => console.log(error)
@@ -207,24 +209,24 @@ window.fetch('/static/emoji.json')
     const emoji = Object.keys(values).map((key) => {
       return { shortcode: key, image_url: false, 'utf': values[key] }
     })
-    store.dispatch('setOption', { name: 'emoji', value: emoji })
+    store.dispatch('setInstanceOption', { name: 'emoji', value: emoji })
   })
 
 window.fetch('/instance/panel.html')
   .then((res) => res.text())
   .then((html) => {
-    store.dispatch('setOption', { name: 'instanceSpecificPanelContent', value: html })
+    store.dispatch('setInstanceOption', { name: 'instanceSpecificPanelContent', value: html })
   })
 
 window.fetch('/nodeinfo/2.0.json')
   .then((res) => res.json())
   .then((data) => {
     const metadata = data.metadata
-    store.dispatch('setOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
-    store.dispatch('setOption', { name: 'chatAvailable', value: data.metadata.chat })
-    store.dispatch('setOption', { name: 'gopherAvailable', value: data.metadata.gopher })
+    store.dispatch('setInstanceOption', { name: 'mediaProxyAvailable', value: data.metadata.mediaProxy })
+    store.dispatch('setInstanceOption', { name: 'chatAvailable', value: data.metadata.chat })
+    store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: data.metadata.gopher })
 
     const suggestions = metadata.suggestions
-    store.dispatch('setOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
-    store.dispatch('setOption', { name: 'suggestionsWeb', value: suggestions.web })
+    store.dispatch('setInstanceOption', { name: 'suggestionsEnabled', value: suggestions.enabled })
+    store.dispatch('setInstanceOption', { name: 'suggestionsWeb', value: suggestions.web })
   })
diff --git a/src/modules/instance.js b/src/modules/instance.js
new file mode 100644
index 00000000..228cee4c
--- /dev/null
+++ b/src/modules/instance.js
@@ -0,0 +1,47 @@
+import { set } from 'vue'
+
+const defaultState = {
+  name: 'Pleroma FE',
+  registrationOpen: true,
+  textlimit: 5000,
+  server: 'http://localhost:4040/',
+  theme: 'pleroma-dark',
+  background: 'img.png',
+  logo: '/static/logo.png',
+  logoMask: true,
+  logoMargin: '.2em',
+  redirectRootNoLogin: '/main/all',
+  redirectRootLogin: '/main/friends',
+  showInstanceSpecificPanel: false,
+  scopeOptionsEnabled: true,
+  formattingOptionsEnabled: false,
+  collapseMessageWithSubject: false,
+  disableChat: false,
+  // Nasty stuff
+  pleromaBackend: true,
+  customEmoji: [],
+  // Html stuff
+  instanceSpecificPanelContent: '',
+  tos: ''
+}
+
+const instance = {
+  state: defaultState,
+  mutations: {
+    setInstanceOption (state, { name, value }) {
+      set(state, name, value)
+    }
+  },
+  actions: {
+    setInstanceOption ({ commit, dispatch }, { name, value }) {
+      commit('setInstanceOption', {name, value})
+      switch (name) {
+        case 'name':
+          dispatch('setPageTitle')
+          break
+      }
+    }
+  }
+}
+
+export default instance
diff --git a/src/modules/interface.js b/src/modules/interface.js
index 0067ee64..07489685 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -1,10 +1,6 @@
 import { set, delete as del } from 'vue'
 
 const defaultState = {
-  name: 'Pleroma FE',
-  registrationOpen: true,
-  textlimit: 5000,
-  server: 'http://localhost:4040/',
   settings: {
     currentSaveStateNotice: null,
     noticeClearTimeout: null
@@ -14,11 +10,6 @@ const defaultState = {
 const interfaceMod = {
   state: defaultState,
   mutations: {
-    setInstanceOption (state, { name, value }) {
-      console.log(state)
-      console.log(name)
-      set(state, name, value)
-    },
     settingsSaved (state, { success, error }) {
       if (success) {
         if (state.noticeClearTimeout) {
@@ -33,19 +24,11 @@ const interfaceMod = {
     }
   },
   actions: {
-    setPageTitle ({state}, option = '') {
-      document.title = `${option} ${state.name}`
+    setPageTitle ({ rootState }, option = '') {
+      document.title = `${option} ${rootState.instance.name}`
     },
     settingsSaved ({ commit, dispatch }, { success, error }) {
       commit('settingsSaved', { success, error })
-    },
-    setInstanceOption ({ commit, dispatch }, { name, value }) {
-      commit('setInstanceOption', {name, value})
-      switch (name) {
-        case 'name':
-          dispatch('setPageTitle')
-          break
-      }
     }
   }
 }
-- 
cgit v1.2.3-70-g09d2


From 1245d7917f0f0172c09ab6e0c5fff0a1aed67784 Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Sun, 9 Sep 2018 21:57:17 +0300
Subject: translations

---
 src/components/settings/settings.vue | 6 +++---
 src/i18n/messages.js                 | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 55ffa591..8c7c1b71 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -8,11 +8,11 @@
     <transition name="fade">
       <template v-if="currentSaveStateNotice">
         <div @click.prevent class="alert error" v-if="currentSaveStateNotice.error">
-          Errr
+          {{ $t('settings.saving_err') }}
         </div>
 
-        <div @click.prevent class="alert success" v-if="!currentSaveStateNotice.error">
-          Succ
+        <div @click.prevent class="alert transparent" v-if="!currentSaveStateNotice.error">
+          {{ $t('settings.saving_ok') }}
         </div>
     </template>
     </transition>
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index 2f70f7f0..7575c128 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -282,6 +282,8 @@ const en = {
     no_retweet_hint: 'Post is marked as followers-only or direct and cannot be repeated'
   },
   settings: {
+    saving_ok: 'Settings saved',
+    saving_err: 'Error saving settings',
     general: 'General',
     user_settings: 'User Settings',
     name_bio: 'Name & Bio',
-- 
cgit v1.2.3-70-g09d2


From a61ad0544adf013095b8052ebd7a3ea21a3510ae Mon Sep 17 00:00:00 2001
From: Henry Jameson <me@hjkos.com>
Date: Thu, 20 Sep 2018 17:21:11 +0300
Subject: small thing to display instance-provided default

---
 src/components/settings/settings.js  | 1 +
 src/components/settings/settings.vue | 4 +++-
 src/i18n/messages.js                 | 5 +++++
 3 files changed, 9 insertions(+), 1 deletion(-)

(limited to 'src/components/settings/settings.vue')

diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 856ca40e..a24bc265 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -25,6 +25,7 @@ const settings = {
       collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
         ? instance.collapseMessageWithSubject
         : user.collapseMessageWithSubject,
+      collapseMessageWithSubjectDefault: this.$t('settings.values.' + instance.collapseMessageWithSubject),
       stopGifs: user.stopGifs,
       loopSilentAvailable:
         // Firefox
diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue
index 8c7c1b71..42c660a3 100644
--- a/src/components/settings/settings.vue
+++ b/src/components/settings/settings.vue
@@ -29,7 +29,9 @@
           <ul class="setting-list">
             <li>
               <input type="checkbox" id="collapseMessageWithSubject" v-model="collapseMessageWithSubjectLocal">
-              <label for="collapseMessageWithSubject">{{$t('settings.collapse_subject')}}</label>
+              <label for="collapseMessageWithSubject">
+                {{$t('settings.collapse_subject')}} {{$t('settings.instance_default', { value: collapseMessageWithSubjectDefault })}}
+              </label>
             </li>
             <li>
               <input type="checkbox" id="streaming" v-model="streamingLocal">
diff --git a/src/i18n/messages.js b/src/i18n/messages.js
index 7575c128..9dfc0b41 100644
--- a/src/i18n/messages.js
+++ b/src/i18n/messages.js
@@ -298,6 +298,11 @@ const en = {
     profile_background: 'Profile Background',
     set_new_profile_background: 'Set new profile background',
     settings: 'Settings',
+    instance_default: '(default: {value})',
+    values: {
+      true: 'yes',
+      false: 'no'
+    },
     theme: 'Theme',
     presets: 'Presets',
     export_theme: 'Save preset',
-- 
cgit v1.2.3-70-g09d2

