fix: guard against negative uids crossposting

This commit is contained in:
Julian Lam
2026-01-12 14:07:45 -05:00
parent 943b53b0bc
commit 2f96eed4af
2 changed files with 17 additions and 0 deletions

View File

@@ -84,6 +84,13 @@ describe('Crossposting (& related logic)', () => {
tid = topicData.tid;
});
it('should not allow a spider (uid -1) to crosspost', async () => {
await assert.rejects(
topics.crossposts.add(tid, cid2, -1),
{ message: '[[error:invalid-uid]]' }
);
});
it('should successfully crosspost to another cid', async () => {
const crossposts = await topics.crossposts.add(tid, cid2, uid);