forked from Yara724/api
Fixed users not being able to view their files
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user