fix(chat): fix bot status not showing. Closes #3046

This commit is contained in:
Gabe Kangas
2023-05-31 13:28:06 -07:00
parent 1ed51859b0
commit 71703f2245
5 changed files with 19 additions and 15 deletions

View File

@@ -9,8 +9,8 @@ export const createUser = (name: string, color: number, createdAt: Date): User =
nameChangedAt: createdAt,
previousNames: [],
scopes: [],
isModerator: () => false,
isBot: false,
isModerator: false,
});
export const spidermanUser = createUser('Spiderman', 1, new Date(2020, 1, 2));

View File

@@ -9,6 +9,11 @@ export class User {
this.nameChangedAt = u.nameChangedAt;
this.scopes = u.scopes;
this.authenticated = u.authenticated;
this.isBot = u.isBot;
if (this.scopes && this.scopes.length > 0) {
this.isModerator = this.scopes.includes('MODERATOR');
}
}
id: string;
@@ -27,11 +32,7 @@ export class User {
authenticated: boolean;
public isModerator = (): boolean => {
if (!this.scopes || this.scopes.length === 0) {
return false;
}
isBot: boolean;
return this.scopes.includes('MODERATOR');
};
isModerator: boolean;
}