tangled
alpha
login
or
join now
ptr.pet
/
at-fronter
6
fork
atom
view who was fronting when a record was made
6
fork
atom
overview
issues
pulls
pipelines
feat: show fronter for grandparent author
ptr.pet
5 months ago
8f4ed1bd
b162e62e
verified
This commit was signed with the committer's
known signature
.
ptr.pet
SSH Key Fingerprint:
SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw=
+22
-15
1 changed file
expand all
collapse all
unified
split
src
entrypoints
background.ts
+22
-15
src/entrypoints/background.ts
···
1
1
-
import { PersistentCache } from "@/lib/cache";
2
1
import { expect } from "@/lib/result";
3
2
import {
4
3
type Fronter,
···
11
10
displayNameCache,
12
11
deleteFronter,
13
12
getPkFronters,
14
14
-
FronterType,
15
13
FronterView,
16
14
} from "@/lib/utils";
17
17
-
import {
18
18
-
ComAtprotoRepoApplyWrites,
19
19
-
ComAtprotoRepoCreateRecord,
20
20
-
} from "@atcute/atproto";
21
21
-
import { createResultSchema } from "@atcute/atproto/types/repo/applyWrites";
15
15
+
import { AppBskyFeedPost } from "@atcute/bluesky";
22
16
import { feedViewPostSchema } from "@atcute/bluesky/types/app/feed/defs";
23
23
-
import {
24
24
-
InferOutput,
25
25
-
is,
26
26
-
parseResourceUri,
27
27
-
ResourceUri,
28
28
-
safeParse,
29
29
-
} from "@atcute/lexicons";
17
17
+
import { is, parseResourceUri, ResourceUri } from "@atcute/lexicons";
30
18
import { AtprotoDid, parseCanonicalResourceUri } from "@atcute/lexicons/syntax";
31
19
32
20
export default defineBackground({
···
172
160
},
173
161
...fronter,
174
162
};
175
175
-
} else if (uri === item.post.uri) {
163
163
+
} else if (
164
164
+
uri === item.post.uri &&
165
165
+
item.reply?.parent.$type === "app.bsky.feed.defs#postView"
166
166
+
) {
176
167
fronter = {
177
168
replyTo: item.reply?.parent.uri,
178
169
...fronter,
179
170
};
171
171
+
} else if (
172
172
+
uri === item.reply?.parent.uri &&
173
173
+
item.reply?.parent.$type === "app.bsky.feed.defs#postView"
174
174
+
) {
175
175
+
fronter = {
176
176
+
replyTo: (item.reply.parent.record as AppBskyFeedPost.Main)
177
177
+
.reply?.parent.uri,
178
178
+
...fronter,
179
179
+
};
180
180
}
181
181
const parsedUri = await cacheFronter(uri, fronter);
182
182
return {
···
191
191
promises.push(handleUri(item.post.uri, "post"));
192
192
if (item.reply?.parent) {
193
193
promises.push(handleUri(item.reply.parent.uri, "post"));
194
194
+
if (item.reply?.parent.$type === "app.bsky.feed.defs#postView") {
195
195
+
const grandparentUri = (
196
196
+
item.reply.parent.record as AppBskyFeedPost.Main
197
197
+
).reply?.parent.uri;
198
198
+
if (grandparentUri)
199
199
+
promises.push(handleUri(grandparentUri, "post"));
200
200
+
}
194
201
}
195
202
if (item.reply?.root) {
196
203
promises.push(handleUri(item.reply.root.uri, "post"));