aboutsummaryrefslogtreecommitdiff
path: root/modules/user
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user')
-rw-r--r--modules/user/user.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/user/user.go b/modules/user/user.go
index 06245e2..92a04db 100644
--- a/modules/user/user.go
+++ b/modules/user/user.go
@@ -27,13 +27,13 @@ func (m *Module) Name() string {
27 27
28func (m *Module) Init(g *grilist.Grilist) { 28func (m *Module) Init(g *grilist.Grilist) {
29 m.g = g 29 m.g = g
30 30
31 gm, ok := g.Modules["Lists"] 31 gm, ok := g.Modules["Lists"]
32 if !ok { 32 if !ok {
33 log.Fatal("tags: lists module not found") 33 log.Fatal("tags: lists module not found")
34 } 34 }
35 m.lists = gm.(*lists.Module) 35 m.lists = gm.(*lists.Module)
36 36
37 m.g.Router.GET("/user/:id", m.viewUser) 37 m.g.Router.GET("/user/:id", m.viewUser)
38 m.g.Router.GET("/user/:id/*rest", m.viewUser) 38 m.g.Router.GET("/user/:id/*rest", m.viewUser)
39} 39}
@@ -44,13 +44,13 @@ func (m *Module) ProvideDashboardData(user *charakterin.User) []grilist.Dashboar
44 44
45func (m *Module) viewUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) { 45func (m *Module) viewUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
46 currentUser, _ := m.g.Charakterin.GetUserFromRequest(r) 46 currentUser, _ := m.g.Charakterin.GetUserFromRequest(r)
47 47
48 userID, err := strconv.Atoi(p.ByName("id")) 48 userID, err := strconv.Atoi(p.ByName("id"))
49 if err != nil { 49 if err != nil {
50 http.Redirect(w, r, "/", 302) 50 http.Redirect(w, r, "/", 302)
51 return 51 return
52 } 52 }
53 53
54 user := currentUser 54 user := currentUser
55 if user == nil || currentUser.ID != userID { 55 if user == nil || currentUser.ID != userID {
56 user, err = m.g.Charakterin.GetUserByID(userID) 56 user, err = m.g.Charakterin.GetUserByID(userID)
@@ -59,13 +59,13 @@ func (m *Module) viewUser(w http.ResponseWriter, r *http.Request, p httprouter.P
59 return 59 return
60 } 60 }
61 } 61 }
62 62
63 userLists := m.lists.GetUserLists(user, true) 63 userLists := m.lists.GetUserLists(user, true)
64 64
65 data := m.g.Renderer.DefaultData() 65 data := m.g.Renderer.DefaultData()
66 data["user"] = currentUser 66 data["user"] = currentUser
67 data["DisplayUser"] = user 67 data["DisplayUser"] = user
68 data["Lists"] = lists.ListsToCards(userLists) 68 data["Lists"] = lists.ListsToCards(userLists)
69 69
70 m.g.Renderer.RenderPage("user", w, data) 70 m.g.Renderer.RenderPage("user", w, data)
71} 71}