mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-22 23:13:00 +00:00
Spoiler text for statuses posting\replying
This commit is contained in:
parent
00d20ea5bb
commit
e83dbe7ca9
@ -16,6 +16,7 @@ type ReplyContext struct {
|
||||
InReplyToID string
|
||||
InReplyToName string
|
||||
QuickReply bool
|
||||
ReplySpoiler string
|
||||
ReplyContent string
|
||||
ForceVisibility bool
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
emoji list
|
||||
</a>
|
||||
<div class="post-form-content-container">
|
||||
<input id="post-title" name="title" class="post-title" size="34" title="Add post title" value="{{if .ReplyContext}}{{.ReplyContext.ReplySpoiler}}{{end}}" />
|
||||
<textarea id="post-content" name="content" class="post-content" cols="34" rows="5" accesskey="E" title="Edit post (E)">{{if .ReplyContext}}{{.ReplyContext.ReplyContent}}{{end}}</textarea>
|
||||
</div>
|
||||
<div>
|
||||
|
Loading…
Reference in New Issue
Block a user