Skip to content

Commit

Permalink
fix(logging): simplify hub retrieval and role checks in getHubForUser…
Browse files Browse the repository at this point in the history
… method
  • Loading branch information
dev-737 authored Feb 27, 2025
1 parent b9d8802 commit 0bcfe00
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commands/Main/hub/config/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,13 @@ export default class HubConfigLoggingSubcommand extends BaseCommand {

private async getHubForUser(ctx: Context): Promise<HubManager | null> {
const hubName = ctx.options.getString('hub', true);
const hubs = await this.hubService.findHubsByName(hubName, {
insensitive: true,
ownerId: ctx.user.id,
});
const [hub] = await this.hubService.findHubsByName(hubName, { insensitive: true });

if (!hub || !(await executeHubRoleChecksAndReply(hub, ctx, { checkIfManager: true }))) {
return null;
}

return hubs[0] ?? null;
return hub;
}

private buildComponents(
Expand Down

0 comments on commit 0bcfe00

Please sign in to comment.