Use account mentions as default text in replies

This commit is contained in:
r 2019-12-13 20:33:20 +00:00
parent 9ba666009b
commit 2495d3389e
3 changed files with 23 additions and 11 deletions

View File

@ -28,13 +28,15 @@ type ThreadPageTemplateData struct {
Context *mastodon.Context
PostReply bool
ReplyToID string
ReplyContent string
}
func NewThreadPageTemplateData(status *mastodon.Status, context *mastodon.Context, postReply bool, replyToID string) *ThreadPageTemplateData {
func NewThreadPageTemplateData(status *mastodon.Status, context *mastodon.Context, postReply bool, replyToID string, replyContent string) *ThreadPageTemplateData {
return &ThreadPageTemplateData{
Status: status,
Context: context,
PostReply: postReply,
ReplyToID: replyToID,
ReplyContent: replyContent,
}
}

View File

@ -246,7 +246,17 @@ func (svc *service) ServeThreadPage(ctx context.Context, client io.Writer, c *ma
return
}
data := renderer.NewThreadPageTemplateData(status, context, reply, id)
var content string
if reply {
content += status.Account.Acct + " "
for _, m := range status.Mentions {
content += m.Acct + " "
}
}
fmt.Println("content", content)
data := renderer.NewThreadPageTemplateData(status, context, reply, id, content)
err = svc.renderer.RenderThreadPage(ctx, client, data)
if err != nil {
return

View File

@ -12,7 +12,7 @@
<input type="hidden" name="reply_to_id" value="{{.ReplyToID}}" />
<label for="post-content"> Reply to {{.Status.Account.DisplayName}} </label>
<br/>
<textarea id="post-content" name="content" class="post-content" cols="50" rows="5"></textarea>
<textarea id="post-content" name="content" class="post-content" cols="50" rows="5">{{.ReplyContent}}</textarea>
<br/>
<button type="submit"> Post </button>
</form>