diff options
| author | Guillermo Serrahima <dev@vylion.com> | 2026-02-20 16:27:29 +0100 |
|---|---|---|
| committer | Guillermo Serrahima <dev@vylion.com> | 2026-02-20 16:27:29 +0100 |
| commit | fb11d8099e44f0e02f71d46b807dcab9c890eac8 (patch) | |
| tree | 0bcbb65ff9179e3835012f950363e7e328e862b0 /backend/notes | |
| parent | 4a2a8c34e87c5dd25f6d01a1aafaa10799aa907f (diff) | |
| download | llostre-fb11d8099e44f0e02f71d46b807dcab9c890eac8.tar.xz llostre-fb11d8099e44f0e02f71d46b807dcab9c890eac8.zip | |
added profile info
Diffstat (limited to 'backend/notes')
| -rw-r--r-- | backend/notes/app.bsky.feed.post.go | 20 |
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, |
