diff options
Diffstat (limited to 'api/import.go')
-rw-r--r-- | api/import.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/api/import.go b/api/import.go index a6db73126..b93a061fe 100644 --- a/api/import.go +++ b/api/import.go @@ -10,6 +10,7 @@ import ( "unicode/utf8" l4g "github.com/alecthomas/log4go" + "github.com/mattermost/platform/app" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" ) @@ -34,12 +35,12 @@ func ImportPost(post *model.Post) { post.Hashtags, _ = model.ParseHashtags(post.Message) - if result := <-Srv.Store.Post().Save(post); result.Err != nil { + if result := <-app.Srv.Store.Post().Save(post); result.Err != nil { l4g.Debug(utils.T("api.import.import_post.saving.debug"), post.UserId, post.Message) } for _, fileId := range post.FileIds { - if result := <-Srv.Store.FileInfo().AttachToPost(fileId, post.Id); result.Err != nil { + if result := <-app.Srv.Store.FileInfo().AttachToPost(fileId, post.Id); result.Err != nil { l4g.Error(utils.T("api.import.import_post.attach_files.error"), post.Id, post.FileIds, result.Err) } } @@ -55,17 +56,17 @@ func ImportUser(team *model.Team, user *model.User) *model.User { user.Roles = model.ROLE_SYSTEM_USER.Id - if result := <-Srv.Store.User().Save(user); result.Err != nil { + if result := <-app.Srv.Store.User().Save(user); result.Err != nil { l4g.Error(utils.T("api.import.import_user.saving.error"), result.Err) return nil } else { ruser := result.Data.(*model.User) - if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil { + if cresult := <-app.Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil { l4g.Error(utils.T("api.import.import_user.set_email.error"), cresult.Err) } - if err := JoinUserToTeam(team, user); err != nil { + if err := app.JoinUserToTeam(team, user); err != nil { l4g.Error(utils.T("api.import.import_user.join_team.error"), err) } @@ -74,7 +75,7 @@ func ImportUser(team *model.Team, user *model.User) *model.User { } func ImportChannel(channel *model.Channel) *model.Channel { - if result := <-Srv.Store.Channel().Save(channel); result.Err != nil { + if result := <-app.Srv.Store.Channel().Save(channel); result.Err != nil { return nil } else { sc := result.Data.(*model.Channel) |