diff --git a/libs/model/src/aggregates/community/CreateCommunity.command.ts b/libs/model/src/aggregates/community/CreateCommunity.command.ts index 11dbe76b7c6..276a805b331 100644 --- a/libs/model/src/aggregates/community/CreateCommunity.command.ts +++ b/libs/model/src/aggregates/community/CreateCommunity.command.ts @@ -170,7 +170,6 @@ export function CreateCommunity(): Command { description: 'General discussions', featured_in_sidebar: true, featured_in_new_post: false, - group_ids: [], allow_tokenized_threads: false, }, { transaction }, diff --git a/libs/model/src/aggregates/community/CreateGroup.command.ts b/libs/model/src/aggregates/community/CreateGroup.command.ts index eb0d17fabc7..e094bc03f65 100644 --- a/libs/model/src/aggregates/community/CreateGroup.command.ts +++ b/libs/model/src/aggregates/community/CreateGroup.command.ts @@ -55,20 +55,6 @@ export function CreateGroup(): Command { ); if (topics.length > 0) { // add group to all specified topics - await models.Topic.update( - { - group_ids: sequelize.fn( - 'array_append', - sequelize.col('group_ids'), - group.id, - ), - }, - { - where: { id: { [Op.in]: topics.map(({ id }) => id!) } }, - transaction, - }, - ); - if (group.id) { // add topic level interaction permissions for current group const groupPermissions = (payload.topics || []).map((t) => { diff --git a/libs/model/src/aggregates/community/CreateTopic.command.ts b/libs/model/src/aggregates/community/CreateTopic.command.ts index b56b1afcb32..127e667d4e5 100644 --- a/libs/model/src/aggregates/community/CreateTopic.command.ts +++ b/libs/model/src/aggregates/community/CreateTopic.command.ts @@ -41,7 +41,6 @@ export function CreateTopic(): Command { featured_in_new_post, default_offchain_template, community_id: community_id!, - group_ids: [], allow_tokenized_threads: allow_tokenized_threads ?? false, }; diff --git a/libs/model/src/aggregates/community/DeleteGroup.command.ts b/libs/model/src/aggregates/community/DeleteGroup.command.ts index 232e3dc6873..f5cb8051d57 100644 --- a/libs/model/src/aggregates/community/DeleteGroup.command.ts +++ b/libs/model/src/aggregates/community/DeleteGroup.command.ts @@ -1,7 +1,6 @@ import { InvalidInput, type Command } from '@hicommonwealth/core'; import * as schemas from '@hicommonwealth/schemas'; -import { Op } from 'sequelize'; -import { models, sequelize } from '../../database'; +import { models } from '../../database'; import { authRoles } from '../../middleware'; import { mustExist } from '../../middleware/guards'; @@ -26,19 +25,6 @@ export function DeleteGroup(): Command { throw new InvalidInput(DeleteGroupErrors.SystemManaged); await models.sequelize.transaction(async (transaction) => { - await models.Topic.update( - { - group_ids: sequelize.fn( - 'array_remove', - sequelize.col('group_ids'), - group_id, - ), - }, - { - where: { community_id, group_ids: { [Op.contains]: [group_id] } }, - transaction, - }, - ); await models.Membership.destroy({ where: { group_id }, transaction, diff --git a/libs/model/src/aggregates/community/GetGroups.query.ts b/libs/model/src/aggregates/community/GetGroups.query.ts index ada180eeb24..cc87f9bbb26 100644 --- a/libs/model/src/aggregates/community/GetGroups.query.ts +++ b/libs/model/src/aggregates/community/GetGroups.query.ts @@ -3,6 +3,7 @@ import * as schemas from '@hicommonwealth/schemas'; import { Op } from 'sequelize'; import { z } from 'zod'; import { models } from '../../database'; +import { buildTopicPermissionsMap } from './GetMemberships.query'; export function GetGroups(): Query { return { @@ -26,9 +27,10 @@ export function GetGroups(): Query { ], }); const ids = groups.map((g) => g.id!); - const map = new Map>(); + + const output = new Map>(); groups.forEach((g) => - map.set(g.id!, { + output.set(g.id!, { ...g.toJSON(), id: g.id!, name: g.metadata.name, @@ -43,35 +45,42 @@ export function GetGroups(): Query { include: [{ model: models.Address, as: 'address' }], }); members.forEach((m) => { - const group = map.get(m.group_id); + const group = output.get(m.group_id); group && group.memberships.concat(m); }); } if (include_topics) { + const topic_ids = groups + .map((g) => g.GroupPermissions || []) + .flat() + .map((p) => p.topic_id); const topics = await models.Topic.findAll({ where: { ...(community_id && { community_id }), - group_ids: { [Op.overlap]: ids }, + id: topic_ids, }, }); - groups.forEach((g) => { - const group = map.get(g.id!); - group && - group.topics.concat( - topics - .filter((t) => t.group_ids.includes(group.id)) - .map((t) => ({ - ...t.toJSON(), - permissions: (g.GroupPermissions || []).find( - (gtp) => gtp.topic_id === t.id, - )?.allowed_actions as schemas.PermissionEnum[], - })), - ); + + const topics_map = new Map>(); + topics.forEach((t) => topics_map.set(t.id!, t.toJSON())); + + const topic_permissions = buildTopicPermissionsMap(groups); + + output.forEach((g) => { + const perm = topic_permissions.get(g.id!); + perm && + perm.forEach((p) => { + const topic = topics_map.get(p.id); + g.topics.push({ + ...topic!, + permissions: p.permissions, + }); + }); }); } - return Array.from(map.values()); + return Array.from(output.values()); }, }; } diff --git a/libs/model/src/aggregates/community/GetMemberships.query.ts b/libs/model/src/aggregates/community/GetMemberships.query.ts index ac8c7374636..5bb9ed02df9 100644 --- a/libs/model/src/aggregates/community/GetMemberships.query.ts +++ b/libs/model/src/aggregates/community/GetMemberships.query.ts @@ -1,11 +1,37 @@ import { command, Query } from '@hicommonwealth/core'; import * as schemas from '@hicommonwealth/schemas'; import { Op } from 'sequelize'; +import { z } from 'zod'; import { models } from '../../database'; import { systemActor } from '../../middleware'; import { mustExist } from '../../middleware/guards'; +import { GroupAttributes } from '../../models'; import { RefreshCommunityMemberships } from './RefreshCommunityMemberships.command'; +/** + * Builds a map of topic permissions indexed by group id + */ +export function buildTopicPermissionsMap(groups: GroupAttributes[]) { + const permissions = groups.map((g) => g.GroupPermissions || []).flat(); + const map = new Map[]>(); + permissions.forEach((p) => { + const entry = map.get(p.group_id); + if (entry) + entry.push({ + id: p.topic_id, + permissions: p.allowed_actions, + }); + else + map.set(p.group_id, [ + { + id: p.topic_id, + permissions: p.allowed_actions, + }, + ]); + }); + return map; +} + export function GetMemberships(): Query { return { ...schemas.GetMemberships, @@ -21,6 +47,7 @@ export function GetMemberships(): Query { const groups = await models.Group.findAll({ where: { community_id }, + attributes: ['id'], include: [ { model: models.GroupPermission, @@ -29,6 +56,7 @@ export function GetMemberships(): Query { }, ], }); + const ids = groups.map((g) => g.id!); // TODO: resolve stale community memberships in a separate job await command(RefreshCommunityMemberships(), { @@ -37,31 +65,15 @@ export function GetMemberships(): Query { }); const memberships = await models.Membership.findAll({ - where: { - group_id: { [Op.in]: groups.map((g) => g.id!) }, - address_id: addr.id!, - }, - include: [{ model: models.Group, as: 'group' }], + where: { group_id: { [Op.in]: ids }, address_id: addr.id! }, }); - const topics = await models.Topic.findAll({ - where: { group_ids: { [Op.overlap]: groups.map((g) => g.id!) } }, - attributes: ['id', 'group_ids'], - }); + const topic_permissions = buildTopicPermissionsMap(groups); // transform memberships to result shape return memberships.map(({ group_id, reject_reason }) => ({ groupId: group_id, - topics: topics - .filter((t) => t.group_ids!.includes(group_id)) - .map((t) => ({ - id: t.id!, - permissions: - groups - .find((g) => g.id === group_id) - ?.GroupPermissions?.find((gtp) => gtp.topic_id === t.id) - ?.allowed_actions || [], - })), + topics: topic_permissions.get(group_id) || [], isAllowed: !reject_reason, rejectReason: reject_reason || undefined, })); diff --git a/libs/model/src/aggregates/community/GetTopics.query.ts b/libs/model/src/aggregates/community/GetTopics.query.ts index c7afb0d6271..23c204987df 100644 --- a/libs/model/src/aggregates/community/GetTopics.query.ts +++ b/libs/model/src/aggregates/community/GetTopics.query.ts @@ -80,7 +80,6 @@ export function GetTopics(): Query { t.default_offchain_template, t."order", t.channel_id, - t.group_ids, t.weighted_voting, t.token_symbol, t.vote_weight_multiplier, diff --git a/libs/model/src/aggregates/community/UpdateGroup.command.ts b/libs/model/src/aggregates/community/UpdateGroup.command.ts index af5b5c61281..735422d68d4 100644 --- a/libs/model/src/aggregates/community/UpdateGroup.command.ts +++ b/libs/model/src/aggregates/community/UpdateGroup.command.ts @@ -1,7 +1,7 @@ import { InvalidInput, type Command } from '@hicommonwealth/core'; import * as schemas from '@hicommonwealth/schemas'; import { Op } from 'sequelize'; -import { models, sequelize } from '../../database'; +import { models } from '../../database'; import { authRoles } from '../../middleware'; import { mustExist } from '../../middleware/guards'; import { GroupAttributes } from '../../models'; @@ -51,42 +51,6 @@ export function UpdateGroup(): Command { await group.update(updates, { transaction }); if (topics.length > 0) { - const ids = topics.map(({ id }) => id!); - await models.Topic.update( - { - group_ids: sequelize.fn( - 'array_append', - sequelize.col('group_ids'), - group_id, - ), - }, - { - where: { - id: { [Op.in]: ids }, - [Op.not]: { group_ids: { [Op.contains]: [group_id] } }, - }, - transaction, - }, - ); - - // remove group from existing group topics - await models.Topic.update( - { - group_ids: sequelize.fn( - 'array_remove', - sequelize.col('group_ids'), - group_id, - ), - }, - { - where: { - id: { [Op.notIn]: ids }, - group_ids: { [Op.contains]: [group_id] }, - }, - transaction, - }, - ); - // update topic level interaction permissions for current group await Promise.all( (payload.topics || [])?.map(async (t) => { @@ -101,7 +65,7 @@ export function UpdateGroup(): Command { VALUES (:group_id, :topic_id, ${allowed_actions}, NOW(), NOW()) ON CONFLICT(group_id, topic_id) DO UPDATE SET allowed_actions = EXCLUDED.allowed_actions, - updated_at = NOW(); + updated_at = NOW(); `, { transaction, diff --git a/libs/model/src/aggregates/community/UpdateTopic.command.ts b/libs/model/src/aggregates/community/UpdateTopic.command.ts index 646923eeb02..b982f5ae5d7 100644 --- a/libs/model/src/aggregates/community/UpdateTopic.command.ts +++ b/libs/model/src/aggregates/community/UpdateTopic.command.ts @@ -28,7 +28,6 @@ export function UpdateTopic(): Command { name, description, telegram, - group_ids, featured_in_sidebar, featured_in_new_post, allow_tokenized_threads, @@ -55,9 +54,6 @@ export function UpdateTopic(): Command { if (typeof telegram !== 'undefined') { topic.telegram = telegram || ''; } - if (Array.isArray(group_ids)) { - topic.group_ids = group_ids; - } if (typeof featured_in_sidebar !== 'undefined') { topic.featured_in_sidebar = featured_in_sidebar || false; } diff --git a/libs/model/src/middleware/auth.ts b/libs/model/src/middleware/auth.ts index 6a3da679e41..a178e55fd35 100644 --- a/libs/model/src/middleware/auth.ts +++ b/libs/model/src/middleware/auth.ts @@ -251,8 +251,6 @@ async function hasTopicPermissions( const topic = await models.Topic.findOne({ where: { id: topic_id } }); if (!topic) throw new InvalidInput('Topic not found'); - if (topic.group_ids?.length === 0) return; - // check if user has permission to perform "action" in 'topic_id' // the 'topic_id' can belong to any group where user has membership // the group with 'topic_id' having higher permissions will take precedence @@ -262,11 +260,16 @@ async function hasTopicPermissions( } >( ` - SELECT g.*, gp.topic_id, gp.allowed_actions - FROM "Groups" as g - JOIN "GroupPermissions" gp ON g.id = gp.group_id - WHERE g.community_id = :community_id - AND gp.topic_id = :topic_id + SELECT + g.*, + gp.topic_id, + gp.allowed_actions + FROM + "Groups" as g + JOIN "GroupPermissions" gp ON g.id = gp.group_id + WHERE + g.community_id = :community_id + AND gp.topic_id = :topic_id `, { type: QueryTypes.SELECT, @@ -277,6 +280,7 @@ async function hasTopicPermissions( }, }, ); + if (!groups || groups.length === 0) return; // There are 2 cases here. We either have the old group permission system where the group doesn't have // any group_allowed_actions, or we have the new fine-grained permission system where the action must be in diff --git a/libs/model/src/models/topic.ts b/libs/model/src/models/topic.ts index b58f9ad7eaa..965146e8f15 100644 --- a/libs/model/src/models/topic.ts +++ b/libs/model/src/models/topic.ts @@ -44,11 +44,6 @@ export default ( allowNull: true, }, channel_id: { type: Sequelize.STRING, allowNull: true }, - group_ids: { - type: Sequelize.ARRAY(Sequelize.INTEGER), - allowNull: false, - defaultValue: [], - }, telegram: { type: Sequelize.STRING, allowNull: true }, weighted_voting: { type: Sequelize.STRING, allowNull: true }, chain_node_id: { type: Sequelize.INTEGER, allowNull: true }, diff --git a/libs/model/test/contest/check-contests.spec.ts b/libs/model/test/contest/check-contests.spec.ts index c1ea297f84a..efe5ea72b9f 100644 --- a/libs/model/test/contest/check-contests.spec.ts +++ b/libs/model/test/contest/check-contests.spec.ts @@ -47,7 +47,6 @@ describe.skip('Check Contests', () => { id: topicId, name: 'hello', community_id: communityId, - group_ids: [], }, ], contest_managers: [ diff --git a/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts index 1b48f5647f2..cdd6c635b57 100644 --- a/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts +++ b/libs/model/test/contest/contest-worker-policy-lifecycle.spec.ts @@ -53,7 +53,6 @@ describe('Contest Worker Policy Lifecycle', () => { id: topicId, name: 'hello', community_id: communityId, - group_ids: [], }, ], contest_managers: [ diff --git a/libs/model/test/thread/thread-lifecycle.spec.ts b/libs/model/test/thread/thread-lifecycle.spec.ts index 5ba686aea24..707a16a0482 100644 --- a/libs/model/test/thread/thread-lifecycle.spec.ts +++ b/libs/model/test/thread/thread-lifecycle.spec.ts @@ -130,17 +130,10 @@ describe('Thread lifecycle', () => { topics: [ { name: 'topic with permissions', - group_ids: [threadGroupId, commentGroupId], weighted_voting: TopicWeightedVoting.Stake, }, - { - name: 'topic without thread permissions', - group_ids: [emptyGroupId], - }, - { - name: 'topic without groups', - group_ids: [], - }, + { name: 'topic without thread permissions' }, + { name: 'topic without groups' }, ], CommunityStakes: [ { @@ -154,7 +147,7 @@ describe('Thread lifecycle', () => { }); await seed('GroupPermission', { group_id: threadGroupId, - topic_id: _community?.topics?.[0]?.id || 0, + topic_id: _community!.topics![0]!.id, allowed_actions: [ schemas.PermissionEnum.CREATE_THREAD, schemas.PermissionEnum.CREATE_THREAD_REACTION, @@ -163,12 +156,12 @@ describe('Thread lifecycle', () => { }); await seed('GroupPermission', { group_id: commentGroupId, - topic_id: _community?.topics?.[0]?.id || 0, + topic_id: _community!.topics![0]!.id, allowed_actions: [schemas.PermissionEnum.CREATE_COMMENT], }); await seed('GroupPermission', { group_id: emptyGroupId, - topic_id: _community?.topics?.[1]?.id || 0, + topic_id: _community!.topics![1]!.id, allowed_actions: [], }); diff --git a/libs/model/test/util-tests/getCommentDepth.spec.ts b/libs/model/test/util-tests/getCommentDepth.spec.ts index f692faefc8b..2eab8be1d59 100644 --- a/libs/model/test/util-tests/getCommentDepth.spec.ts +++ b/libs/model/test/util-tests/getCommentDepth.spec.ts @@ -28,7 +28,6 @@ describe('getCommentDepth', () => { description: 'test', featured_in_sidebar: false, featured_in_new_post: false, - group_ids: [], }); const thread = await models.Thread.create({ community_id, diff --git a/libs/model/test/utils/community-seeder.ts b/libs/model/test/utils/community-seeder.ts index 289d96f91c4..da91382aadf 100644 --- a/libs/model/test/utils/community-seeder.ts +++ b/libs/model/test/utils/community-seeder.ts @@ -108,12 +108,7 @@ export async function seedCommunity({ }; }), groups: groups.map(({ id }) => ({ id })), - topics: [ - { - group_ids: groups.map(({ id }) => id), - weighted_voting, - }, - ], + topics: [{ weighted_voting }], CommunityStakes: stakes ?? [], custom_stages, }); diff --git a/libs/schemas/src/commands/community.schemas.ts b/libs/schemas/src/commands/community.schemas.ts index c8c3a795488..1d719e79e89 100644 --- a/libs/schemas/src/commands/community.schemas.ts +++ b/libs/schemas/src/commands/community.schemas.ts @@ -216,7 +216,6 @@ export const UpdateTopic = { Topic.pick({ name: true, description: true, - group_ids: true, telegram: true, featured_in_sidebar: true, featured_in_new_post: true, diff --git a/libs/schemas/src/entities/topic.schemas.ts b/libs/schemas/src/entities/topic.schemas.ts index cdbb989f8ab..1c84bde5a89 100644 --- a/libs/schemas/src/entities/topic.schemas.ts +++ b/libs/schemas/src/entities/topic.schemas.ts @@ -26,7 +26,6 @@ export const Topic = z.object({ default_offchain_template: z.string().nullish(), order: PG_INT.nullish(), channel_id: z.string().max(255).nullish(), - group_ids: z.array(PG_INT).default([]), default_offchain_template_backup: z.string().nullish(), weighted_voting: z.nativeEnum(TopicWeightedVoting).nullish(), chain_node_id: z diff --git a/libs/schemas/src/queries/community.schemas.ts b/libs/schemas/src/queries/community.schemas.ts index c0cd61042b3..f3fb7bf6019 100644 --- a/libs/schemas/src/queries/community.schemas.ts +++ b/libs/schemas/src/queries/community.schemas.ts @@ -100,25 +100,25 @@ export const GetCommunity = { output: z.union([ExtendedCommunity, z.undefined()]), }; +export const TopicPermissionsView = z.object({ + id: z.number(), + permissions: z.array(z.nativeEnum(PermissionEnum)), +}); + +export const MembershipView = z.object({ + groupId: z.number(), + topics: TopicPermissionsView.array(), + isAllowed: z.boolean(), + rejectReason: MembershipRejectReason, +}); + export const GetMemberships = { input: z.object({ community_id: z.string(), address: z.string(), topic_id: z.number().optional(), }), - output: z - .object({ - groupId: z.number(), - topics: z - .object({ - id: z.number(), - permissions: z.array(z.nativeEnum(PermissionEnum)), - }) - .array(), - isAllowed: z.boolean(), - rejectReason: MembershipRejectReason, - }) - .array(), + output: MembershipView.array(), }; export const GetCommunityStake = { diff --git a/packages/commonwealth/client/scripts/utils/mapProfileThread.ts b/packages/commonwealth/client/scripts/utils/mapProfileThread.ts index ead4eeaf31c..8904a868154 100644 --- a/packages/commonwealth/client/scripts/utils/mapProfileThread.ts +++ b/packages/commonwealth/client/scripts/utils/mapProfileThread.ts @@ -24,7 +24,6 @@ export function mapProfileThread(thread): Thread { created_at: '', featured_in_sidebar: false, featured_in_new_post: false, - group_ids: [], active_contest_managers: [], total_threads: 0, allow_tokenized_threads: thread?.topic?.allow_tokenized_threads, diff --git a/packages/commonwealth/client/scripts/views/components/feed.tsx b/packages/commonwealth/client/scripts/views/components/feed.tsx index f9dece82e2c..b926947fe6b 100644 --- a/packages/commonwealth/client/scripts/views/components/feed.tsx +++ b/packages/commonwealth/client/scripts/views/components/feed.tsx @@ -150,7 +150,6 @@ function mapThread(thread: z.infer): Thread { created_at: '', featured_in_sidebar: false, featured_in_new_post: false, - group_ids: [], active_contest_managers: [], total_threads: 0, // If we expect to do tokenized stuff on the feed, modify this diff --git a/packages/commonwealth/client/scripts/views/pages/HomePage/TrendingThreadList/TrendingThreadList.tsx b/packages/commonwealth/client/scripts/views/pages/HomePage/TrendingThreadList/TrendingThreadList.tsx index 321ab042081..3b6d61b1878 100644 --- a/packages/commonwealth/client/scripts/views/pages/HomePage/TrendingThreadList/TrendingThreadList.tsx +++ b/packages/commonwealth/client/scripts/views/pages/HomePage/TrendingThreadList/TrendingThreadList.tsx @@ -162,7 +162,6 @@ function mapThread(thread: z.infer): Thread { created_at: '', featured_in_sidebar: false, featured_in_new_post: false, - group_ids: [], active_contest_managers: [], total_threads: 0, // If we expect to do tokenized stuff on the community homepage, modify this diff --git a/packages/commonwealth/server/migrations/20250512150000-remove-group-ids-from-topic.js b/packages/commonwealth/server/migrations/20250512150000-remove-group-ids-from-topic.js new file mode 100644 index 00000000000..d4b4b0d7766 --- /dev/null +++ b/packages/commonwealth/server/migrations/20250512150000-remove-group-ids-from-topic.js @@ -0,0 +1,14 @@ +'use strict'; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface) { + await queryInterface.sequelize.transaction(async (transaction) => { + await queryInterface.removeColumn('Topics', 'group_ids', { + transaction, + }); + }); + }, + + async down() {}, +}; diff --git a/packages/commonwealth/test/integration/api/createReactions.spec.ts b/packages/commonwealth/test/integration/api/createReactions.spec.ts index 856e1de6cf3..0a7e27dba10 100644 --- a/packages/commonwealth/test/integration/api/createReactions.spec.ts +++ b/packages/commonwealth/test/integration/api/createReactions.spec.ts @@ -69,10 +69,7 @@ describe('createReaction Integration Tests', () => { userSession = { session: res.session, sign: res.sign }; const topic = await server.models.Topic.findOne({ - where: { - community_id: communityId, - group_ids: [], - }, + where: { community_id: communityId }, }); const { result: thread } = await server.seeder.createThread({ diff --git a/packages/commonwealth/test/integration/api/linking.spec.ts b/packages/commonwealth/test/integration/api/linking.spec.ts index c3bf74609d7..65527152dfe 100644 --- a/packages/commonwealth/test/integration/api/linking.spec.ts +++ b/packages/commonwealth/test/integration/api/linking.spec.ts @@ -60,10 +60,7 @@ describe('Linking Tests', () => { server = await testServer(); const topic = await server.models.Topic.findOne({ - where: { - community_id: chain, - group_ids: [], - }, + where: { community_id: chain }, }); // @ts-expect-error StrictNullChecks topicId = topic.id; diff --git a/packages/commonwealth/test/integration/api/polls.spec.ts b/packages/commonwealth/test/integration/api/polls.spec.ts index 10b61e185d0..4ade3cf25c0 100644 --- a/packages/commonwealth/test/integration/api/polls.spec.ts +++ b/packages/commonwealth/test/integration/api/polls.spec.ts @@ -39,10 +39,7 @@ describe('Polls', () => { server = await testServer(); const topic = await server.models.Topic.findOne({ - where: { - community_id: chain, - group_ids: [], - }, + where: { community_id: chain }, }); // @ts-expect-error StrictNullChecks topicId = topic.id; diff --git a/packages/commonwealth/test/integration/api/thread.update.spec.ts b/packages/commonwealth/test/integration/api/thread.update.spec.ts index 5295350db29..5a645160392 100644 --- a/packages/commonwealth/test/integration/api/thread.update.spec.ts +++ b/packages/commonwealth/test/integration/api/thread.update.spec.ts @@ -87,10 +87,7 @@ describe('Thread Patch Update', () => { } const topic = await server.models.Topic.findOne({ - where: { - community_id: chain, - group_ids: [], - }, + where: { community_id: chain }, }); // @ts-expect-error StrictNullChecks topicId = topic.id; diff --git a/packages/commonwealth/test/integration/api/userDashboard.spec.ts b/packages/commonwealth/test/integration/api/userDashboard.spec.ts index f4ef85b5ca6..813e6760a6c 100644 --- a/packages/commonwealth/test/integration/api/userDashboard.spec.ts +++ b/packages/commonwealth/test/integration/api/userDashboard.spec.ts @@ -46,10 +46,7 @@ describe('User Dashboard API', () => { server = await testServer(); const topic = await server.models.Topic.findOne({ - where: { - community_id: chain, - group_ids: [], - }, + where: { community_id: chain }, }); // @ts-expect-error StrictNullChecks topicId = topic.id; @@ -60,7 +57,6 @@ describe('User Dashboard API', () => { community_id: chain2, featured_in_sidebar: false, featured_in_new_post: false, - group_ids: [], }); // @ts-expect-error StrictNullChecks topicId2 = topic2.id; diff --git a/packages/commonwealth/test/integration/databaseCleaner.spec.ts b/packages/commonwealth/test/integration/databaseCleaner.spec.ts index 45d831095fb..1f26eff8ab4 100644 --- a/packages/commonwealth/test/integration/databaseCleaner.spec.ts +++ b/packages/commonwealth/test/integration/databaseCleaner.spec.ts @@ -90,7 +90,6 @@ describe('DatabaseCleaner Tests', async () => { description: 'test-123', featured_in_sidebar: false, featured_in_new_post: false, - group_ids: [], }); const thread = await models.Thread.create({