summaryrefslogtreecommitdiffstats
path: root/app/config.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-03-05 07:18:22 -0500
committerJoram Wilander <jwawilander@gmail.com>2018-03-05 12:18:22 +0000
commitfbff94f3be1bf596f2b94f593687d3b162413de9 (patch)
tree2aea8cf109b1623a207ab38ea28bdf816faf3b09 /app/config.go
parentfa98175a46106ba116e6e6cd05577fb03308ceac (diff)
downloadchat-fbff94f3be1bf596f2b94f593687d3b162413de9.tar.gz
chat-fbff94f3be1bf596f2b94f593687d3b162413de9.tar.bz2
chat-fbff94f3be1bf596f2b94f593687d3b162413de9.zip
MM-8604: emit config/license websocket events (#8371)
Diffstat (limited to 'app/config.go')
-rw-r--r--app/config.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/config.go b/app/config.go
index 35a0c9a3f..460d580d8 100644
--- a/app/config.go
+++ b/app/config.go
@@ -14,6 +14,7 @@ import (
"fmt"
"net/url"
"runtime/debug"
+ "strconv"
"strings"
l4g "github.com/alecthomas/log4go"
@@ -34,6 +35,7 @@ func (a *App) UpdateConfig(f func(*model.Config)) {
updated := old.Clone()
f(updated)
a.config.Store(updated)
+
a.InvokeConfigListeners(old, updated)
}
@@ -269,3 +271,16 @@ func (a *App) GetCookieDomain() string {
func (a *App) GetSiteURL() string {
return a.siteURL
}
+
+// ClientConfigWithNoAccounts gets the configuration in a format suitable for sending to the client.
+func (a *App) ClientConfigWithNoAccounts() map[string]string {
+ respCfg := map[string]string{}
+ for k, v := range a.ClientConfig() {
+ respCfg[k] = v
+ }
+
+ // NoAccounts is not actually part of the configuration, but is expected by the client.
+ respCfg["NoAccounts"] = strconv.FormatBool(a.IsFirstUserAccount())
+
+ return respCfg
+}