diff --git a/.env.example b/.env.example index 2dbf69c8e..9a0a58f1c 100644 --- a/.env.example +++ b/.env.example @@ -25,5 +25,3 @@ TWITCH_CLIENT_ID= TWITCH_CLIENT_SECRET= SKALOP_WS_URL=ws://localhost:5900 - -FF_ENABLE_CHAT=false diff --git a/app/db/seed/index.ts b/app/db/seed/index.ts index ae12a3a1f..c456f3ec0 100644 --- a/app/db/seed/index.ts +++ b/app/db/seed/index.ts @@ -1736,7 +1736,6 @@ function playedMatches() { alphaGroupId: groupAlpha, bravoGroupId: groupBravo, mapList: randomMapList(groupAlpha, groupBravo), - addChatCode: false, }); // update match createdAt to the past diff --git a/app/features/sendouq/core/groups.server.ts b/app/features/sendouq/core/groups.server.ts index 13b2d78af..032bfc400 100644 --- a/app/features/sendouq/core/groups.server.ts +++ b/app/features/sendouq/core/groups.server.ts @@ -235,12 +235,3 @@ export function groupExpiryStatus( return null; } - -export function hasAccessToChat(isByAdmin: boolean) { - const ff = process.env["FF_ENABLE_CHAT"]; - - if (ff === "true") return true; - if (ff === "admin") return isByAdmin; - - return false; -} diff --git a/app/features/sendouq/queries/createGroup.server.ts b/app/features/sendouq/queries/createGroup.server.ts index c8a218ba2..c73e54396 100644 --- a/app/features/sendouq/queries/createGroup.server.ts +++ b/app/features/sendouq/queries/createGroup.server.ts @@ -3,8 +3,6 @@ import { INVITE_CODE_LENGTH } from "~/constants"; import { sql } from "~/db/sql"; import type { Group, GroupMember } from "~/db/types"; import type { MapPool } from "~/modules/map-pool-serializer"; -import { isAdmin } from "~/permissions"; -import { hasAccessToChat } from "../core/groups.server"; const createGroupStm = sql.prepare(/* sql */ ` insert into "Group" @@ -41,9 +39,7 @@ export const createGroup = sql.transaction((args: CreateGroupArgs) => { mapListPreference: args.mapListPreference, inviteCode: nanoid(INVITE_CODE_LENGTH), status: args.status, - chatCode: hasAccessToChat(isAdmin({ id: args.userId })) - ? nanoid(INVITE_CODE_LENGTH) - : null, + chatCode: nanoid(INVITE_CODE_LENGTH), }) as Group; createGroupMemberStm.run({ diff --git a/app/features/sendouq/queries/createMatch.server.ts b/app/features/sendouq/queries/createMatch.server.ts index 127c5cbe0..afd12ac2d 100644 --- a/app/features/sendouq/queries/createMatch.server.ts +++ b/app/features/sendouq/queries/createMatch.server.ts @@ -38,17 +38,15 @@ export const createMatch = sql.transaction( alphaGroupId, bravoGroupId, mapList, - addChatCode, }: { alphaGroupId: number; bravoGroupId: number; - addChatCode: boolean; mapList: TournamentMapListMap[]; }) => { const match = createMatchStm.get({ alphaGroupId, bravoGroupId, - chatCode: addChatCode ? nanoid(10) : null, + chatCode: nanoid(10), }) as GroupMatch; for (const [i, { mode, source, stageId }] of mapList.entries()) { diff --git a/app/features/sendouq/queries/morphGroups.server.ts b/app/features/sendouq/queries/morphGroups.server.ts index b8babdae3..0c2a108cf 100644 --- a/app/features/sendouq/queries/morphGroups.server.ts +++ b/app/features/sendouq/queries/morphGroups.server.ts @@ -36,12 +36,10 @@ export const morphGroups = sql.transaction( survivingGroupId, otherGroupId, newMembers, - addChatCode, }: { survivingGroupId: number; otherGroupId: number; newMembers: number[]; - addChatCode: boolean; }) => { const toBeDeletedGroupNonRegulars = findToBeDeletedGroupNonRegularsStm .all({ groupId: otherGroupId }) @@ -53,12 +51,10 @@ export const morphGroups = sql.transaction( deleteLikesByGroupId(survivingGroupId); // reset chat code so previous messages are not visible - if (addChatCode) { - updateGroupStm.run({ - groupId: survivingGroupId, - chatCode: nanoid(10), - }); - } + updateGroupStm.run({ + groupId: survivingGroupId, + chatCode: nanoid(10), + }); for (const userId of newMembers) { const role: GroupMember["role"] = toBeDeletedGroupNonRegulars.includes( diff --git a/app/features/sendouq/routes/q.looking.tsx b/app/features/sendouq/routes/q.looking.tsx index 4cfa8cd88..fae03b16b 100644 --- a/app/features/sendouq/routes/q.looking.tsx +++ b/app/features/sendouq/routes/q.looking.tsx @@ -36,7 +36,6 @@ import { divideGroups, filterOutGroupsWithIncompatibleMapListPreference, groupExpiryStatus, - hasAccessToChat, membersNeededForFull, } from "../core/groups.server"; import { matchMapList } from "../core/match.server"; @@ -69,7 +68,6 @@ import { groupHasMatch } from "../queries/groupHasMatch.server"; import { findRecentMatchPlayersByUserId } from "../queries/findRecentMatchPlayersByUserId.server"; import { currentOrPreviousSeason } from "~/features/mmr/season"; import { Chat, useChat } from "~/components/Chat"; -import { isAdmin } from "~/permissions"; import { NewTabs } from "~/components/NewTabs"; import { useWindowSize } from "~/hooks/useWindowSize"; @@ -172,9 +170,6 @@ export const action: ActionFunction = async ({ request }) => { survivingGroupId, otherGroupId: otherGroup.id, newMembers: otherGroup.members.map((m) => m.id), - addChatCode: hasAccessToChat( - ourGroup.members.some(isAdmin) || theirGroup.members.some(isAdmin), - ), }); refreshGroup(survivingGroupId); @@ -223,9 +218,6 @@ export const action: ActionFunction = async ({ request }) => { const createdMatch = createMatch({ alphaGroupId: ourGroup.id, bravoGroupId: theirGroup.id, - addChatCode: hasAccessToChat( - ourGroup.members.some(isAdmin) || theirGroup.members.some(isAdmin), - ), mapList: matchMapList({ ourGroup, theirGroup,