@atproto/bsky 0.0.48 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/api/app/bsky/actor/getSuggestions.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getSuggestions.js +3 -0
- package/dist/api/app/bsky/actor/getSuggestions.js.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.d.ts +2 -4
- package/dist/api/app/bsky/feed/getFeed.d.ts.map +1 -1
- package/dist/api/app/bsky/feed/getFeed.js +17 -13
- package/dist/api/app/bsky/feed/getFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getListFeed.js +1 -1
- package/dist/api/app/bsky/feed/getListFeed.js.map +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js +1 -1
- package/dist/api/app/bsky/feed/getTimeline.js.map +1 -1
- package/dist/auth-verifier.d.ts +2 -0
- package/dist/auth-verifier.d.ts.map +1 -1
- package/dist/auth-verifier.js +14 -1
- package/dist/auth-verifier.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/hydration/hydrator.d.ts.map +1 -1
- package/dist/hydration/hydrator.js +25 -9
- package/dist/hydration/hydrator.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +5 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +5 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/views/index.d.ts +3 -6
- package/dist/views/index.d.ts.map +1 -1
- package/dist/views/index.js +16 -4
- package/dist/views/index.js.map +1 -1
- package/package.json +4 -4
- package/src/api/app/bsky/actor/getSuggestions.ts +3 -0
- package/src/api/app/bsky/feed/getFeed.ts +20 -18
- package/src/api/app/bsky/feed/getListFeed.ts +1 -1
- package/src/api/app/bsky/feed/getTimeline.ts +1 -1
- package/src/auth-verifier.ts +13 -1
- package/src/config.ts +9 -0
- package/src/hydration/hydrator.ts +33 -9
- package/src/index.ts +1 -0
- package/src/lexicon/lexicons.ts +6 -0
- package/src/lexicon/types/app/bsky/feed/defs.ts +1 -0
- package/src/views/index.ts +24 -6
- package/tests/__snapshots__/feed-generation.test.ts.snap +11 -0
- package/tests/data-plane/__snapshots__/indexing.test.ts.snap +9 -0
- package/tests/feed-generation.test.ts +1 -1
- package/tests/views/__snapshots__/author-feed.test.ts.snap +81 -0
- package/tests/views/__snapshots__/blocks.test.ts.snap +40 -2
- package/tests/views/__snapshots__/list-feed.test.ts.snap +28 -0
- package/tests/views/__snapshots__/timeline.test.ts.snap +135 -0
- package/tests/views/author-feed.test.ts +9 -1
- package/tests/views/blocks.test.ts +11 -3
- package/tests/views/list-feed.test.ts +9 -1
package/src/views/index.ts
CHANGED
|
@@ -16,10 +16,12 @@ import {
|
|
|
16
16
|
NotFoundPost,
|
|
17
17
|
PostView,
|
|
18
18
|
ReasonRepost,
|
|
19
|
+
ReplyRef,
|
|
19
20
|
ThreadViewPost,
|
|
20
21
|
ThreadgateView,
|
|
21
22
|
isPostView,
|
|
22
23
|
} from '../lexicon/types/app/bsky/feed/defs'
|
|
24
|
+
import { isRecord as isPostRecord } from '../lexicon/types/app/bsky/feed/post'
|
|
23
25
|
import { ListView, ListViewBasic } from '../lexicon/types/app/bsky/graph/defs'
|
|
24
26
|
import { creatorFromUri, parseThreadGate, cidFromBlobJson } from './util'
|
|
25
27
|
import { isListRule } from '../lexicon/types/app/bsky/feed/threadgate'
|
|
@@ -334,7 +336,7 @@ export class Views {
|
|
|
334
336
|
originatorBlocked: boolean
|
|
335
337
|
authorMuted: boolean
|
|
336
338
|
authorBlocked: boolean
|
|
337
|
-
|
|
339
|
+
ancestorAuthorBlocked: boolean
|
|
338
340
|
} {
|
|
339
341
|
const authorDid = creatorFromUri(item.post.uri)
|
|
340
342
|
const originatorDid = item.repost
|
|
@@ -343,14 +345,19 @@ export class Views {
|
|
|
343
345
|
const post = state.posts?.get(item.post.uri)
|
|
344
346
|
const parentUri = post?.record.reply?.parent.uri
|
|
345
347
|
const parentAuthorDid = parentUri && creatorFromUri(parentUri)
|
|
348
|
+
const parent = parentUri ? state.posts?.get(parentUri) : undefined
|
|
349
|
+
const grandparentUri = parent?.record.reply?.parent.uri
|
|
350
|
+
const grandparentAuthorDid =
|
|
351
|
+
grandparentUri && creatorFromUri(grandparentUri)
|
|
346
352
|
return {
|
|
347
353
|
originatorMuted: this.viewerMuteExists(originatorDid, state),
|
|
348
354
|
originatorBlocked: this.viewerBlockExists(originatorDid, state),
|
|
349
355
|
authorMuted: this.viewerMuteExists(authorDid, state),
|
|
350
356
|
authorBlocked: this.viewerBlockExists(authorDid, state),
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
357
|
+
ancestorAuthorBlocked:
|
|
358
|
+
(!!parentAuthorDid && this.viewerBlockExists(parentAuthorDid, state)) ||
|
|
359
|
+
(!!grandparentAuthorDid &&
|
|
360
|
+
this.viewerBlockExists(grandparentAuthorDid, state)),
|
|
354
361
|
}
|
|
355
362
|
}
|
|
356
363
|
|
|
@@ -477,7 +484,7 @@ export class Views {
|
|
|
477
484
|
}
|
|
478
485
|
}
|
|
479
486
|
|
|
480
|
-
replyRef(uri: string, state: HydrationState) {
|
|
487
|
+
replyRef(uri: string, state: HydrationState): ReplyRef | undefined {
|
|
481
488
|
const postRecord = state.posts?.get(uri.toString())?.record
|
|
482
489
|
if (!postRecord?.reply) return
|
|
483
490
|
let root = this.maybePost(postRecord.reply.root.uri, state)
|
|
@@ -489,7 +496,18 @@ export class Views {
|
|
|
489
496
|
root = parent
|
|
490
497
|
}
|
|
491
498
|
}
|
|
492
|
-
|
|
499
|
+
let grandparentAuthor: ProfileViewBasic | undefined
|
|
500
|
+
if (isPostRecord(parent.record) && parent.record.reply) {
|
|
501
|
+
grandparentAuthor = this.profileBasic(
|
|
502
|
+
creatorFromUri(parent.record.reply.parent.uri),
|
|
503
|
+
state,
|
|
504
|
+
)
|
|
505
|
+
}
|
|
506
|
+
return {
|
|
507
|
+
root,
|
|
508
|
+
parent,
|
|
509
|
+
grandparentAuthor,
|
|
510
|
+
}
|
|
493
511
|
}
|
|
494
512
|
|
|
495
513
|
maybePost(uri: string, state: HydrationState): MaybePostView {
|
|
@@ -342,6 +342,7 @@ Array [
|
|
|
342
342
|
exports[`feed generation getFeed paginates, handling replies and reposts. 1`] = `
|
|
343
343
|
Array [
|
|
344
344
|
Object {
|
|
345
|
+
"feedContext": "item-0",
|
|
345
346
|
"post": Object {
|
|
346
347
|
"author": Object {
|
|
347
348
|
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
@@ -401,6 +402,7 @@ Array [
|
|
|
401
402
|
},
|
|
402
403
|
},
|
|
403
404
|
Object {
|
|
405
|
+
"feedContext": "item-1",
|
|
404
406
|
"post": Object {
|
|
405
407
|
"author": Object {
|
|
406
408
|
"avatar": "https://bsky.public.url/img/avatar/plain/user(3)/cids(1)@jpeg",
|
|
@@ -435,6 +437,7 @@ Array [
|
|
|
435
437
|
},
|
|
436
438
|
},
|
|
437
439
|
Object {
|
|
440
|
+
"feedContext": "item-2",
|
|
438
441
|
"post": Object {
|
|
439
442
|
"author": Object {
|
|
440
443
|
"did": "user(4)",
|
|
@@ -554,6 +557,7 @@ Array [
|
|
|
554
557
|
},
|
|
555
558
|
},
|
|
556
559
|
Object {
|
|
560
|
+
"feedContext": "item-4",
|
|
557
561
|
"post": Object {
|
|
558
562
|
"author": Object {
|
|
559
563
|
"did": "user(4)",
|
|
@@ -678,6 +682,7 @@ Array [
|
|
|
678
682
|
},
|
|
679
683
|
},
|
|
680
684
|
Object {
|
|
685
|
+
"feedContext": "item-5",
|
|
681
686
|
"post": Object {
|
|
682
687
|
"author": Object {
|
|
683
688
|
"did": "user(6)",
|
|
@@ -865,6 +870,7 @@ Array [
|
|
|
865
870
|
exports[`feed generation getFeed resolves basic feed contents without auth. 1`] = `
|
|
866
871
|
Array [
|
|
867
872
|
Object {
|
|
873
|
+
"feedContext": "item-0",
|
|
868
874
|
"post": Object {
|
|
869
875
|
"author": Object {
|
|
870
876
|
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
@@ -919,6 +925,7 @@ Array [
|
|
|
919
925
|
},
|
|
920
926
|
},
|
|
921
927
|
Object {
|
|
928
|
+
"feedContext": "item-2",
|
|
922
929
|
"post": Object {
|
|
923
930
|
"author": Object {
|
|
924
931
|
"did": "user(2)",
|
|
@@ -1023,6 +1030,7 @@ Array [
|
|
|
1023
1030
|
},
|
|
1024
1031
|
},
|
|
1025
1032
|
Object {
|
|
1033
|
+
"feedContext": "item-4",
|
|
1026
1034
|
"post": Object {
|
|
1027
1035
|
"author": Object {
|
|
1028
1036
|
"did": "user(2)",
|
|
@@ -1135,6 +1143,7 @@ Array [
|
|
|
1135
1143
|
exports[`feed generation getFeed resolves basic feed contents. 1`] = `
|
|
1136
1144
|
Array [
|
|
1137
1145
|
Object {
|
|
1146
|
+
"feedContext": "item-0",
|
|
1138
1147
|
"post": Object {
|
|
1139
1148
|
"author": Object {
|
|
1140
1149
|
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
@@ -1194,6 +1203,7 @@ Array [
|
|
|
1194
1203
|
},
|
|
1195
1204
|
},
|
|
1196
1205
|
Object {
|
|
1206
|
+
"feedContext": "item-2",
|
|
1197
1207
|
"post": Object {
|
|
1198
1208
|
"author": Object {
|
|
1199
1209
|
"did": "user(2)",
|
|
@@ -1313,6 +1323,7 @@ Array [
|
|
|
1313
1323
|
},
|
|
1314
1324
|
},
|
|
1315
1325
|
Object {
|
|
1326
|
+
"feedContext": "item-4",
|
|
1316
1327
|
"post": Object {
|
|
1317
1328
|
"author": Object {
|
|
1318
1329
|
"did": "user(2)",
|
|
@@ -86,6 +86,15 @@ Array [
|
|
|
86
86
|
"viewer": Object {},
|
|
87
87
|
},
|
|
88
88
|
"reply": Object {
|
|
89
|
+
"grandparentAuthor": Object {
|
|
90
|
+
"did": "user(0)",
|
|
91
|
+
"handle": "alice.test",
|
|
92
|
+
"labels": Array [],
|
|
93
|
+
"viewer": Object {
|
|
94
|
+
"blockedBy": false,
|
|
95
|
+
"muted": false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
89
98
|
"parent": Object {
|
|
90
99
|
"$type": "app.bsky.feed.defs#postView",
|
|
91
100
|
"author": Object {
|
|
@@ -543,7 +543,7 @@ describe('feed generation', () => {
|
|
|
543
543
|
repost: sc.reposts[sc.dids.carol][0].uriStr,
|
|
544
544
|
},
|
|
545
545
|
},
|
|
546
|
-
]
|
|
546
|
+
].map((item, i) => ({ ...item, feedContext: `item-${i}` })) // add a deterministic context to test passthrough
|
|
547
547
|
const offset = cursor ? parseInt(cursor, 10) : 0
|
|
548
548
|
const fullFeed = candidates.filter((_, i) => {
|
|
549
549
|
if (feedName === 'even') {
|
|
@@ -55,6 +55,32 @@ Array [
|
|
|
55
55
|
"viewer": Object {},
|
|
56
56
|
},
|
|
57
57
|
"reply": Object {
|
|
58
|
+
"grandparentAuthor": Object {
|
|
59
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
60
|
+
"did": "user(0)",
|
|
61
|
+
"displayName": "ali",
|
|
62
|
+
"handle": "alice.test",
|
|
63
|
+
"labels": Array [
|
|
64
|
+
Object {
|
|
65
|
+
"cid": "cids(2)",
|
|
66
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
67
|
+
"src": "user(0)",
|
|
68
|
+
"uri": "record(1)",
|
|
69
|
+
"val": "self-label-a",
|
|
70
|
+
},
|
|
71
|
+
Object {
|
|
72
|
+
"cid": "cids(2)",
|
|
73
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
74
|
+
"src": "user(0)",
|
|
75
|
+
"uri": "record(1)",
|
|
76
|
+
"val": "self-label-b",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
"viewer": Object {
|
|
80
|
+
"blockedBy": false,
|
|
81
|
+
"muted": false,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
58
84
|
"parent": Object {
|
|
59
85
|
"$type": "app.bsky.feed.defs#postView",
|
|
60
86
|
"author": Object {
|
|
@@ -1194,6 +1220,33 @@ Array [
|
|
|
1194
1220
|
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
1195
1221
|
},
|
|
1196
1222
|
"reply": Object {
|
|
1223
|
+
"grandparentAuthor": Object {
|
|
1224
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
1225
|
+
"did": "user(0)",
|
|
1226
|
+
"displayName": "ali",
|
|
1227
|
+
"handle": "alice.test",
|
|
1228
|
+
"labels": Array [
|
|
1229
|
+
Object {
|
|
1230
|
+
"cid": "cids(2)",
|
|
1231
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1232
|
+
"src": "user(0)",
|
|
1233
|
+
"uri": "record(2)",
|
|
1234
|
+
"val": "self-label-a",
|
|
1235
|
+
},
|
|
1236
|
+
Object {
|
|
1237
|
+
"cid": "cids(2)",
|
|
1238
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1239
|
+
"src": "user(0)",
|
|
1240
|
+
"uri": "record(2)",
|
|
1241
|
+
"val": "self-label-b",
|
|
1242
|
+
},
|
|
1243
|
+
],
|
|
1244
|
+
"viewer": Object {
|
|
1245
|
+
"blockedBy": false,
|
|
1246
|
+
"followedBy": "record(1)",
|
|
1247
|
+
"muted": false,
|
|
1248
|
+
},
|
|
1249
|
+
},
|
|
1197
1250
|
"parent": Object {
|
|
1198
1251
|
"$type": "app.bsky.feed.defs#postView",
|
|
1199
1252
|
"author": Object {
|
|
@@ -1630,6 +1683,34 @@ Array [
|
|
|
1630
1683
|
"viewer": Object {},
|
|
1631
1684
|
},
|
|
1632
1685
|
"reply": Object {
|
|
1686
|
+
"grandparentAuthor": Object {
|
|
1687
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
1688
|
+
"did": "user(0)",
|
|
1689
|
+
"displayName": "ali",
|
|
1690
|
+
"handle": "alice.test",
|
|
1691
|
+
"labels": Array [
|
|
1692
|
+
Object {
|
|
1693
|
+
"cid": "cids(2)",
|
|
1694
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1695
|
+
"src": "user(0)",
|
|
1696
|
+
"uri": "record(3)",
|
|
1697
|
+
"val": "self-label-a",
|
|
1698
|
+
},
|
|
1699
|
+
Object {
|
|
1700
|
+
"cid": "cids(2)",
|
|
1701
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1702
|
+
"src": "user(0)",
|
|
1703
|
+
"uri": "record(3)",
|
|
1704
|
+
"val": "self-label-b",
|
|
1705
|
+
},
|
|
1706
|
+
],
|
|
1707
|
+
"viewer": Object {
|
|
1708
|
+
"blockedBy": false,
|
|
1709
|
+
"followedBy": "record(2)",
|
|
1710
|
+
"following": "record(1)",
|
|
1711
|
+
"muted": false,
|
|
1712
|
+
},
|
|
1713
|
+
},
|
|
1633
1714
|
"parent": Object {
|
|
1634
1715
|
"$type": "app.bsky.feed.defs#postView",
|
|
1635
1716
|
"author": Object {
|
|
@@ -193,12 +193,50 @@ Object {
|
|
|
193
193
|
},
|
|
194
194
|
"text": "alice replies to dan",
|
|
195
195
|
},
|
|
196
|
-
"replyCount":
|
|
196
|
+
"replyCount": 1,
|
|
197
197
|
"repostCount": 0,
|
|
198
198
|
"uri": "record(0)",
|
|
199
199
|
"viewer": Object {},
|
|
200
200
|
},
|
|
201
|
-
"replies": Array [
|
|
201
|
+
"replies": Array [
|
|
202
|
+
Object {
|
|
203
|
+
"$type": "app.bsky.feed.defs#threadViewPost",
|
|
204
|
+
"post": Object {
|
|
205
|
+
"author": Object {
|
|
206
|
+
"did": "user(3)",
|
|
207
|
+
"handle": "carol.test",
|
|
208
|
+
"labels": Array [],
|
|
209
|
+
"viewer": Object {
|
|
210
|
+
"blockedBy": false,
|
|
211
|
+
"muted": false,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
"cid": "cids(4)",
|
|
215
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
216
|
+
"labels": Array [],
|
|
217
|
+
"likeCount": 0,
|
|
218
|
+
"record": Object {
|
|
219
|
+
"$type": "app.bsky.feed.post",
|
|
220
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
221
|
+
"reply": Object {
|
|
222
|
+
"parent": Object {
|
|
223
|
+
"cid": "cids(0)",
|
|
224
|
+
"uri": "record(0)",
|
|
225
|
+
},
|
|
226
|
+
"root": Object {
|
|
227
|
+
"cid": "cids(3)",
|
|
228
|
+
"uri": "record(4)",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
"text": "carol replies to alice's reply to dan",
|
|
232
|
+
},
|
|
233
|
+
"replyCount": 0,
|
|
234
|
+
"repostCount": 0,
|
|
235
|
+
"uri": "record(5)",
|
|
236
|
+
"viewer": Object {},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
],
|
|
202
240
|
},
|
|
203
241
|
}
|
|
204
242
|
`;
|
|
@@ -57,6 +57,34 @@ Array [
|
|
|
57
57
|
"viewer": Object {},
|
|
58
58
|
},
|
|
59
59
|
"reply": Object {
|
|
60
|
+
"grandparentAuthor": Object {
|
|
61
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
62
|
+
"did": "user(0)",
|
|
63
|
+
"displayName": "ali",
|
|
64
|
+
"handle": "alice.test",
|
|
65
|
+
"labels": Array [
|
|
66
|
+
Object {
|
|
67
|
+
"cid": "cids(2)",
|
|
68
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
69
|
+
"src": "user(0)",
|
|
70
|
+
"uri": "record(3)",
|
|
71
|
+
"val": "self-label-a",
|
|
72
|
+
},
|
|
73
|
+
Object {
|
|
74
|
+
"cid": "cids(2)",
|
|
75
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
76
|
+
"src": "user(0)",
|
|
77
|
+
"uri": "record(3)",
|
|
78
|
+
"val": "self-label-b",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
"viewer": Object {
|
|
82
|
+
"blockedBy": false,
|
|
83
|
+
"followedBy": "record(2)",
|
|
84
|
+
"following": "record(1)",
|
|
85
|
+
"muted": false,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
60
88
|
"parent": Object {
|
|
61
89
|
"$type": "app.bsky.feed.defs#postView",
|
|
62
90
|
"author": Object {
|
|
@@ -1457,6 +1457,32 @@ Array [
|
|
|
1457
1457
|
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
1458
1458
|
},
|
|
1459
1459
|
"reply": Object {
|
|
1460
|
+
"grandparentAuthor": Object {
|
|
1461
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
1462
|
+
"did": "user(0)",
|
|
1463
|
+
"displayName": "ali",
|
|
1464
|
+
"handle": "alice.test",
|
|
1465
|
+
"labels": Array [
|
|
1466
|
+
Object {
|
|
1467
|
+
"cid": "cids(2)",
|
|
1468
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1469
|
+
"src": "user(0)",
|
|
1470
|
+
"uri": "record(1)",
|
|
1471
|
+
"val": "self-label-a",
|
|
1472
|
+
},
|
|
1473
|
+
Object {
|
|
1474
|
+
"cid": "cids(2)",
|
|
1475
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1476
|
+
"src": "user(0)",
|
|
1477
|
+
"uri": "record(1)",
|
|
1478
|
+
"val": "self-label-b",
|
|
1479
|
+
},
|
|
1480
|
+
],
|
|
1481
|
+
"viewer": Object {
|
|
1482
|
+
"blockedBy": false,
|
|
1483
|
+
"muted": false,
|
|
1484
|
+
},
|
|
1485
|
+
},
|
|
1460
1486
|
"parent": Object {
|
|
1461
1487
|
"$type": "app.bsky.feed.defs#postView",
|
|
1462
1488
|
"author": Object {
|
|
@@ -1889,6 +1915,32 @@ Array [
|
|
|
1889
1915
|
"viewer": Object {},
|
|
1890
1916
|
},
|
|
1891
1917
|
"reply": Object {
|
|
1918
|
+
"grandparentAuthor": Object {
|
|
1919
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
1920
|
+
"did": "user(0)",
|
|
1921
|
+
"displayName": "ali",
|
|
1922
|
+
"handle": "alice.test",
|
|
1923
|
+
"labels": Array [
|
|
1924
|
+
Object {
|
|
1925
|
+
"cid": "cids(2)",
|
|
1926
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1927
|
+
"src": "user(0)",
|
|
1928
|
+
"uri": "record(1)",
|
|
1929
|
+
"val": "self-label-a",
|
|
1930
|
+
},
|
|
1931
|
+
Object {
|
|
1932
|
+
"cid": "cids(2)",
|
|
1933
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
1934
|
+
"src": "user(0)",
|
|
1935
|
+
"uri": "record(1)",
|
|
1936
|
+
"val": "self-label-b",
|
|
1937
|
+
},
|
|
1938
|
+
],
|
|
1939
|
+
"viewer": Object {
|
|
1940
|
+
"blockedBy": false,
|
|
1941
|
+
"muted": false,
|
|
1942
|
+
},
|
|
1943
|
+
},
|
|
1892
1944
|
"parent": Object {
|
|
1893
1945
|
"$type": "app.bsky.feed.defs#postView",
|
|
1894
1946
|
"author": Object {
|
|
@@ -3259,6 +3311,34 @@ Array [
|
|
|
3259
3311
|
"viewer": Object {},
|
|
3260
3312
|
},
|
|
3261
3313
|
"reply": Object {
|
|
3314
|
+
"grandparentAuthor": Object {
|
|
3315
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(6)/cids(5)@jpeg",
|
|
3316
|
+
"did": "user(1)",
|
|
3317
|
+
"displayName": "ali",
|
|
3318
|
+
"handle": "alice.test",
|
|
3319
|
+
"labels": Array [
|
|
3320
|
+
Object {
|
|
3321
|
+
"cid": "cids(7)",
|
|
3322
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
3323
|
+
"src": "user(1)",
|
|
3324
|
+
"uri": "record(8)",
|
|
3325
|
+
"val": "self-label-a",
|
|
3326
|
+
},
|
|
3327
|
+
Object {
|
|
3328
|
+
"cid": "cids(7)",
|
|
3329
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
3330
|
+
"src": "user(1)",
|
|
3331
|
+
"uri": "record(8)",
|
|
3332
|
+
"val": "self-label-b",
|
|
3333
|
+
},
|
|
3334
|
+
],
|
|
3335
|
+
"viewer": Object {
|
|
3336
|
+
"blockedBy": false,
|
|
3337
|
+
"followedBy": "record(7)",
|
|
3338
|
+
"following": "record(6)",
|
|
3339
|
+
"muted": false,
|
|
3340
|
+
},
|
|
3341
|
+
},
|
|
3262
3342
|
"parent": Object {
|
|
3263
3343
|
"$type": "app.bsky.feed.defs#postView",
|
|
3264
3344
|
"author": Object {
|
|
@@ -4436,6 +4516,34 @@ Array [
|
|
|
4436
4516
|
"viewer": Object {},
|
|
4437
4517
|
},
|
|
4438
4518
|
"reply": Object {
|
|
4519
|
+
"grandparentAuthor": Object {
|
|
4520
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(6)/cids(5)@jpeg",
|
|
4521
|
+
"did": "user(1)",
|
|
4522
|
+
"displayName": "ali",
|
|
4523
|
+
"handle": "alice.test",
|
|
4524
|
+
"labels": Array [
|
|
4525
|
+
Object {
|
|
4526
|
+
"cid": "cids(7)",
|
|
4527
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
4528
|
+
"src": "user(1)",
|
|
4529
|
+
"uri": "record(8)",
|
|
4530
|
+
"val": "self-label-a",
|
|
4531
|
+
},
|
|
4532
|
+
Object {
|
|
4533
|
+
"cid": "cids(7)",
|
|
4534
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
4535
|
+
"src": "user(1)",
|
|
4536
|
+
"uri": "record(8)",
|
|
4537
|
+
"val": "self-label-b",
|
|
4538
|
+
},
|
|
4539
|
+
],
|
|
4540
|
+
"viewer": Object {
|
|
4541
|
+
"blockedBy": false,
|
|
4542
|
+
"followedBy": "record(7)",
|
|
4543
|
+
"following": "record(6)",
|
|
4544
|
+
"muted": false,
|
|
4545
|
+
},
|
|
4546
|
+
},
|
|
4439
4547
|
"parent": Object {
|
|
4440
4548
|
"$type": "app.bsky.feed.defs#postView",
|
|
4441
4549
|
"author": Object {
|
|
@@ -5188,6 +5296,33 @@ Array [
|
|
|
5188
5296
|
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
5189
5297
|
},
|
|
5190
5298
|
"reply": Object {
|
|
5299
|
+
"grandparentAuthor": Object {
|
|
5300
|
+
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg",
|
|
5301
|
+
"did": "user(0)",
|
|
5302
|
+
"displayName": "ali",
|
|
5303
|
+
"handle": "alice.test",
|
|
5304
|
+
"labels": Array [
|
|
5305
|
+
Object {
|
|
5306
|
+
"cid": "cids(2)",
|
|
5307
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
5308
|
+
"src": "user(0)",
|
|
5309
|
+
"uri": "record(2)",
|
|
5310
|
+
"val": "self-label-a",
|
|
5311
|
+
},
|
|
5312
|
+
Object {
|
|
5313
|
+
"cid": "cids(2)",
|
|
5314
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
5315
|
+
"src": "user(0)",
|
|
5316
|
+
"uri": "record(2)",
|
|
5317
|
+
"val": "self-label-b",
|
|
5318
|
+
},
|
|
5319
|
+
],
|
|
5320
|
+
"viewer": Object {
|
|
5321
|
+
"blockedBy": false,
|
|
5322
|
+
"followedBy": "record(1)",
|
|
5323
|
+
"muted": false,
|
|
5324
|
+
},
|
|
5325
|
+
},
|
|
5191
5326
|
"parent": Object {
|
|
5192
5327
|
"$type": "app.bsky.feed.defs#postView",
|
|
5193
5328
|
"author": Object {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import AtpAgent, { AtUri } from '@atproto/api'
|
|
2
2
|
import { TestNetwork, SeedClient, authorFeedSeed } from '@atproto/dev-env'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
forSnapshot,
|
|
5
|
+
paginateAll,
|
|
6
|
+
stripViewer,
|
|
7
|
+
stripViewerFromPost,
|
|
8
|
+
} from '../_util'
|
|
4
9
|
import { ReplyRef, isRecord } from '../../src/lexicon/types/app/bsky/feed/post'
|
|
5
10
|
import { isView as isEmbedRecordWithMedia } from '../../src/lexicon/types/app/bsky/embed/recordWithMedia'
|
|
6
11
|
import { isView as isImageEmbed } from '../../src/lexicon/types/app/bsky/embed/images'
|
|
@@ -132,6 +137,9 @@ describe('pds author feed views', () => {
|
|
|
132
137
|
result.reply = {
|
|
133
138
|
parent: stripViewerFromPost(item.reply.parent),
|
|
134
139
|
root: stripViewerFromPost(item.reply.root),
|
|
140
|
+
grandparentAuthor:
|
|
141
|
+
item.reply.grandparentAuthor &&
|
|
142
|
+
stripViewer(item.reply.grandparentAuthor),
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
return result
|
|
@@ -37,6 +37,12 @@ describe('pds views with blocking', () => {
|
|
|
37
37
|
sc.posts[dan][0].ref,
|
|
38
38
|
'alice replies to dan',
|
|
39
39
|
)
|
|
40
|
+
const _carolReplyToAliceReplyToDan = await sc.reply(
|
|
41
|
+
carol,
|
|
42
|
+
sc.posts[dan][0].ref,
|
|
43
|
+
aliceReplyToDan.ref,
|
|
44
|
+
"carol replies to alice's reply to dan",
|
|
45
|
+
)
|
|
40
46
|
carolReplyToDan = await sc.reply(
|
|
41
47
|
carol,
|
|
42
48
|
sc.posts[dan][0].ref,
|
|
@@ -161,12 +167,13 @@ describe('pds views with blocking', () => {
|
|
|
161
167
|
{ headers: await network.serviceHeaders(carol) },
|
|
162
168
|
)
|
|
163
169
|
|
|
164
|
-
// dan's posts don't appear, nor alice's reply to dan
|
|
170
|
+
// dan's posts don't appear, nor alice's reply to dan, nor carol's reply to alice (which was a reply to dan)
|
|
165
171
|
expect(
|
|
166
172
|
resCarol.data.feed.some(
|
|
167
173
|
(post) =>
|
|
168
174
|
post.post.author.did === dan ||
|
|
169
|
-
post.reply?.parent.author?.['did'] === dan
|
|
175
|
+
post.reply?.parent.author?.['did'] === dan ||
|
|
176
|
+
post.reply?.grandparentAuthor?.did === dan,
|
|
170
177
|
),
|
|
171
178
|
).toBeFalsy()
|
|
172
179
|
|
|
@@ -178,7 +185,8 @@ describe('pds views with blocking', () => {
|
|
|
178
185
|
resDan.data.feed.some(
|
|
179
186
|
(post) =>
|
|
180
187
|
post.post.author.did === carol ||
|
|
181
|
-
post.reply?.parent.author?.['did'] === carol
|
|
188
|
+
post.reply?.parent.author?.['did'] === carol ||
|
|
189
|
+
post.reply?.grandparentAuthor?.did === carol,
|
|
182
190
|
),
|
|
183
191
|
).toBeFalsy()
|
|
184
192
|
})
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
2
|
import { TestNetwork, SeedClient, RecordRef, basicSeed } from '@atproto/dev-env'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
forSnapshot,
|
|
5
|
+
paginateAll,
|
|
6
|
+
stripViewer,
|
|
7
|
+
stripViewerFromPost,
|
|
8
|
+
} from '../_util'
|
|
4
9
|
|
|
5
10
|
describe('list feed views', () => {
|
|
6
11
|
let network: TestNetwork
|
|
@@ -94,6 +99,9 @@ describe('list feed views', () => {
|
|
|
94
99
|
result.reply = {
|
|
95
100
|
parent: stripViewerFromPost(item.reply.parent),
|
|
96
101
|
root: stripViewerFromPost(item.reply.root),
|
|
102
|
+
grandparentAuthor:
|
|
103
|
+
item.reply.grandparentAuthor &&
|
|
104
|
+
stripViewer(item.reply.grandparentAuthor),
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
return result
|