aboutsummaryrefslogtreecommitdiff
path: root/backend/notes/app.bsky.feed.post.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/notes/app.bsky.feed.post.go')
-rw-r--r--backend/notes/app.bsky.feed.post.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/backend/notes/app.bsky.feed.post.go b/backend/notes/app.bsky.feed.post.go
index 32e7854..17ff5ee 100644
--- a/backend/notes/app.bsky.feed.post.go
+++ b/backend/notes/app.bsky.feed.post.go
@@ -2,6 +2,7 @@ package notes
import (
"fmt"
+ "llostre/backend/general"
"strings"
"time"
)
@@ -10,6 +11,8 @@ type AppBskyFeedPostNote struct {
URI string `json:"uri"`
AuthorDID string `json:"authorDid"`
AuthorHandle string `json:"authorHandle"`
+ AuthorName string `json:"authorName"`
+ AvatarURL string `json:"avatarURL"`
Text string `json:"text"`
CreatedAt time.Time `json:"createdAt"`
ReplyTo *string `json:"replyTo,omitempty"`
@@ -68,7 +71,7 @@ func (bp *AppBskyFeedPostNote) GetReplyTo() *string {
return bp.ReplyTo
}
-func AppBskyFeedPostFromRecord(record AppBskyFeedPostRecord) (*AppBskyFeedPostNote, error) {
+func AppBskyFeedPostFromRecord(record AppBskyFeedPostRecord, profile *general.Profile) (*AppBskyFeedPostNote, error) {
if record.URI == "" {
return nil, fmt.Errorf("missing required field: uri")
}
@@ -115,10 +118,23 @@ func AppBskyFeedPostFromRecord(record AppBskyFeedPostRecord) (*AppBskyFeedPostNo
}
}
+ var handle, displayName, avatarURL string
+ if profile != nil {
+ handle = profile.Handle
+ displayName = profile.DisplayName
+ avatarURL = profile.AvatarURL
+ } else {
+ handle = "handle.invalid"
+ displayName = ""
+ avatarURL = ""
+ }
+
return &AppBskyFeedPostNote{
URI: record.URI,
AuthorDID: did,
- AuthorHandle: "author_handle", // wip
+ AuthorHandle: handle,
+ AuthorName: displayName,
+ AvatarURL: avatarURL,
CreatedAt: createdAt,
Text: record.Value.Text,
ReplyTo: replyTo,