diff --git a/model/post.go b/model/post.go index ccb8286..e0c13c9 100644 --- a/model/post.go +++ b/model/post.go @@ -16,6 +16,7 @@ type ReplyContext struct { InReplyToID string InReplyToName string QuickReply bool + ReplySpoiler string ReplyContent string ForceVisibility bool } diff --git a/service/service.go b/service/service.go index e73e873..702eb48 100644 --- a/service/service.go +++ b/service/service.go @@ -353,8 +353,10 @@ func (s *service) ThreadPage(c *client, id string, reply bool) (err error) { } if reply { + var spoilerText string var content string var visibility string + spoilerText = status.SpoilerText if c.s.UserID != status.Account.ID { content += "@" + status.Account.Acct + " " } @@ -379,6 +381,7 @@ func (s *service) ThreadPage(c *client, id string, reply bool) (err error) { ReplyContext: &model.ReplyContext{ InReplyToID: id, InReplyToName: status.Account.Acct, + ReplySpoiler: spoilerText, ReplyContent: content, ForceVisibility: isDirect, }, @@ -935,7 +938,7 @@ func (s *service) Signout(c *client) (err error) { } func (s *service) Post(c *client, content string, replyToID string, - format string, visibility string, isNSFW bool, + format string, visibility string, isNSFW bool, spoilerText string, files []*multipart.FileHeader) (id string, err error) { var mediaIDs []string @@ -948,6 +951,7 @@ func (s *service) Post(c *client, content string, replyToID string, } tweet := &mastodon.Toot{ + SpoilerText: spoilerText, Status: content, InReplyToID: replyToID, MediaIDs: mediaIDs, diff --git a/service/transport.go b/service/transport.go index 75ae33c..c324426 100644 --- a/service/transport.go +++ b/service/transport.go @@ -268,6 +268,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler { }, SESSION, HTML) post := handle(func(c *client) error { + spoilerText := c.r.FormValue("title") content := c.r.FormValue("content") replyToID := c.r.FormValue("reply_to_id") format := c.r.FormValue("format") @@ -276,7 +277,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler { quickReply := c.r.FormValue("quickreply") == "true" files := c.r.MultipartForm.File["attachments"] - id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, files) + id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, spoilerText, files) if err != nil { return err } diff --git a/templates/postform.tmpl b/templates/postform.tmpl index 0af50fb..87fea46 100644 --- a/templates/postform.tmpl +++ b/templates/postform.tmpl @@ -13,6 +13,7 @@ emoji list