diff options
Diffstat (limited to 'web/web.go')
-rw-r--r-- | web/web.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/web/web.go b/web/web.go index 1f693c873..30a70ba2e 100644 --- a/web/web.go +++ b/web/web.go @@ -238,7 +238,14 @@ func login(c *api.Context, w http.ResponseWriter, r *http.Request) { _, session := api.FindMultiSessionForTeamId(r, team.Id) if session != nil { w.Header().Set(model.HEADER_TOKEN, session.Token) - http.Redirect(w, r, c.GetSiteURL()+"/"+team.Name+"/channels/town-square", http.StatusTemporaryRedirect) + lastViewChannelName := "town-square" + if lastViewResult := <-api.Srv.Store.Preference().Get(session.UserId, model.PREFERENCE_CATEGORY_LAST, model.PREFERENCE_NAME_LAST_CHANNEL); lastViewResult.Err == nil { + if lastViewChannelResult := <-api.Srv.Store.Channel().Get(lastViewResult.Data.(model.Preference).Value); lastViewChannelResult.Err == nil { + lastViewChannelName = lastViewChannelResult.Data.(*model.Channel).Name + } + } + + http.Redirect(w, r, c.GetSiteURL()+"/"+team.Name+"/channels/"+lastViewChannelName, http.StatusTemporaryRedirect) return } |