From 6bf09e2c34c568e3cb0d296142d5abed77332635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 8 Aug 2018 12:04:36 +0200 Subject: 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 --- store/sqlstore/user_store.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'store/sqlstore') 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 + }) +} -- cgit v1.2.3-1-g7c22