Use a single form for new posts and replies

This commit is contained in:
r 2019-12-21 08:36:44 +00:00
parent df875381d4
commit 39c57a6b65
7 changed files with 42 additions and 34 deletions

View file

@ -276,10 +276,9 @@ func (svc *service) ServeThreadPage(ctx context.Context, client io.Writer, c *ma
return
}
var content string
var replyToID string
var replyContext *model.ReplyContext
if reply {
replyToID = id
var content string
if u.ID != status.Account.ID {
content += "@" + status.Account.Acct + " "
}
@ -288,6 +287,11 @@ func (svc *service) ServeThreadPage(ctx context.Context, client io.Writer, c *ma
content += "@" + status.Mentions[i].Acct + " "
}
}
replyContext = &model.ReplyContext{
InReplyToID: id,
InReplyToName: status.Account.Acct,
ReplyContent: content,
}
}
context, err := c.GetStatusContext(ctx, id)
@ -310,7 +314,7 @@ func (svc *service) ServeThreadPage(ctx context.Context, client io.Writer, c *ma
return
}
data := renderer.NewThreadPageTemplateData(statuses, replyToID, content, replyMap, navbarData)
data := renderer.NewThreadPageTemplateData(statuses, replyContext, replyMap, navbarData)
err = svc.renderer.RenderThreadPage(ctx, client, data)
if err != nil {
return