summaryrefslogtreecommitdiffstats
path: root/app/export.go
diff options
context:
space:
mode:
authorVadim <vad.pashkov@gmail.com>2018-10-24 17:34:43 +0300
committerChristopher Speller <crspeller@gmail.com>2018-10-24 07:34:43 -0700
commit54b7a29581c8d93c876a2a5840b05410f2a35fb9 (patch)
treeedc5077d7a454026f859f44158ae43b46308e856 /app/export.go
parent159c2a44dced5d6331f5fc5e7220e561e6468ad1 (diff)
downloadchat-54b7a29581c8d93c876a2a5840b05410f2a35fb9.tar.gz
chat-54b7a29581c8d93c876a2a5840b05410f2a35fb9.tar.bz2
chat-54b7a29581c8d93c876a2a5840b05410f2a35fb9.zip
MM-12459 Include User Notify Props in the Bulk Export (#9724)
Diffstat (limited to 'app/export.go')
-rw-r--r--app/export.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/export.go b/app/export.go
index b911954a5..7c1736157 100644
--- a/app/export.go
+++ b/app/export.go
@@ -150,6 +150,8 @@ func (a *App) ExportAllUsers(writer io.Writer) *model.AppError {
userLine := ImportLineFromUser(user)
+ userLine.User.NotifyProps = a.buildUserNotifyProps(user.NotifyProps)
+
// Do the Team Memberships.
members, err := a.buildUserTeamAndChannelMemberships(user.Id)
if err != nil {
@@ -218,6 +220,27 @@ func (a *App) buildUserChannelMemberships(userId string, teamId string) (*[]User
return &memberships, nil
}
+func (a *App) buildUserNotifyProps(notifyProps model.StringMap) *UserNotifyPropsImportData {
+
+ getProp := func(key string) *string {
+ if v, ok := notifyProps[key]; ok {
+ return &v
+ }
+ return nil
+ }
+
+ return &UserNotifyPropsImportData{
+ Desktop: getProp(model.DESKTOP_NOTIFY_PROP),
+ DesktopSound: getProp(model.DESKTOP_SOUND_NOTIFY_PROP),
+ Email: getProp(model.EMAIL_NOTIFY_PROP),
+ Mobile: getProp(model.MOBILE_NOTIFY_PROP),
+ MobilePushStatus: getProp(model.MOBILE_PUSH_STATUS_NOTIFY_PROP),
+ ChannelTrigger: getProp(model.CHANNEL_MENTIONS_NOTIFY_PROP),
+ CommentsTrigger: getProp(model.COMMENTS_NOTIFY_PROP),
+ MentionKeys: getProp(model.MENTION_KEYS_NOTIFY_PROP),
+ }
+}
+
func (a *App) ExportAllPosts(writer io.Writer) *model.AppError {
afterId := strings.Repeat("0", 26)
for {