1
0
forked from Yara724/api

Fixed users not being able to view their files

This commit is contained in:
2026-06-19 09:50:42 +03:30
parent 0c5756d325
commit 3c863bb90c
12 changed files with 745 additions and 222 deletions

View File

@@ -37,6 +37,22 @@ describe("party access queries", () => {
},
});
});
it("includes linked duplicate-account user ids", () => {
const linked = new Types.ObjectId();
const or = buildBlamePartyAccessOrConditions(
{ sub: String(userId), username: "09123456789" },
[String(linked)],
);
expect(or[0]).toEqual({
$or: expect.arrayContaining([
{ "parties.person.userId": String(userId) },
{ "parties.person.userId": userId },
{ "parties.person.userId": String(linked) },
{ "parties.person.userId": linked },
]),
});
});
});
describe("partyPersonMatchesUser", () => {
@@ -57,5 +73,16 @@ describe("party access queries", () => {
),
).toBe(true);
});
it("matches linked duplicate-account user ids", () => {
const linked = new Types.ObjectId();
expect(
partyPersonMatchesUser(
{ userId: linked, phoneNumber: "09111111111" },
{ sub: String(userId), username: "09999999999" },
[String(linked)],
),
).toBe(true);
});
});
});