+51
-46
shims/lex/app/bsky/feed/defs/postview.go
+51
-46
shims/lex/app/bsky/feed/defs/postview.go
···
44
44
45
45
lexicontypedecoder := &util.LexiconTypeDecoder{Val: &postRecord}
46
46
47
+
fakeCount := int64(-1)
47
48
links, err := constellation.LegacyLinksAll(ctx, cs, postRecordResponse.Uri)
48
49
var likeCount int64
49
-
if links != nil &&
50
-
links.Links != nil {
51
-
like, ok := links.Links["app.bsky.feed.like"]
52
-
if ok && like != nil {
53
-
subj, ok := like[".subject.uri"]
54
-
if ok {
55
-
likeCount = int64(subj.Records)
50
+
var repostCount int64
51
+
var replyCount int64
52
+
var quoteCount_noEmbed int64
53
+
var quoteCount_withEmbed int64
54
+
var quoteCount int64
55
+
if err == nil {
56
+
if links != nil &&
57
+
links.Links != nil {
58
+
like, ok := links.Links["app.bsky.feed.like"]
59
+
if ok && like != nil {
60
+
subj, ok := like[".subject.uri"]
61
+
if ok {
62
+
likeCount = int64(subj.Records)
63
+
}
56
64
}
57
65
}
58
-
}
59
-
var repostCount int64
60
-
if links != nil &&
61
-
links.Links != nil {
62
-
like, ok := links.Links["app.bsky.repost.like"]
63
-
if ok && like != nil {
64
-
subj, ok := like[".subject.uri"]
65
-
if ok {
66
-
repostCount = int64(subj.Records)
66
+
if links != nil &&
67
+
links.Links != nil {
68
+
like, ok := links.Links["app.bsky.repost.like"]
69
+
if ok && like != nil {
70
+
subj, ok := like[".subject.uri"]
71
+
if ok {
72
+
repostCount = int64(subj.Records)
73
+
}
67
74
}
68
75
}
69
-
}
70
-
var replyCount int64
71
-
if links != nil &&
72
-
links.Links != nil {
73
-
like, ok := links.Links["app.bsky.feed.post"]
74
-
if ok && like != nil {
75
-
subj, ok := like[".reply.parent.uri"]
76
-
if ok {
77
-
replyCount = int64(subj.Records)
76
+
if links != nil &&
77
+
links.Links != nil {
78
+
like, ok := links.Links["app.bsky.feed.post"]
79
+
if ok && like != nil {
80
+
subj, ok := like[".reply.parent.uri"]
81
+
if ok {
82
+
replyCount = int64(subj.Records)
83
+
}
78
84
}
79
85
}
80
-
}
81
-
var quoteCount_noEmbed int64
82
-
if links != nil &&
83
-
links.Links != nil {
84
-
like, ok := links.Links["app.bsky.feed.like"]
85
-
if ok && like != nil {
86
-
subj, ok := like[".embed.record.uri"]
87
-
if ok {
88
-
likeCount = int64(subj.Records)
86
+
if links != nil &&
87
+
links.Links != nil {
88
+
like, ok := links.Links["app.bsky.feed.like"]
89
+
if ok && like != nil {
90
+
subj, ok := like[".embed.record.uri"]
91
+
if ok {
92
+
likeCount = int64(subj.Records)
93
+
}
89
94
}
90
95
}
91
-
}
92
-
var quoteCount_withEmbed int64
93
-
if links != nil &&
94
-
links.Links != nil {
95
-
like, ok := links.Links["app.bsky.feed.like"]
96
-
if ok && like != nil {
97
-
subj, ok := like[".embed.record.record.uri"]
98
-
if ok {
99
-
likeCount = int64(subj.Records)
96
+
if links != nil &&
97
+
links.Links != nil {
98
+
like, ok := links.Links["app.bsky.feed.like"]
99
+
if ok && like != nil {
100
+
subj, ok := like[".embed.record.record.uri"]
101
+
if ok {
102
+
likeCount = int64(subj.Records)
103
+
}
100
104
}
101
105
}
106
+
quoteCount = quoteCount_noEmbed + quoteCount_withEmbed
107
+
} else {
108
+
likeCount, repostCount, replyCount, quoteCount_noEmbed, quoteCount_withEmbed, quoteCount =
109
+
fakeCount, fakeCount, fakeCount, fakeCount, fakeCount, fakeCount
102
110
}
103
-
quoteCount := quoteCount_noEmbed + quoteCount_withEmbed
104
-
105
-
//fakecount := int64(-1)
106
111
107
112
return &appbsky.FeedDefs_PostView{
108
113
// LexiconTypeID string `json:"$type" cborgen:"$type,const=app.bsky.feed.defs#postView"`