summaryrefslogtreecommitdiffstats
path: root/store/sqlstore
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-08-08 12:04:36 +0200
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-08-08 12:04:36 +0200
commit6bf09e2c34c568e3cb0d296142d5abed77332635 (patch)
treea8a05b94c842d53dede08fe8d52ad28cf2c89a73 /store/sqlstore
parent3b640cd51b5b622002d6c9a0d6b1e7a6e9dafb69 (diff)
downloadchat-6bf09e2c34c568e3cb0d296142d5abed77332635.tar.gz
chat-6bf09e2c34c568e3cb0d296142d5abed77332635.tar.bz2
chat-6bf09e2c34c568e3cb0d296142d5abed77332635.zip
MM-11384: Add system install date information to the client config (#9218)
* MM-11384: Add system install date information to the client config * Fixing translation text * Fixes from Peer Review
Diffstat (limited to 'store/sqlstore')
-rw-r--r--store/sqlstore/user_store.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/store/sqlstore/user_store.go b/store/sqlstore/user_store.go
index 203ad4c26..d8a77cd9d 100644
--- a/store/sqlstore/user_store.go
+++ b/store/sqlstore/user_store.go
@@ -1316,3 +1316,14 @@ func (us SqlUserStore) ClearAllCustomRoleAssignments() store.StoreChannel {
}
})
}
+
+func (us SqlUserStore) InferSystemInstallDate() store.StoreChannel {
+ return store.Do(func(result *store.StoreResult) {
+ createAt, err := us.GetReplica().SelectInt("SELECT CreateAt FROM Users WHERE CreateAt IS NOT NULL ORDER BY CreateAt ASC LIMIT 1")
+ if err != nil {
+ result.Err = model.NewAppError("SqlUserStore.GetSystemInstallDate", "store.sql_user.get_system_install_date.app_error", nil, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ result.Data = createAt
+ })
+}