tangled
alpha
login
or
join now
whey.party
/
red-dwarf-server
13
fork
atom
collection of golang services under the Red Dwarf umbrella
server.reddwarf.app
bluesky
reddwarf
microcosm
appview
13
fork
atom
overview
issues
pulls
pipelines
PostView use the err duhh
whey.party
3 months ago
2af84a81
aae22890
+51
-46
1 changed file
expand all
collapse all
unified
split
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
47
+
fakeCount := int64(-1)
47
48
links, err := constellation.LegacyLinksAll(ctx, cs, postRecordResponse.Uri)
48
49
var likeCount int64
49
49
-
if links != nil &&
50
50
-
links.Links != nil {
51
51
-
like, ok := links.Links["app.bsky.feed.like"]
52
52
-
if ok && like != nil {
53
53
-
subj, ok := like[".subject.uri"]
54
54
-
if ok {
55
55
-
likeCount = int64(subj.Records)
50
50
+
var repostCount int64
51
51
+
var replyCount int64
52
52
+
var quoteCount_noEmbed int64
53
53
+
var quoteCount_withEmbed int64
54
54
+
var quoteCount int64
55
55
+
if err == nil {
56
56
+
if links != nil &&
57
57
+
links.Links != nil {
58
58
+
like, ok := links.Links["app.bsky.feed.like"]
59
59
+
if ok && like != nil {
60
60
+
subj, ok := like[".subject.uri"]
61
61
+
if ok {
62
62
+
likeCount = int64(subj.Records)
63
63
+
}
56
64
}
57
65
}
58
58
-
}
59
59
-
var repostCount int64
60
60
-
if links != nil &&
61
61
-
links.Links != nil {
62
62
-
like, ok := links.Links["app.bsky.repost.like"]
63
63
-
if ok && like != nil {
64
64
-
subj, ok := like[".subject.uri"]
65
65
-
if ok {
66
66
-
repostCount = int64(subj.Records)
66
66
+
if links != nil &&
67
67
+
links.Links != nil {
68
68
+
like, ok := links.Links["app.bsky.repost.like"]
69
69
+
if ok && like != nil {
70
70
+
subj, ok := like[".subject.uri"]
71
71
+
if ok {
72
72
+
repostCount = int64(subj.Records)
73
73
+
}
67
74
}
68
75
}
69
69
-
}
70
70
-
var replyCount int64
71
71
-
if links != nil &&
72
72
-
links.Links != nil {
73
73
-
like, ok := links.Links["app.bsky.feed.post"]
74
74
-
if ok && like != nil {
75
75
-
subj, ok := like[".reply.parent.uri"]
76
76
-
if ok {
77
77
-
replyCount = int64(subj.Records)
76
76
+
if links != nil &&
77
77
+
links.Links != nil {
78
78
+
like, ok := links.Links["app.bsky.feed.post"]
79
79
+
if ok && like != nil {
80
80
+
subj, ok := like[".reply.parent.uri"]
81
81
+
if ok {
82
82
+
replyCount = int64(subj.Records)
83
83
+
}
78
84
}
79
85
}
80
80
-
}
81
81
-
var quoteCount_noEmbed int64
82
82
-
if links != nil &&
83
83
-
links.Links != nil {
84
84
-
like, ok := links.Links["app.bsky.feed.like"]
85
85
-
if ok && like != nil {
86
86
-
subj, ok := like[".embed.record.uri"]
87
87
-
if ok {
88
88
-
likeCount = int64(subj.Records)
86
86
+
if links != nil &&
87
87
+
links.Links != nil {
88
88
+
like, ok := links.Links["app.bsky.feed.like"]
89
89
+
if ok && like != nil {
90
90
+
subj, ok := like[".embed.record.uri"]
91
91
+
if ok {
92
92
+
likeCount = int64(subj.Records)
93
93
+
}
89
94
}
90
95
}
91
91
-
}
92
92
-
var quoteCount_withEmbed int64
93
93
-
if links != nil &&
94
94
-
links.Links != nil {
95
95
-
like, ok := links.Links["app.bsky.feed.like"]
96
96
-
if ok && like != nil {
97
97
-
subj, ok := like[".embed.record.record.uri"]
98
98
-
if ok {
99
99
-
likeCount = int64(subj.Records)
96
96
+
if links != nil &&
97
97
+
links.Links != nil {
98
98
+
like, ok := links.Links["app.bsky.feed.like"]
99
99
+
if ok && like != nil {
100
100
+
subj, ok := like[".embed.record.record.uri"]
101
101
+
if ok {
102
102
+
likeCount = int64(subj.Records)
103
103
+
}
100
104
}
101
105
}
106
106
+
quoteCount = quoteCount_noEmbed + quoteCount_withEmbed
107
107
+
} else {
108
108
+
likeCount, repostCount, replyCount, quoteCount_noEmbed, quoteCount_withEmbed, quoteCount =
109
109
+
fakeCount, fakeCount, fakeCount, fakeCount, fakeCount, fakeCount
102
110
}
103
103
-
quoteCount := quoteCount_noEmbed + quoteCount_withEmbed
104
104
-
105
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"`