diff --git a/packages/client/modules/demo/ClientGraphQLServer.ts b/packages/client/modules/demo/ClientGraphQLServer.ts index 9a3810b6839..57802de3a78 100644 --- a/packages/client/modules/demo/ClientGraphQLServer.ts +++ b/packages/client/modules/demo/ClientGraphQLServer.ts @@ -164,6 +164,14 @@ const makeReflectionGroupThread = () => ({ } }) +const BOT_GROUP_TITLES: Record = { + botGroup1: 'Empower Junior Staff', + botGroup2: 'Documentation Practices', + botGroup4: 'Chat Communication Issues', + botGroup5: 'Unproductive Discussions', + botGroup6: 'Meeting Overload' +} + class ClientGraphQLServer extends (EventEmitter as GQLDemoEmitter) { atmosphere: LocalAtmosphere db: RetroDemoDB @@ -1579,6 +1587,26 @@ class ClientGraphQLServer extends (EventEmitter as GQLDemoEmitter) { this.emit(SubscriptionChannel.MEETING, data) } return {updateCommentContent: data} + }, + async updateGroupTitle(reflectionGroup: DemoReflectionGroup, reflections: DemoReflection[]) { + // Use hardcoded title for bot groups, otherwise use first reflection's content + const title = + BOT_GROUP_TITLES[reflectionGroup.id] ?? + reflections[0]?.plaintextContent?.slice(0, 20) ?? + 'New Group' + + reflectionGroup.smartTitle = title + if (!reflectionGroup.titleIsUserDefined) { + reflectionGroup.title = title + } + + const data = { + __typename: 'UpdateReflectionGroupTitlePayload', + meetingId: RetroDemo.MEETING_ID, + reflectionGroupId: reflectionGroup.id, + title + } + this.emit(SubscriptionChannel.MEETING, data) } } as const diff --git a/packages/client/modules/demo/getDemoEntities.ts b/packages/client/modules/demo/getDemoEntities.ts index a023e6d7d29..2d75c823957 100644 --- a/packages/client/modules/demo/getDemoEntities.ts +++ b/packages/client/modules/demo/getDemoEntities.ts @@ -3,6 +3,18 @@ import {fetchQuery} from 'relay-runtime' import {getDemoEntitiesQuery} from '~/__generated__/getDemoEntitiesQuery.graphql' import Atmosphere from '../../Atmosphere' +const BOT_GROUP_TITLES: Record = { + botGroup1: 'Empower Junior Staff', + botGroup2: 'Documentation Practices', + botGroup4: 'Chat Communication Issues', + botGroup5: 'Unproductive Discussions', + botGroup6: 'Meeting Overload' +} + +export const getDemoGroupTitle = (groupId: string, firstReflectionContent?: string) => { + return BOT_GROUP_TITLES[groupId] ?? firstReflectionContent ?? 'New Group' +} + const query = graphql` query getDemoEntitiesQuery($text: String!) { getDemoEntities(text: $text) { diff --git a/packages/server/graphql/mutations/helpers/processEmailPasswordReset.ts b/packages/server/graphql/mutations/helpers/processEmailPasswordReset.ts index f9b94215737..3e3fc7b52cf 100644 --- a/packages/server/graphql/mutations/helpers/processEmailPasswordReset.ts +++ b/packages/server/graphql/mutations/helpers/processEmailPasswordReset.ts @@ -14,7 +14,8 @@ const processEmailPasswordReset = async ( ip: string, email: string, identities: AuthIdentity[], - userId: string + userId: string, + sendEmail?: boolean | null ) => { const pg = getKysely() const tokenBuffer = await randomBytes(48) @@ -38,6 +39,8 @@ const processEmailPasswordReset = async ( await updateUser({identities}, userId) + if (sendEmail === false) return {success: true} + const {subject, body, html} = resetPasswordEmailCreator({resetPasswordToken}) const success = await getMailManager().sendEmail({ to: email, diff --git a/packages/server/graphql/private/mutations/removeAuthIdentity.ts b/packages/server/graphql/private/mutations/removeAuthIdentity.ts index 88b4d689cf8..11d8ab4aadb 100644 --- a/packages/server/graphql/private/mutations/removeAuthIdentity.ts +++ b/packages/server/graphql/private/mutations/removeAuthIdentity.ts @@ -8,7 +8,7 @@ import {MutationResolvers} from '../../private/resolverTypes' const removeAuthIdentity: MutationResolvers['removeAuthIdentity'] = async ( _source, - {domain, identityType, addLocal}, + {domain, identityType, addLocal, sendEmail = true}, {ip} ) => { // VALIDATION @@ -44,7 +44,7 @@ const removeAuthIdentity: MutationResolvers['removeAuthIdentity'] = async ( await Promise.all( usersWithUpdatedIdentities.map(({identities, id: userId, email}) => - processEmailPasswordReset(ip, email, identities, userId) + processEmailPasswordReset(ip, email, identities, userId, sendEmail) ) ) diff --git a/packages/server/graphql/private/typeDefs/Mutation.graphql b/packages/server/graphql/private/typeDefs/Mutation.graphql index 4eba09faf86..d1483933201 100644 --- a/packages/server/graphql/private/typeDefs/Mutation.graphql +++ b/packages/server/graphql/private/typeDefs/Mutation.graphql @@ -474,6 +474,11 @@ type Mutation { Add a local auth with a dummy hashed password """ addLocal: Boolean! + + """ + Send an email to the user to let them know their auth identity has been removed and they need to reset their password. Defaults to true. + """ + sendEmail: Boolean ): RemoveAuthIdentityPayload! """