@pkcprotocol/pkc-js 0.0.156 → 0.0.158
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/README.md +55 -3
- package/dist/browser/clients/base-client-manager.js +10 -1
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
- package/dist/browser/clients/shared-pubsub-topic-list.d.ts +14 -0
- package/dist/browser/clients/shared-pubsub-topic-list.js +61 -0
- package/dist/browser/clients/shared-pubsub-topic-list.js.map +1 -0
- package/dist/browser/community/schema.d.ts +13 -0
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +2 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/pages/schema.d.ts +3 -0
- package/dist/browser/publications/comment/comment.d.ts +1 -0
- package/dist/browser/publications/comment/comment.js +1 -0
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/comment/schema.d.ts +4 -2
- package/dist/browser/publications/comment/schema.js +2 -0
- package/dist/browser/publications/comment/schema.js.map +1 -1
- package/dist/browser/publications/comment-moderation/schema.js +2 -2
- package/dist/browser/publications/comment-moderation/schema.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +2 -0
- package/dist/browser/rpc/src/schema.d.ts +12 -0
- package/dist/browser/runtime/node/community/db-handler.d.ts +3 -0
- package/dist/browser/runtime/node/community/db-handler.js +51 -14
- package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/cleanup.js +6 -0
- package/dist/browser/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.d.ts +6 -0
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js +85 -12
- package/dist/browser/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/lifecycle.js +102 -61
- package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/post-updates-bucket.d.ts +21 -0
- package/dist/browser/runtime/node/community/local-community/post-updates-bucket.js +141 -4
- package/dist/browser/runtime/node/community/local-community/post-updates-bucket.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/pubsub.js +11 -4
- package/dist/browser/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.d.ts +22 -4
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js +45 -9
- package/dist/browser/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +4 -0
- package/dist/browser/runtime/node/community/local-community.js +16 -0
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/browser/runtime/node/event-loop-watch.d.ts +13 -0
- package/dist/browser/runtime/node/event-loop-watch.js +58 -0
- package/dist/browser/runtime/node/event-loop-watch.js.map +1 -0
- package/dist/browser/schema/schema-util.d.ts +5 -0
- package/dist/browser/schema/schema.d.ts +9 -0
- package/dist/browser/schema/schema.js +9 -1
- package/dist/browser/schema/schema.js.map +1 -1
- package/dist/browser/schema.d.ts +16 -0
- package/dist/browser/test/test-util.d.ts +5 -0
- package/dist/browser/version.js +1 -1
- package/dist/bundled/bundle-manifest.json +43 -40
- package/dist/bundled/challenges.js +1 -1
- package/dist/bundled/chunks/{helia-for-pkc-CceaAEzV.js → helia-for-pkc-D3uvabO4.js} +2 -2
- package/dist/bundled/chunks/{local-community-C8Qwak8F.js → local-community-ChB5dbEH.js} +1 -1
- package/dist/bundled/chunks/{local-community-BzZbcwm-.js → local-community-SgssDrxj.js} +416 -90
- package/dist/bundled/chunks/{node-CleFjKjX.js → node-Bx3xTqFv.js} +6 -5
- package/dist/bundled/chunks/{page-sort-scoring-BAl6dNeR.js → page-sort-scoring-CZmdHvps.js} +1 -1
- package/dist/bundled/chunks/{rpc-local-community-CW6GnMsd.js → rpc-local-community-D66Be62U.js} +51 -4
- package/dist/bundled/chunks/{util-C0MpIK71.js → util-BuTE1Bd1.js} +7 -8
- package/dist/bundled/chunks/{util-C29b1mlK.js → util-CodXreIl.js} +1 -1
- package/dist/bundled/chunks/{validate-package-factories-CAwF_8n6.js → validate-package-factories-Bc4uoozL.js} +2 -2
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/page-sorts.js +1 -1
- package/dist/bundled/rpc/src/index.js +4 -4
- package/dist/node/clients/base-client-manager.js +10 -1
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/clients/rpc-client/schema.d.ts +1 -0
- package/dist/node/clients/shared-pubsub-topic-list.d.ts +14 -0
- package/dist/node/clients/shared-pubsub-topic-list.js +61 -0
- package/dist/node/clients/shared-pubsub-topic-list.js.map +1 -0
- package/dist/node/community/schema.d.ts +13 -0
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/index-with-compile-cache.d.ts +2 -0
- package/dist/node/index.d.ts +4 -0
- package/dist/node/pages/schema.d.ts +3 -0
- package/dist/node/publications/comment/comment.d.ts +1 -0
- package/dist/node/publications/comment/comment.js +1 -0
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/comment/schema.d.ts +4 -2
- package/dist/node/publications/comment/schema.js +2 -0
- package/dist/node/publications/comment/schema.js.map +1 -1
- package/dist/node/publications/comment-moderation/schema.js +2 -2
- package/dist/node/publications/comment-moderation/schema.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +2 -0
- package/dist/node/rpc/src/schema.d.ts +12 -0
- package/dist/node/runtime/node/community/db-handler.d.ts +3 -0
- package/dist/node/runtime/node/community/db-handler.js +51 -14
- package/dist/node/runtime/node/community/db-handler.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/cleanup.js +6 -0
- package/dist/node/runtime/node/community/local-community/cleanup.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/ipns-publishing.d.ts +6 -0
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js +85 -12
- package/dist/node/runtime/node/community/local-community/ipns-publishing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/lifecycle.js +102 -61
- package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/post-updates-bucket.d.ts +21 -0
- package/dist/node/runtime/node/community/local-community/post-updates-bucket.js +141 -4
- package/dist/node/runtime/node/community/local-community/post-updates-bucket.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/pubsub.js +11 -4
- package/dist/node/runtime/node/community/local-community/pubsub.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.d.ts +22 -4
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js +45 -9
- package/dist/node/runtime/node/community/local-community/reprovide-on-address-change.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +4 -0
- package/dist/node/runtime/node/community/local-community.js +16 -0
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/dist/node/runtime/node/event-loop-watch.d.ts +13 -0
- package/dist/node/runtime/node/event-loop-watch.js +58 -0
- package/dist/node/runtime/node/event-loop-watch.js.map +1 -0
- package/dist/node/schema/schema-util.d.ts +5 -0
- package/dist/node/schema/schema.d.ts +9 -0
- package/dist/node/schema/schema.js +9 -1
- package/dist/node/schema/schema.js.map +1 -1
- package/dist/node/schema.d.ts +16 -0
- package/dist/node/test/test-util.d.ts +5 -0
- package/dist/node/version.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/publications/comment-moderation/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACH,eAAe,EACf,kCAAkC,EAClC,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,gCAAgC,EAChC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ACnK,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,+EAA+E;CAC5H,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gDAAgD,GAAG,oCAAoC,CAAC,KAAK,CAAC,gBAAgB;KACtH,MAAM,EAAE;KACR,MAAM,CAAC;IACJ,iBAAiB,EAAE,+CAA+C,CAAC,KAAK,EAAE;CAC7E,CAAC,CAAC;AAEP,MAAM,CAAC,MAAM,+BAA+B,GAAG,UAAU;AACrD,8FAA8F;AAC9F,gGAAgG;AAChG,gGAAgG;AAChG,MAAM,CAAC;IACH,GAAG,IAAI,CAAC,gCAAgC,CAAC,KAAK,CAAC;IAC/C,GAAG,IAAI,CAAC,gDAAgD,CAAC,KAAK,CAAC;IAC/D,uBAAuB;IACvB,uBAAuB;IACvB,kBAAkB;IAClB,oBAAoB;IACpB,eAAe;IACf,iBAAiB;IACjB,OAAO;IACP,iBAAiB;IACjB,QAAQ;IACR,SAAS;IACT,cAAc;CACjB,CAAC,EACF,IAAI,CAAC,+CAA+C,CAAC,KAAK,CAAC,CAC9D,CAAC"}
|
|
@@ -445,6 +445,7 @@ declare const PKCJs: {
|
|
|
445
445
|
archived?: boolean | undefined;
|
|
446
446
|
removed?: boolean | undefined;
|
|
447
447
|
reason?: string | undefined;
|
|
448
|
+
authorBanExpiresAt?: number | undefined;
|
|
448
449
|
approved?: boolean | undefined;
|
|
449
450
|
author?: {
|
|
450
451
|
[x: string]: unknown;
|
|
@@ -642,6 +643,7 @@ declare const PKCJs: {
|
|
|
642
643
|
archived?: boolean | undefined;
|
|
643
644
|
removed?: boolean | undefined;
|
|
644
645
|
reason?: string | undefined;
|
|
646
|
+
authorBanExpiresAt?: number | undefined;
|
|
645
647
|
approved?: boolean | undefined;
|
|
646
648
|
author?: {
|
|
647
649
|
[x: string]: unknown;
|
|
@@ -478,6 +478,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
|
|
|
478
478
|
archived?: boolean | undefined;
|
|
479
479
|
removed?: boolean | undefined;
|
|
480
480
|
reason?: string | undefined;
|
|
481
|
+
authorBanExpiresAt?: number | undefined;
|
|
481
482
|
approved?: boolean | undefined;
|
|
482
483
|
author?: {
|
|
483
484
|
[x: string]: unknown;
|
|
@@ -675,6 +676,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
|
|
|
675
676
|
archived?: boolean | undefined;
|
|
676
677
|
removed?: boolean | undefined;
|
|
677
678
|
reason?: string | undefined;
|
|
679
|
+
authorBanExpiresAt?: number | undefined;
|
|
678
680
|
approved?: boolean | undefined;
|
|
679
681
|
author?: {
|
|
680
682
|
[x: string]: unknown;
|
|
@@ -1284,6 +1286,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
|
|
|
1284
1286
|
archived?: boolean | undefined;
|
|
1285
1287
|
removed?: boolean | undefined;
|
|
1286
1288
|
reason?: string | undefined;
|
|
1289
|
+
authorBanExpiresAt?: number | undefined;
|
|
1287
1290
|
approved?: boolean | undefined;
|
|
1288
1291
|
author?: {
|
|
1289
1292
|
[x: string]: unknown;
|
|
@@ -1481,6 +1484,7 @@ export declare const CreatePKCWsServerOptionsSchema: z.ZodObject<{
|
|
|
1481
1484
|
archived?: boolean | undefined;
|
|
1482
1485
|
removed?: boolean | undefined;
|
|
1483
1486
|
reason?: string | undefined;
|
|
1487
|
+
authorBanExpiresAt?: number | undefined;
|
|
1484
1488
|
approved?: boolean | undefined;
|
|
1485
1489
|
author?: {
|
|
1486
1490
|
[x: string]: unknown;
|
|
@@ -2297,6 +2301,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
|
|
|
2297
2301
|
archived?: boolean | undefined;
|
|
2298
2302
|
removed?: boolean | undefined;
|
|
2299
2303
|
reason?: string | undefined;
|
|
2304
|
+
authorBanExpiresAt?: number | undefined;
|
|
2300
2305
|
approved?: boolean | undefined;
|
|
2301
2306
|
author?: {
|
|
2302
2307
|
[x: string]: unknown;
|
|
@@ -2494,6 +2499,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
|
|
|
2494
2499
|
archived?: boolean | undefined;
|
|
2495
2500
|
removed?: boolean | undefined;
|
|
2496
2501
|
reason?: string | undefined;
|
|
2502
|
+
authorBanExpiresAt?: number | undefined;
|
|
2497
2503
|
approved?: boolean | undefined;
|
|
2498
2504
|
author?: {
|
|
2499
2505
|
[x: string]: unknown;
|
|
@@ -2889,6 +2895,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
|
|
|
2889
2895
|
archived?: boolean | undefined;
|
|
2890
2896
|
removed?: boolean | undefined;
|
|
2891
2897
|
reason?: string | undefined;
|
|
2898
|
+
authorBanExpiresAt?: number | undefined;
|
|
2892
2899
|
approved?: boolean | undefined;
|
|
2893
2900
|
author?: {
|
|
2894
2901
|
[x: string]: unknown;
|
|
@@ -3086,6 +3093,7 @@ export declare const SetNewSettingsPKCWsServerSchema: z.ZodObject<{
|
|
|
3086
3093
|
archived?: boolean | undefined;
|
|
3087
3094
|
removed?: boolean | undefined;
|
|
3088
3095
|
reason?: string | undefined;
|
|
3096
|
+
authorBanExpiresAt?: number | undefined;
|
|
3089
3097
|
approved?: boolean | undefined;
|
|
3090
3098
|
author?: {
|
|
3091
3099
|
[x: string]: unknown;
|
|
@@ -3888,6 +3896,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
|
|
|
3888
3896
|
archived?: boolean | undefined;
|
|
3889
3897
|
removed?: boolean | undefined;
|
|
3890
3898
|
reason?: string | undefined;
|
|
3899
|
+
authorBanExpiresAt?: number | undefined;
|
|
3891
3900
|
approved?: boolean | undefined;
|
|
3892
3901
|
author?: {
|
|
3893
3902
|
[x: string]: unknown;
|
|
@@ -4085,6 +4094,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
|
|
|
4085
4094
|
archived?: boolean | undefined;
|
|
4086
4095
|
removed?: boolean | undefined;
|
|
4087
4096
|
reason?: string | undefined;
|
|
4097
|
+
authorBanExpiresAt?: number | undefined;
|
|
4088
4098
|
approved?: boolean | undefined;
|
|
4089
4099
|
author?: {
|
|
4090
4100
|
[x: string]: unknown;
|
|
@@ -4480,6 +4490,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
|
|
|
4480
4490
|
archived?: boolean | undefined;
|
|
4481
4491
|
removed?: boolean | undefined;
|
|
4482
4492
|
reason?: string | undefined;
|
|
4493
|
+
authorBanExpiresAt?: number | undefined;
|
|
4483
4494
|
approved?: boolean | undefined;
|
|
4484
4495
|
author?: {
|
|
4485
4496
|
[x: string]: unknown;
|
|
@@ -4677,6 +4688,7 @@ export declare const PKCWsServerSettingsSerializedSchema: z.ZodObject<{
|
|
|
4677
4688
|
archived?: boolean | undefined;
|
|
4678
4689
|
removed?: boolean | undefined;
|
|
4679
4690
|
reason?: string | undefined;
|
|
4691
|
+
authorBanExpiresAt?: number | undefined;
|
|
4680
4692
|
approved?: boolean | undefined;
|
|
4681
4693
|
author?: {
|
|
4682
4694
|
[x: string]: unknown;
|
|
@@ -30,6 +30,8 @@ export declare class DbHandler {
|
|
|
30
30
|
private _columnNamesByTable;
|
|
31
31
|
private _positionalMappers;
|
|
32
32
|
private _publicationWriteGeneration;
|
|
33
|
+
private _notePublicationWrite;
|
|
34
|
+
private _readBackWithoutStoringDepth;
|
|
33
35
|
private _preparedStatements;
|
|
34
36
|
private _startLockAddress;
|
|
35
37
|
constructor(community: DbHandler["_community"]);
|
|
@@ -303,6 +305,7 @@ export declare class DbHandler {
|
|
|
303
305
|
runInWriteTransaction<T>(write: () => T): T;
|
|
304
306
|
communityDbExists(): boolean;
|
|
305
307
|
markCommentsAsPublishedToPostUpdates(commentCids: string[]): void;
|
|
308
|
+
queryPublishedPostCidsOfBucket(bucket: number): string[];
|
|
306
309
|
forceUpdateOnAllComments(): void;
|
|
307
310
|
forceUpdateOnAllCommentsWithCid(commentCids: string[]): void;
|
|
308
311
|
private _runForEachCidBatch;
|
|
@@ -43,6 +43,12 @@ const TABLES = Object.freeze({
|
|
|
43
43
|
PSEUDONYMITY_ALIASES: "pseudonymityAliases"
|
|
44
44
|
});
|
|
45
45
|
// The address an alias row's original public key derives to, or null when the key is malformed (kept, never looked up)
|
|
46
|
+
// A moderation's `author` that sets the author's ban: a positive timestamp, future (a ban) or past (an unban).
|
|
47
|
+
// A 0 only removes the mark from the comment it was published on (commentUpdate.authorBanExpiresAt), so the author
|
|
48
|
+
// aggregate skips it and falls through to the newest row that does carry a timestamp (issue #363).
|
|
49
|
+
function isAuthorBanRow(modEdit) {
|
|
50
|
+
return typeof modEdit?.banExpiresAt === "number" && modEdit.banExpiresAt > 0;
|
|
51
|
+
}
|
|
46
52
|
function deriveAliasOriginalAuthorSignerAddress(originalAuthorPublicKey) {
|
|
47
53
|
try {
|
|
48
54
|
return getPKCAddressFromPublicKeySync(originalAuthorPublicKey);
|
|
@@ -52,11 +58,21 @@ function deriveAliasOriginalAuthorSignerAddress(originalAuthorPublicKey) {
|
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
export class DbHandler {
|
|
61
|
+
// Every method that writes a publication (a vote, comment, edit, moderation, an approval, a purge) calls this.
|
|
62
|
+
// Besides dropping what was memoized from the old rows, it asks the community for a new record, which wakes its
|
|
63
|
+
// publish loop: the loop does not poll the DB for changes (issue #576). A write inside readBackWithoutStoring is
|
|
64
|
+
// rolled back, so it still drops the memo (the rows did change for the read that follows) but asks for no record.
|
|
65
|
+
_notePublicationWrite() {
|
|
66
|
+
this._publicationWriteGeneration++;
|
|
67
|
+
if (this._community && this._readBackWithoutStoringDepth === 0)
|
|
68
|
+
this._community._communityUpdateTrigger = true;
|
|
69
|
+
}
|
|
55
70
|
constructor(community) {
|
|
56
71
|
this._transactionGeneration = 0;
|
|
57
72
|
// Advanced by every write to the publication tables (comments, votes, edits, moderations, aliases, purges). The
|
|
58
73
|
// update cycle's author memo (CommunityAuthorMemo) is only reused while it stays the same.
|
|
59
74
|
this._publicationWriteGeneration = 0;
|
|
75
|
+
this._readBackWithoutStoringDepth = 0;
|
|
60
76
|
// The address this handler has claimed the start of, from lockCommunityStart until unlockCommunityStart
|
|
61
77
|
this._startLockAddress = undefined;
|
|
62
78
|
this._community = community;
|
|
@@ -237,11 +253,15 @@ export class DbHandler {
|
|
|
237
253
|
// no transaction open (issue #417).
|
|
238
254
|
readBackWithoutStoring(opts) {
|
|
239
255
|
this._db.exec("SAVEPOINT read_back_without_storing");
|
|
256
|
+
this._readBackWithoutStoringDepth++;
|
|
240
257
|
try {
|
|
241
258
|
opts.write();
|
|
242
259
|
return opts.read();
|
|
243
260
|
}
|
|
244
261
|
finally {
|
|
262
|
+
this._readBackWithoutStoringDepth--;
|
|
263
|
+
// what was memoized inside the savepoint was read from rows that are about to be gone
|
|
264
|
+
this._publicationWriteGeneration++;
|
|
245
265
|
this._db.exec("ROLLBACK TO read_back_without_storing");
|
|
246
266
|
this._db.exec("RELEASE read_back_without_storing");
|
|
247
267
|
}
|
|
@@ -351,6 +371,7 @@ export class DbHandler {
|
|
|
351
371
|
removed INTEGER NULLABLE, -- BOOLEAN (0/1)
|
|
352
372
|
approved INTEGER NULLABLE, -- BOOLEAN (0/1)
|
|
353
373
|
reason TEXT NULLABLE,
|
|
374
|
+
authorBanExpiresAt INTEGER NULLABLE, -- the ban a mod published on this comment (issue #363)
|
|
354
375
|
updatedAt INTEGER NOT NULL CHECK(updatedAt > 0),
|
|
355
376
|
protocolVersion TEXT NOT NULL,
|
|
356
377
|
signature TEXT NOT NULL, -- JSON
|
|
@@ -1023,18 +1044,18 @@ export class DbHandler {
|
|
|
1023
1044
|
}
|
|
1024
1045
|
}
|
|
1025
1046
|
deleteVote(authorSignerAddress, commentCid) {
|
|
1026
|
-
this.
|
|
1047
|
+
this._notePublicationWrite();
|
|
1027
1048
|
this._db
|
|
1028
1049
|
.prepare(`DELETE FROM ${TABLES.VOTES} WHERE commentCid = ? AND authorSignerAddress = ?`)
|
|
1029
1050
|
.run(commentCid, authorSignerAddress);
|
|
1030
1051
|
}
|
|
1031
1052
|
_deleteCommentEditRow(rowid) {
|
|
1032
|
-
this.
|
|
1053
|
+
this._notePublicationWrite();
|
|
1033
1054
|
const deleteResult = this._db.prepare(`DELETE FROM ${TABLES.COMMENT_EDITS} WHERE rowid = ?`).run(rowid);
|
|
1034
1055
|
return deleteResult.changes > 0;
|
|
1035
1056
|
}
|
|
1036
1057
|
insertVotes(votes) {
|
|
1037
|
-
this.
|
|
1058
|
+
this._notePublicationWrite();
|
|
1038
1059
|
if (votes.length === 0)
|
|
1039
1060
|
return;
|
|
1040
1061
|
const processedVotes = this._processRecordsForDbBeforeInsert(votes);
|
|
@@ -1062,7 +1083,7 @@ export class DbHandler {
|
|
|
1062
1083
|
insertMany(processedVotes);
|
|
1063
1084
|
}
|
|
1064
1085
|
insertComments(comments) {
|
|
1065
|
-
this.
|
|
1086
|
+
this._notePublicationWrite();
|
|
1066
1087
|
if (comments.length === 0)
|
|
1067
1088
|
return;
|
|
1068
1089
|
const processedComments = this._processRecordsForDbBeforeInsert(comments);
|
|
@@ -1087,7 +1108,7 @@ export class DbHandler {
|
|
|
1087
1108
|
insertMany(processedComments);
|
|
1088
1109
|
}
|
|
1089
1110
|
insertPseudonymityAliases(aliases) {
|
|
1090
|
-
this.
|
|
1111
|
+
this._notePublicationWrite();
|
|
1091
1112
|
if (aliases.length === 0)
|
|
1092
1113
|
return;
|
|
1093
1114
|
const processedAliases = this._processRecordsForDbBeforeInsert(aliases).map((alias) => ({
|
|
@@ -1111,14 +1132,14 @@ export class DbHandler {
|
|
|
1111
1132
|
const columnNames = this._getColumnNames(TABLES.COMMENT_UPDATES);
|
|
1112
1133
|
const stmt = this._prepareCached(`
|
|
1113
1134
|
INSERT INTO ${TABLES.COMMENT_UPDATES}
|
|
1114
|
-
(cid, edit, upvoteCount, downvoteCount, replyCount, childCount, number, postNumber, flairs, spoiler, nsfw, pinned, locked, archived, removed, approved, reason, updatedAt, protocolVersion, signature, author, replies, lastChildCid, lastReplyTimestamp, postUpdatesBucket, publishedToPostUpdatesMFS, insertedAt, extraProps)
|
|
1115
|
-
VALUES (@cid, @edit, @upvoteCount, @downvoteCount, @replyCount, @childCount, @number, @postNumber, @flairs, @spoiler, @nsfw, @pinned, @locked, @archived, @removed, @approved, @reason, @updatedAt, @protocolVersion, @signature, @author, @replies, @lastChildCid, @lastReplyTimestamp, @postUpdatesBucket, @publishedToPostUpdatesMFS, @insertedAt, @extraProps)
|
|
1135
|
+
(cid, edit, upvoteCount, downvoteCount, replyCount, childCount, number, postNumber, flairs, spoiler, nsfw, pinned, locked, archived, removed, approved, reason, authorBanExpiresAt, updatedAt, protocolVersion, signature, author, replies, lastChildCid, lastReplyTimestamp, postUpdatesBucket, publishedToPostUpdatesMFS, insertedAt, extraProps)
|
|
1136
|
+
VALUES (@cid, @edit, @upvoteCount, @downvoteCount, @replyCount, @childCount, @number, @postNumber, @flairs, @spoiler, @nsfw, @pinned, @locked, @archived, @removed, @approved, @reason, @authorBanExpiresAt, @updatedAt, @protocolVersion, @signature, @author, @replies, @lastChildCid, @lastReplyTimestamp, @postUpdatesBucket, @publishedToPostUpdatesMFS, @insertedAt, @extraProps)
|
|
1116
1137
|
ON CONFLICT(cid) DO UPDATE SET
|
|
1117
1138
|
edit = excluded.edit, upvoteCount = excluded.upvoteCount, downvoteCount = excluded.downvoteCount, replyCount = excluded.replyCount, childCount = excluded.childCount,
|
|
1118
1139
|
number = COALESCE(excluded.number, ${TABLES.COMMENT_UPDATES}.number),
|
|
1119
1140
|
postNumber = COALESCE(excluded.postNumber, ${TABLES.COMMENT_UPDATES}.postNumber),
|
|
1120
1141
|
flairs = excluded.flairs, spoiler = excluded.spoiler, nsfw = excluded.nsfw, pinned = excluded.pinned, locked = excluded.locked, archived = excluded.archived,
|
|
1121
|
-
removed = excluded.removed, approved = excluded.approved, reason = excluded.reason, updatedAt = excluded.updatedAt, protocolVersion = excluded.protocolVersion,
|
|
1142
|
+
removed = excluded.removed, approved = excluded.approved, reason = excluded.reason, authorBanExpiresAt = excluded.authorBanExpiresAt, updatedAt = excluded.updatedAt, protocolVersion = excluded.protocolVersion,
|
|
1122
1143
|
signature = excluded.signature, author = excluded.author, replies = excluded.replies, lastChildCid = excluded.lastChildCid,
|
|
1123
1144
|
lastReplyTimestamp = excluded.lastReplyTimestamp, postUpdatesBucket = excluded.postUpdatesBucket,
|
|
1124
1145
|
publishedToPostUpdatesMFS = excluded.publishedToPostUpdatesMFS,
|
|
@@ -1137,7 +1158,7 @@ export class DbHandler {
|
|
|
1137
1158
|
upsertMany(processedUpdates);
|
|
1138
1159
|
}
|
|
1139
1160
|
insertCommentModerations(moderations) {
|
|
1140
|
-
this.
|
|
1161
|
+
this._notePublicationWrite();
|
|
1141
1162
|
if (moderations.length === 0)
|
|
1142
1163
|
return;
|
|
1143
1164
|
const processedModerations = this._processRecordsForDbBeforeInsert(moderations);
|
|
@@ -1160,7 +1181,7 @@ export class DbHandler {
|
|
|
1160
1181
|
insertMany(processedModerations);
|
|
1161
1182
|
}
|
|
1162
1183
|
insertCommentEdits(edits) {
|
|
1163
|
-
this.
|
|
1184
|
+
this._notePublicationWrite();
|
|
1164
1185
|
if (edits.length === 0)
|
|
1165
1186
|
return;
|
|
1166
1187
|
const processedEdits = this._processRecordsForDbBeforeInsert(edits);
|
|
@@ -2094,7 +2115,7 @@ export class DbHandler {
|
|
|
2094
2115
|
return pick(parsed, ["signature", ...signedKeys, ...commentEditFields]);
|
|
2095
2116
|
}
|
|
2096
2117
|
removeCommentFromPendingApproval(comment) {
|
|
2097
|
-
this.
|
|
2118
|
+
this._notePublicationWrite();
|
|
2098
2119
|
const log = Logger("pkc-js:local-community:db-handler:removeCommentFromPendingApproval");
|
|
2099
2120
|
const stmt = this._db.prepare(`UPDATE ${TABLES.COMMENTS} SET pendingApproval = 0 WHERE cid = ?`);
|
|
2100
2121
|
const res = stmt.run(comment.cid);
|
|
@@ -2335,6 +2356,8 @@ export class DbHandler {
|
|
|
2335
2356
|
...moderation?.flags,
|
|
2336
2357
|
// moderatorReason wins when present, else fall back to the challenge-supplied reason (if any).
|
|
2337
2358
|
reason: moderation?.reason ?? comment.challengeCommentUpdate?.reason,
|
|
2359
|
+
// 0 is the mod's revoke: it is the newest ban value on this comment, and it means no mark
|
|
2360
|
+
authorBanExpiresAt: moderation?.authorBanExpiresAt || undefined,
|
|
2338
2361
|
author: { community: { ...(challengeAuthorCommunity ?? {}), ...authorCommunity } },
|
|
2339
2362
|
lastChildCid: lastChildCids.get(comment.cid),
|
|
2340
2363
|
lastReplyTimestamp: lastReplyTimestamps.get(comment.cid),
|
|
@@ -2463,6 +2486,9 @@ export class DbHandler {
|
|
|
2463
2486
|
}
|
|
2464
2487
|
// What the moderations of each comment say, newest first, one read for the batch: the latest non-null value per
|
|
2465
2488
|
// field (reason, flairs, approved and the six flags), the same precedence as the per-field statements this replaces.
|
|
2489
|
+
// authorBanExpiresAt is the newest author.banExpiresAt published on the comment itself, 0 included: a 0 removes the
|
|
2490
|
+
// mark. author.community.banExpiresAt is the newest across all of the author's comments and skips 0 rows
|
|
2491
|
+
// (isAuthorBanRow), so removing a mark never touches the ban.
|
|
2466
2492
|
_queryModerationSummariesByCids(cids) {
|
|
2467
2493
|
const FLAG_NAMES = ["spoiler", "pinned", "locked", "archived", "removed", "nsfw"];
|
|
2468
2494
|
const result = new Map();
|
|
@@ -2477,6 +2503,9 @@ export class DbHandler {
|
|
|
2477
2503
|
}
|
|
2478
2504
|
if (summary.reason === undefined && typeof moderation.reason === "string")
|
|
2479
2505
|
summary.reason = moderation.reason;
|
|
2506
|
+
const banExpiresAt = moderation.author?.banExpiresAt;
|
|
2507
|
+
if (summary.authorBanExpiresAt === undefined && typeof banExpiresAt === "number")
|
|
2508
|
+
summary.authorBanExpiresAt = banExpiresAt;
|
|
2480
2509
|
if (summary.flairs === undefined && moderation.flairs !== null && moderation.flairs !== undefined)
|
|
2481
2510
|
summary.flairs = moderation.flairs;
|
|
2482
2511
|
if (summary.approved === undefined && moderation.approved !== null && moderation.approved !== undefined)
|
|
@@ -2622,7 +2651,7 @@ export class DbHandler {
|
|
|
2622
2651
|
.filter((row) => (row.targetAuthorSignerAddress !== null && modEditSet.has(row.targetAuthorSignerAddress)) ||
|
|
2623
2652
|
(need.domain !== undefined && row.targetAuthorDomain === need.domain))
|
|
2624
2653
|
.map((row) => row.author);
|
|
2625
|
-
const banAuthor = modAuthorEdits.find(
|
|
2654
|
+
const banAuthor = modAuthorEdits.find(isAuthorBanRow);
|
|
2626
2655
|
const authorFlairsByMod = modAuthorEdits.find((modEdit) => modEdit?.flairs);
|
|
2627
2656
|
const modEdits = {};
|
|
2628
2657
|
if (banAuthor?.banExpiresAt)
|
|
@@ -2808,7 +2837,7 @@ export class DbHandler {
|
|
|
2808
2837
|
WHERE (${conditions.join(" OR ")}) AND json_extract(commentModeration, '$.author') IS NOT NULL ORDER BY rowid DESC
|
|
2809
2838
|
`).all(...params);
|
|
2810
2839
|
const modAuthorEdits = modAuthorEditsRaw.map((r) => JSON.parse(r.commentAuthorJson));
|
|
2811
|
-
const banAuthor = modAuthorEdits.find(
|
|
2840
|
+
const banAuthor = modAuthorEdits.find(isAuthorBanRow);
|
|
2812
2841
|
const authorFlairsByMod = modAuthorEdits.find((modEdit) => modEdit?.flairs);
|
|
2813
2842
|
const aggregateAuthor = {};
|
|
2814
2843
|
if (banAuthor?.banExpiresAt)
|
|
@@ -2937,7 +2966,7 @@ export class DbHandler {
|
|
|
2937
2966
|
return allCids;
|
|
2938
2967
|
}
|
|
2939
2968
|
purgeComment(cid, isNestedCall = false) {
|
|
2940
|
-
this.
|
|
2969
|
+
this._notePublicationWrite();
|
|
2941
2970
|
const log = Logger("pkc-js:local-community:db-handler:purgeComment");
|
|
2942
2971
|
const purgedRecords = [];
|
|
2943
2972
|
const detachedPageCids = [];
|
|
@@ -3161,6 +3190,14 @@ export class DbHandler {
|
|
|
3161
3190
|
return;
|
|
3162
3191
|
this._runForEachCidBatch(commentCids, (placeholders) => `UPDATE ${TABLES.COMMENT_UPDATES} SET publishedToPostUpdatesMFS = 1 WHERE cid IN (${placeholders})`);
|
|
3163
3192
|
}
|
|
3193
|
+
// The posts whose CommentUpdate file was written to this postUpdates bucket and acknowledged. No index backs it:
|
|
3194
|
+
// it is for the rare audit of a bucket MFS may have lost entries of, never for a hot path.
|
|
3195
|
+
queryPublishedPostCidsOfBucket(bucket) {
|
|
3196
|
+
return this._db
|
|
3197
|
+
.prepare(`SELECT cid FROM ${TABLES.COMMENT_UPDATES} WHERE postUpdatesBucket = ? AND publishedToPostUpdatesMFS = 1`)
|
|
3198
|
+
.pluck()
|
|
3199
|
+
.all(bucket);
|
|
3200
|
+
}
|
|
3164
3201
|
forceUpdateOnAllComments() {
|
|
3165
3202
|
this._db.prepare(`UPDATE ${TABLES.COMMENT_UPDATES} SET publishedToPostUpdatesMFS = 0`).run();
|
|
3166
3203
|
}
|