mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
24 lines
547 B
JavaScript
24 lines
547 B
JavaScript
import Service, { service } from "@ember/service";
|
|
|
|
export default class ChatGuardian extends Service {
|
|
@service currentUser;
|
|
@service siteSettings;
|
|
|
|
canEditChatChannel() {
|
|
return this.canUseChat() && this.currentUser.staff;
|
|
}
|
|
|
|
canArchiveChannel(channel) {
|
|
return (
|
|
this.canEditChatChannel() &&
|
|
this.siteSettings.chat_allow_archiving_channels &&
|
|
!channel.isArchived &&
|
|
!channel.isReadOnly
|
|
);
|
|
}
|
|
|
|
canUseChat() {
|
|
return this.currentUser?.has_chat_enabled && this.siteSettings.chat_enabled;
|
|
}
|
|
}
|