aboutsummaryrefslogtreecommitdiff
path: root/service/transport.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2019-12-29 03:43:57 +0000
committerr <r@freesoftwareextremist.com>2019-12-29 03:43:57 +0000
commit72dbe50341179d345f8cbd1bf5a97809037db364 (patch)
treee11659a1178179ccbe7e88b794b280cb225746a2 /service/transport.go
parentb9d7eb05beb57926181f91685a75b3069d1f8cf8 (diff)
downloadbloat-72dbe50341179d345f8cbd1bf5a97809037db364.tar.gz
bloat-72dbe50341179d345f8cbd1bf5a97809037db364.zip
Add following and followers page
Diffstat (limited to 'service/transport.go')
-rw-r--r--service/transport.go30
1 files changed, 29 insertions, 1 deletions
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)