Fixing the way rights are sent to the admin (now sending organization/world/room)
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
export class RoomIdentifier {
|
||||
public anonymous: boolean;
|
||||
public id:string
|
||||
public readonly anonymous: boolean;
|
||||
public readonly id:string
|
||||
public readonly organizationSlug: string|undefined;
|
||||
public readonly worldSlug: string|undefined;
|
||||
public readonly roomSlug: string|undefined;
|
||||
constructor(roomID: string) {
|
||||
if (roomID.startsWith('_/')) {
|
||||
this.anonymous = true;
|
||||
} else if(roomID.startsWith('@/')) {
|
||||
this.anonymous = false;
|
||||
|
||||
const match = /@\/([^/]+)\/([^/]+)\/(.+)/.exec(roomID);
|
||||
if (!match) {
|
||||
throw new Error('Could not extract info from "'+roomID+'"');
|
||||
}
|
||||
this.organizationSlug = match[1];
|
||||
this.worldSlug = match[2];
|
||||
this.roomSlug = match[3];
|
||||
} else {
|
||||
throw new Error('Incorrect room ID: '+roomID);
|
||||
}
|
||||
this.id = roomID; //todo: extract more data from the id (like room slug, organization name, etc);
|
||||
this.id = roomID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user