Skip to content

Commit 44460b2

Browse files
committed
fix: post threads
1 parent 9105f72 commit 44460b2

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

bluesky/blueskyapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ type Timeline struct {
160160
type Thread struct {
161161
Type string `json:"$type"`
162162
Post Post `json:"post"`
163-
Parent *Post `json:"parent"`
163+
Parent *Thread `json:"parent"`
164164
Replies *[]Thread `json:"replies"`
165165
}
166166

twitterv1/interaction.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func status_update(c *fiber.Ctx) error {
4141
if thread.Thread.Parent == nil {
4242
return c.JSON(TranslatePostToTweet(thread.Thread.Post, "", "", nil, nil, *oauthToken, *pds))
4343
} else {
44-
return c.JSON(TranslatePostToTweet(thread.Thread.Post, thread.Thread.Parent.URI, thread.Thread.Parent.Author.DID, &thread.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds))
44+
return c.JSON(TranslatePostToTweet(thread.Thread.Post, thread.Thread.Parent.Post.URI, thread.Thread.Parent.Post.Author.DID, &thread.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds))
4545
}
4646
}
4747

@@ -76,7 +76,7 @@ func retweet(c *fiber.Ctx) error {
7676
if originalPost.Thread.Parent == nil {
7777
retweet = TranslatePostToTweet(originalPost.Thread.Post, "", "", nil, nil, *oauthToken, *pds)
7878
} else {
79-
retweet = TranslatePostToTweet(originalPost.Thread.Post, originalPost.Thread.Parent.URI, originalPost.Thread.Parent.Author.DID, &originalPost.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds)
79+
retweet = TranslatePostToTweet(originalPost.Thread.Post, originalPost.Thread.Parent.Post.URI, originalPost.Thread.Parent.Post.Author.DID, &originalPost.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds)
8080
}
8181
retweet.Retweeted = true
8282
now := time.Now() // pain, also fix this to use the proper timestamp according to the server.
@@ -91,7 +91,7 @@ func retweet(c *fiber.Ctx) error {
9191
if originalPost.Thread.Parent == nil {
9292
return TranslatePostToTweet(originalPost.Thread.Post, "", "", nil, nil, *oauthToken, *pds)
9393
} else {
94-
return TranslatePostToTweet(originalPost.Thread.Post, originalPost.Thread.Parent.URI, originalPost.Thread.Parent.Author.DID, &originalPost.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds)
94+
return TranslatePostToTweet(originalPost.Thread.Post, originalPost.Thread.Parent.Post.URI, originalPost.Thread.Parent.Post.Author.DID, &originalPost.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds)
9595
}
9696
}(),
9797
})
@@ -130,7 +130,7 @@ func favourite(c *fiber.Ctx) error {
130130
if post.Thread.Parent == nil {
131131
newTweet = TranslatePostToTweet(post.Thread.Post, "", "", nil, nil, *oauthToken, *pds)
132132
} else {
133-
newTweet = TranslatePostToTweet(post.Thread.Post, post.Thread.Parent.URI, post.Thread.Parent.Author.DID, &post.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds)
133+
newTweet = TranslatePostToTweet(post.Thread.Post, post.Thread.Parent.Post.URI, post.Thread.Parent.Post.Author.DID, &post.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds)
134134
}
135135

136136
return c.JSON(newTweet)
@@ -167,7 +167,7 @@ func Unfavourite(c *fiber.Ctx) error { // yes i am canadian
167167
if post.Thread.Parent == nil {
168168
newTweet = TranslatePostToTweet(post.Thread.Post, "", "", nil, nil, *oauthToken, *pds)
169169
} else {
170-
newTweet = TranslatePostToTweet(post.Thread.Post, post.Thread.Parent.URI, post.Thread.Parent.Author.DID, &post.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds)
170+
newTweet = TranslatePostToTweet(post.Thread.Post, post.Thread.Parent.Post.URI, post.Thread.Parent.Post.Author.DID, &post.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds)
171171
}
172172

173173
return c.JSON(newTweet)
@@ -227,7 +227,7 @@ func DeleteTweet(c *fiber.Ctx) error {
227227
if postToDelete.Thread.Parent == nil {
228228
return TranslatePostToTweet(postToDelete.Thread.Post, "", "", nil, nil, *oauthToken, *pds)
229229
} else {
230-
return TranslatePostToTweet(postToDelete.Thread.Post, postToDelete.Thread.Parent.URI, postToDelete.Thread.Parent.Author.DID, &postToDelete.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds)
230+
return TranslatePostToTweet(postToDelete.Thread.Post, postToDelete.Thread.Parent.Post.URI, postToDelete.Thread.Parent.Post.Author.DID, &postToDelete.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds)
231231
}
232232
}(),
233233
)

twitterv1/post_viewing.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func GetStatusFromId(c *fiber.Ctx) error {
184184
if thread.Thread.Parent == nil {
185185
return c.JSON(TranslatePostToTweet(thread.Thread.Post, "", "", nil, nil, *oauthToken, *pds))
186186
} else {
187-
return c.JSON(TranslatePostToTweet(thread.Thread.Post, thread.Thread.Parent.URI, thread.Thread.Parent.Author.DID, &thread.Thread.Parent.Record.CreatedAt, nil, *oauthToken, *pds))
187+
return c.JSON(TranslatePostToTweet(thread.Thread.Post, thread.Thread.Parent.Post.URI, thread.Thread.Parent.Post.Author.DID, &thread.Thread.Parent.Post.Record.CreatedAt, nil, *oauthToken, *pds))
188188
}
189189
}
190190

@@ -369,6 +369,7 @@ func TranslatePostToTweet(tweet blueskyapi.Post, replyMsgBskyURI string, replyUs
369369
}
370370

371371
// This is "depercated"/a togglable option in the config (eventually)
372+
// Primarly used as a fallback if we cannot lookup user info
372373
func GetUserInfoFromTweetData(tweet blueskyapi.Post) bridge.TwitterUser {
373374
return bridge.TwitterUser{
374375
Name: func() string {

0 commit comments

Comments
 (0)