Skip to content

Commit

Permalink
fix: fix moderator check false negatives
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Dec 15, 2024
1 parent 76490e8 commit 0f7ec9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/commands/slash/Main/hub/visibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default class VisibilityCommnd extends HubCommand {
const visibility = interaction.options.getString('visibility', true) as 'public' | 'private';
const hub = (await this.hubService.findHubsByName(hubName)).at(0);

if (!hub || await hub.isManager(interaction.user.id)) {
await this.replyEmbed(interaction, 'hub.notFound_mod', {
if (!hub || !await hub.isManager(interaction.user.id)) {
await this.replyEmbed(interaction, 'hub.notManager', {
t: { emoji: emojis.no },
ephemeral: true,
});
Expand Down
8 changes: 4 additions & 4 deletions src/managers/HubManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export default class HubManager {

constructor(
hub: Hub,
hubService = new HubService(),
modManager = new HubModeratorManager(this),
hubService?: HubService,
modManager?: HubModeratorManager,
cache: Redis = getRedis(),
) {
this.hub = hub;
Expand All @@ -37,8 +37,8 @@ export default class HubManager {
this.blockWordsKey = `${RedisKeys.Hub}:${hub.id}:blockWords`;

this.cache = cache;
this.hubService = hubService;
this.modManager = modManager;
this.hubService = hubService ?? new HubService();
this.modManager = modManager ?? new HubModeratorManager(this, cache);

this.cacheHub().catch(Logger.error);
}
Expand Down

0 comments on commit 0f7ec9c

Please sign in to comment.