From 72dbe50341179d345f8cbd1bf5a97809037db364 Mon Sep 17 00:00:00 2001 From: r Date: Sun, 29 Dec 2019 03:43:57 +0000 Subject: Add following and followers page --- service/transport.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'service/transport.go') diff --git a/service/transport.go b/service/transport.go index 3ab2546..20d96a5 100644 --- a/service/transport.go +++ b/service/transport.go @@ -122,6 +122,34 @@ func NewHandler(s Service, staticDir string) http.Handler { } }).Methods(http.MethodGet) + r.HandleFunc("/following/{id}", func(w http.ResponseWriter, req *http.Request) { + ctx := getContextWithSession(context.Background(), req) + + id, _ := mux.Vars(req)["id"] + maxID := req.URL.Query().Get("max_id") + minID := req.URL.Query().Get("min_id") + + err := s.ServeFollowingPage(ctx, w, nil, id, maxID, minID) + if err != nil { + s.ServeErrorPage(ctx, w, err) + return + } + }).Methods(http.MethodGet) + + r.HandleFunc("/followers/{id}", func(w http.ResponseWriter, req *http.Request) { + ctx := getContextWithSession(context.Background(), req) + + id, _ := mux.Vars(req)["id"] + maxID := req.URL.Query().Get("max_id") + minID := req.URL.Query().Get("min_id") + + err := s.ServeFollowersPage(ctx, w, nil, id, maxID, minID) + if err != nil { + s.ServeErrorPage(ctx, w, err) + return + } + }).Methods(http.MethodGet) + r.HandleFunc("/like/{id}", func(w http.ResponseWriter, req *http.Request) { ctx := getContextWithSession(context.Background(), req) id, _ := mux.Vars(req)["id"] @@ -323,7 +351,7 @@ func NewHandler(s Service, staticDir string) http.Handler { copyScope := req.FormValue("copy_scope") == "true" settings := &model.Settings{ DefaultVisibility: visibility, - CopyScope: copyScope, + CopyScope: copyScope, } err := s.SaveSettings(ctx, w, nil, settings) -- cgit v1.2.3