diff --git a/packages/commonwealth/server/controllers/server_topics_methods/create_topic.ts b/packages/commonwealth/server/controllers/server_topics_methods/create_topic.ts index 138788aae0e..cb68f4a5d80 100644 --- a/packages/commonwealth/server/controllers/server_topics_methods/create_topic.ts +++ b/packages/commonwealth/server/controllers/server_topics_methods/create_topic.ts @@ -56,7 +56,7 @@ export async function __createTopic( true, ); - const isAdmin = validateOwner({ + const isAdmin = await validateOwner({ models: this.models, user, // @ts-expect-error StrictNullChecks diff --git a/packages/commonwealth/server/controllers/server_topics_methods/delete_topic.ts b/packages/commonwealth/server/controllers/server_topics_methods/delete_topic.ts index 62036d720ec..7545369a2c8 100644 --- a/packages/commonwealth/server/controllers/server_topics_methods/delete_topic.ts +++ b/packages/commonwealth/server/controllers/server_topics_methods/delete_topic.ts @@ -27,7 +27,7 @@ export async function __deleteTopic( throw new AppError(Errors.TopicNotFound); } - const isAdmin = validateOwner({ + const isAdmin = await validateOwner({ models: this.models, user, communityId: topic.community_id, diff --git a/packages/commonwealth/test/unit/server_controllers/server_topics_controller.spec.ts b/packages/commonwealth/test/unit/server_controllers/server_topics_controller.spec.ts index e1a60385504..957627cfa4a 100644 --- a/packages/commonwealth/test/unit/server_controllers/server_topics_controller.spec.ts +++ b/packages/commonwealth/test/unit/server_controllers/server_topics_controller.spec.ts @@ -78,7 +78,7 @@ const createMockedTopicsController = (isAdmin: boolean = false) => { describe('ServerTopicsController', () => { test('#createTopic', async () => { - const { controller, user, chain } = createMockedTopicsController(); + const { controller, user, chain } = createMockedTopicsController(true); const [topic] = await Promise.all( await controller.createTopic({ user, @@ -99,7 +99,7 @@ describe('ServerTopicsController', () => { }); test('#deleteTopic', async () => { - const { controller, user } = createMockedTopicsController(); + const { controller, user } = createMockedTopicsController(true); await controller.deleteTopic({ user, topicId: 1,