mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-28 06:08:13 -05:00
Remove chat FF
This commit is contained in:
@@ -25,5 +25,3 @@ TWITCH_CLIENT_ID=
|
||||
TWITCH_CLIENT_SECRET=
|
||||
|
||||
SKALOP_WS_URL=ws://localhost:5900
|
||||
|
||||
FF_ENABLE_CHAT=false
|
||||
|
||||
@@ -1736,7 +1736,6 @@ function playedMatches() {
|
||||
alphaGroupId: groupAlpha,
|
||||
bravoGroupId: groupBravo,
|
||||
mapList: randomMapList(groupAlpha, groupBravo),
|
||||
addChatCode: false,
|
||||
});
|
||||
|
||||
// update match createdAt to the past
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user