mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-27 01: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
|
InReplyToID string
|
||||||
InReplyToName string
|
InReplyToName string
|
||||||
QuickReply bool
|
QuickReply bool
|
||||||
|
ReplySpoiler string
|
||||||
ReplyContent string
|
ReplyContent string
|
||||||
ForceVisibility bool
|
ForceVisibility bool
|
||||||
}
|
}
|
||||||
|
@ -353,8 +353,10 @@ func (s *service) ThreadPage(c *client, id string, reply bool) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if reply {
|
if reply {
|
||||||
|
var spoilerText string
|
||||||
var content string
|
var content string
|
||||||
var visibility string
|
var visibility string
|
||||||
|
spoilerText = status.SpoilerText
|
||||||
if c.s.UserID != status.Account.ID {
|
if c.s.UserID != status.Account.ID {
|
||||||
content += "@" + status.Account.Acct + " "
|
content += "@" + status.Account.Acct + " "
|
||||||
}
|
}
|
||||||
@ -379,6 +381,7 @@ func (s *service) ThreadPage(c *client, id string, reply bool) (err error) {
|
|||||||
ReplyContext: &model.ReplyContext{
|
ReplyContext: &model.ReplyContext{
|
||||||
InReplyToID: id,
|
InReplyToID: id,
|
||||||
InReplyToName: status.Account.Acct,
|
InReplyToName: status.Account.Acct,
|
||||||
|
ReplySpoiler: spoilerText,
|
||||||
ReplyContent: content,
|
ReplyContent: content,
|
||||||
ForceVisibility: isDirect,
|
ForceVisibility: isDirect,
|
||||||
},
|
},
|
||||||
@ -935,7 +938,7 @@ func (s *service) Signout(c *client) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) Post(c *client, content string, replyToID string,
|
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) {
|
files []*multipart.FileHeader) (id string, err error) {
|
||||||
|
|
||||||
var mediaIDs []string
|
var mediaIDs []string
|
||||||
@ -948,6 +951,7 @@ func (s *service) Post(c *client, content string, replyToID string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tweet := &mastodon.Toot{
|
tweet := &mastodon.Toot{
|
||||||
|
SpoilerText: spoilerText,
|
||||||
Status: content,
|
Status: content,
|
||||||
InReplyToID: replyToID,
|
InReplyToID: replyToID,
|
||||||
MediaIDs: mediaIDs,
|
MediaIDs: mediaIDs,
|
||||||
|
@ -268,6 +268,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
|
|||||||
}, SESSION, HTML)
|
}, SESSION, HTML)
|
||||||
|
|
||||||
post := handle(func(c *client) error {
|
post := handle(func(c *client) error {
|
||||||
|
spoilerText := c.r.FormValue("title")
|
||||||
content := c.r.FormValue("content")
|
content := c.r.FormValue("content")
|
||||||
replyToID := c.r.FormValue("reply_to_id")
|
replyToID := c.r.FormValue("reply_to_id")
|
||||||
format := c.r.FormValue("format")
|
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"
|
quickReply := c.r.FormValue("quickreply") == "true"
|
||||||
files := c.r.MultipartForm.File["attachments"]
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
emoji list
|
emoji list
|
||||||
</a>
|
</a>
|
||||||
<div class="post-form-content-container">
|
<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>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
Reference in New Issue
Block a user