aboutsummaryrefslogtreecommitdiff
path: root/service/transport.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2021-09-05 17:17:59 +0000
committerr <r@freesoftwareextremist.com>2021-09-05 17:33:58 +0000
commit54c42455f393c5ae8ebdb19884d40ebd9a18f755 (patch)
treedeecf729e7ba3565058dca6678e2b78805206097 /service/transport.go
parent4351155f67963b58feeba0d16bb998862ceb4d69 (diff)
downloadbloat-54c42455f393c5ae8ebdb19884d40ebd9a18f755.tar.gz
bloat-54c42455f393c5ae8ebdb19884d40ebd9a18f755.zip
Add quick reply
Diffstat (limited to 'service/transport.go')
-rw-r--r--service/transport.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/service/transport.go b/service/transport.go
index da09557..a022b02 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -186,6 +186,11 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
return s.ThreadPage(c, id, len(reply) > 1)
}, SESSION, HTML)
+ quickReplyPage := handle(func(c *client) error {
+ id, _ := mux.Vars(c.r)["id"]
+ return s.QuickReplyPage(c, id)
+ }, SESSION, HTML)
+
likedByPage := handle(func(c *client) error {
id, _ := mux.Vars(c.r)["id"]
return s.LikedByPage(c, id)
@@ -272,6 +277,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
format := c.r.FormValue("format")
visibility := c.r.FormValue("visibility")
isNSFW := c.r.FormValue("is_nsfw") == "true"
+ quickReply := c.r.FormValue("quickreply") == "true"
files := c.r.MultipartForm.File["attachments"]
id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, files)
@@ -279,9 +285,15 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
return err
}
- location := c.r.FormValue("referrer")
+ var location string
if len(replyToID) > 0 {
- location = "/thread/" + replyToID + "#status-" + id
+ if quickReply {
+ location = "/quickreply/" + id + "#status-" + id
+ } else {
+ location = "/thread/" + replyToID + "#status-" + id
+ }
+ } else {
+ location = c.r.FormValue("referrer")
}
redirect(c, location)
return nil
@@ -640,6 +652,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
r.HandleFunc("/timeline/{type}", timelinePage).Methods(http.MethodGet)
r.HandleFunc("/timeline", defaultTimelinePage).Methods(http.MethodGet)
r.HandleFunc("/thread/{id}", threadPage).Methods(http.MethodGet)
+ r.HandleFunc("/quickreply/{id}", quickReplyPage).Methods(http.MethodGet)
r.HandleFunc("/likedby/{id}", likedByPage).Methods(http.MethodGet)
r.HandleFunc("/retweetedby/{id}", retweetedByPage).Methods(http.MethodGet)
r.HandleFunc("/notifications", notificationsPage).Methods(http.MethodGet)