Provisioner: never list the room creator in power-level users (spec rejects it)
This commit is contained in:
parent
6ea605c87e
commit
df54cb9b9e
2 changed files with 5 additions and 4 deletions
|
|
@ -168,7 +168,6 @@ describe("MatrixProvisioner room set shape", () => {
|
|||
const pl = room.body.power_level_content_override as Record<string, unknown>;
|
||||
const users = pl.users as Record<string, number>;
|
||||
expect(users[founder]).toBe(FOUNDER_POWER_LEVEL);
|
||||
expect(users["@provisioner:chat.example.com"]).toBe(FOUNDER_POWER_LEVEL);
|
||||
expect(pl.users_default).toBe(MEMBER_POWER_LEVEL);
|
||||
expect((pl.events as Record<string, number>)["m.room.message"]).toBe(MEMBER_POWER_LEVEL);
|
||||
expect(pl.state_default).toBe(FOUNDER_POWER_LEVEL);
|
||||
|
|
@ -188,7 +187,7 @@ describe("MatrixProvisioner room set shape", () => {
|
|||
expect(fake.invites).toHaveLength(0);
|
||||
for (const room of fake.rooms) {
|
||||
const users = (room.body.power_level_content_override as Record<string, unknown>).users as Record<string, number>;
|
||||
expect(Object.keys(users)).toEqual(["@provisioner:chat.example.com"]);
|
||||
expect(Object.keys(users)).not.toContain("@provisioner:chat.example.com");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -194,8 +194,10 @@ export class MatrixProvisioner implements ProvisionerPort {
|
|||
|
||||
/** Founder pinned at PL 100; everyone else PL 0. Bot keeps 100 to administer its rooms. */
|
||||
private powerLevels(input: ProvisionCollectiveInput): Record<string, unknown> {
|
||||
const users: Record<string, number> = { [this.botUserId]: FOUNDER_POWER_LEVEL };
|
||||
if (input.founderMxid !== null) users[input.founderMxid] = FOUNDER_POWER_LEVEL;
|
||||
// The room creator (the bot) already holds PL 100 as founder-of-record;
|
||||
// the spec rejects creator IDs listed in `users`.
|
||||
const users: Record<string, number> =
|
||||
input.founderMxid !== null ? { [input.founderMxid]: FOUNDER_POWER_LEVEL } : {};
|
||||
return {
|
||||
users,
|
||||
users_default: MEMBER_POWER_LEVEL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue