From a981085260af2623bd4988e4b9c0052e2e3035eb Mon Sep 17 00:00:00 2001 From: r Date: Fri, 31 Jan 2020 03:38:49 +0000 Subject: Update user page - Use the same page to display status and user list - Add media only status list --- service/transport.go | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'service/transport.go') diff --git a/service/transport.go b/service/transport.go index b2fb4a8..d945e18 100644 --- a/service/transport.go +++ b/service/transport.go @@ -146,36 +146,6 @@ func NewHandler(s Service, staticDir string) http.Handler { } } - followingPage := func(w http.ResponseWriter, req *http.Request) { - c := newClient(w) - ctx := newCtxWithSesion(req) - id, _ := mux.Vars(req)["id"] - maxID := req.URL.Query().Get("max_id") - minID := req.URL.Query().Get("min_id") - - err := s.ServeFollowingPage(ctx, c, id, maxID, minID) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - s.ServeErrorPage(ctx, c, err) - return - } - } - - followersPage := func(w http.ResponseWriter, req *http.Request) { - c := newClient(w) - ctx := newCtxWithSesion(req) - id, _ := mux.Vars(req)["id"] - maxID := req.URL.Query().Get("max_id") - minID := req.URL.Query().Get("min_id") - - err := s.ServeFollowersPage(ctx, c, id, maxID, minID) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - s.ServeErrorPage(ctx, c, err) - return - } - } - notificationsPage := func(w http.ResponseWriter, req *http.Request) { c := newClient(w) ctx := newCtxWithSesion(req) @@ -194,10 +164,11 @@ func NewHandler(s Service, staticDir string) http.Handler { c := newClient(w) ctx := newCtxWithSesion(req) id, _ := mux.Vars(req)["id"] + pageType, _ := mux.Vars(req)["type"] maxID := req.URL.Query().Get("max_id") minID := req.URL.Query().Get("min_id") - err := s.ServeUserPage(ctx, c, id, maxID, minID) + err := s.ServeUserPage(ctx, c, id, pageType, maxID, minID) if err != nil { w.WriteHeader(http.StatusInternalServerError) s.ServeErrorPage(ctx, c, err) @@ -600,10 +571,9 @@ func NewHandler(s Service, staticDir string) http.Handler { r.HandleFunc("/thread/{id}", threadPage).Methods(http.MethodGet) r.HandleFunc("/likedby/{id}", likedByPage).Methods(http.MethodGet) r.HandleFunc("/retweetedby/{id}", retweetedByPage).Methods(http.MethodGet) - r.HandleFunc("/following/{id}", followingPage).Methods(http.MethodGet) - r.HandleFunc("/followers/{id}", followersPage).Methods(http.MethodGet) r.HandleFunc("/notifications", notificationsPage).Methods(http.MethodGet) r.HandleFunc("/user/{id}", userPage).Methods(http.MethodGet) + r.HandleFunc("/user/{id}/{type}", userPage).Methods(http.MethodGet) r.HandleFunc("/usersearch/{id}", userSearchPage).Methods(http.MethodGet) r.HandleFunc("/about", aboutPage).Methods(http.MethodGet) r.HandleFunc("/emojis", emojisPage).Methods(http.MethodGet) -- cgit v1.2.3