From fb11d8099e44f0e02f71d46b807dcab9c890eac8 Mon Sep 17 00:00:00 2001 From: Guillermo Serrahima Date: Fri, 20 Feb 2026 16:27:29 +0100 Subject: added profile info --- backend/notes/app.bsky.feed.post.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'backend/notes') 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, -- cgit v1.2.3