aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--renderer/model.go20
-rw-r--r--service/service.go12
-rw-r--r--templates/thread.tmpl2
3 files changed, 23 insertions, 11 deletions
diff --git a/renderer/model.go b/renderer/model.go
index ddc9e2d..6f6acc4 100644
--- a/renderer/model.go
+++ b/renderer/model.go
@@ -24,17 +24,19 @@ func NewTimelinePageTemplateData(statuses []*mastodon.Status, hasNext bool, next
}
type ThreadPageTemplateData struct {
- Status *mastodon.Status
- Context *mastodon.Context
- PostReply bool
- ReplyToID string
+ Status *mastodon.Status
+ 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,
+ Status: status,
+ Context: context,
+ PostReply: postReply,
+ ReplyToID: replyToID,
+ ReplyContent: replyContent,
}
}
diff --git a/service/service.go b/service/service.go
index 7088a9b..8b5562d 100644
--- a/service/service.go
+++ b/service/service.go
@@ -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
diff --git a/templates/thread.tmpl b/templates/thread.tmpl
index ad312df..4bdc2f0 100644
--- a/templates/thread.tmpl
+++ b/templates/thread.tmpl
@@ -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>