From 54b7a29581c8d93c876a2a5840b05410f2a35fb9 Mon Sep 17 00:00:00 2001 From: Vadim Date: Wed, 24 Oct 2018 17:34:43 +0300 Subject: MM-12459 Include User Notify Props in the Bulk Export (#9724) --- app/export.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/export.go') 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 { -- cgit v1.2.3-1-g7c22