mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
Merge pull request #1003 from PR0M3TH3AN/codex/update-submitreport-to-adjust-tag-order
Fix NIP-56 report e-tag ordering
This commit is contained in:
2 files changed
+7
-4
No files matched your search
@@ -2153,11 +2153,10 @@ export class ModerationService {
|
||||
const sanitizedRelayHint =
|
||||
typeof relayHint === "string" ? relayHint.trim() : "";
|
||||
|
||||
const eventTag = ["e", normalizedEventId];
|
||||
const eventTag = ["e", normalizedEventId, normalizedType];
|
||||
if (sanitizedRelayHint) {
|
||||
eventTag.push(sanitizedRelayHint);
|
||||
}
|
||||
eventTag.push(normalizedType);
|
||||
|
||||
const tags = [
|
||||
eventTag,
|
||||
|
||||
@@ -66,7 +66,11 @@ test("submitReport emits NIP-56 compliant report tags", async (t) => {
|
||||
assert.equal(ok, true, "submitReport should resolve with ok: true");
|
||||
|
||||
const eTag = event.tags.find((tag) => Array.isArray(tag) && tag[0] === "e");
|
||||
assert.deepEqual(eTag, ["e", eventId, relayHint, "malware"], "e tag should include relay hint before type");
|
||||
assert.deepEqual(
|
||||
eTag,
|
||||
["e", eventId, "malware", relayHint],
|
||||
"e tag should include type before relay hint",
|
||||
);
|
||||
|
||||
const pTag = event.tags.find((tag) => Array.isArray(tag) && tag[0] === "p");
|
||||
assert.deepEqual(pTag, ["p", targetPubkey, "malware"], "p tag should include reported author and type");
|
||||
@@ -88,7 +92,7 @@ test("submitReport emits NIP-56 compliant report tags", async (t) => {
|
||||
assert.deepEqual(
|
||||
followupETag,
|
||||
["e", followupId, "spam"],
|
||||
"e tag without relay hint should collapse to type as third entry",
|
||||
"e tag without relay hint should place type as third entry",
|
||||
);
|
||||
|
||||
assert.ok(publishCalls.length >= 2, "submitReport should publish each report");
|
||||
|
||||
Reference in new issue
Block a user