-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow retro meeting series naming (#9348)
- Loading branch information
1 parent
7505fc3
commit 894b716
Showing
14 changed files
with
156 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import ms from 'ms' | ||
import {RRule} from 'rrule' | ||
import getRethink from '../database/rethinkDriver' | ||
import MeetingTeamPrompt from '../database/types/MeetingTeamPrompt' | ||
import TeamPromptResponsesPhase from '../database/types/TeamPromptResponsesPhase' | ||
import generateUID from '../generateUID' | ||
import {insertMeetingSeries as insertMeetingSeriesQuery} from '../postgres/queries/insertMeetingSeries' | ||
import {getUserTeams, sendIntranet, sendPublic, signUp} from './common' | ||
|
||
test('Retro is named Retro #1 by default', async () => { | ||
const r = await getRethink() | ||
const {userId, authToken} = await signUp() | ||
const {id: teamId} = (await getUserTeams(userId))[0] | ||
|
||
const newRetro = await sendPublic({ | ||
query: ` | ||
mutation StartRetrospectiveMutation($teamId: ID!, $recurrenceSettings: RecurrenceSettingsInput, $gcalInput: CreateGcalEventInput) { | ||
startRetrospective(teamId: $teamId, recurrenceSettings: $recurrenceSettings, gcalInput: $gcalInput) { | ||
... on ErrorPayload { | ||
error { | ||
message | ||
} | ||
} | ||
... on StartRetrospectiveSuccess { | ||
meeting { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
teamId | ||
}, | ||
authToken | ||
}) | ||
expect(newRetro).toMatchObject({ | ||
data: { | ||
startRetrospective: { | ||
meeting: { | ||
id: expect.anything(), | ||
name: 'Retro 1' | ||
} | ||
} | ||
} | ||
}) | ||
}) | ||
|
||
test('Recurring retro is named like RetroSeries Jan 1', async () => { | ||
const r = await getRethink() | ||
const {userId, authToken} = await signUp() | ||
const {id: teamId} = (await getUserTeams(userId))[0] | ||
|
||
const now = new Date() | ||
const newRetro = await sendPublic({ | ||
query: ` | ||
mutation StartRetrospectiveMutation($teamId: ID!, $recurrenceSettings: RecurrenceSettingsInput, $gcalInput: CreateGcalEventInput) { | ||
startRetrospective(teamId: $teamId, recurrenceSettings: $recurrenceSettings, gcalInput: $gcalInput) { | ||
... on ErrorPayload { | ||
error { | ||
message | ||
} | ||
} | ||
... on StartRetrospectiveSuccess { | ||
meeting { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
} | ||
`, | ||
variables: { | ||
teamId, | ||
recurrenceSettings: { | ||
rrule: 'DTSTART;TZID=Europe/Berlin:20240117T060000\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE', | ||
name: 'RetroSeries' | ||
} | ||
}, | ||
authToken | ||
}) | ||
|
||
const formattedDate = now.toLocaleDateString('en-US', {month: 'short', day: 'numeric'}, 'UTC') | ||
expect(newRetro).toMatchObject({ | ||
data: { | ||
startRetrospective: { | ||
meeting: { | ||
id: expect.anything(), | ||
name: `RetroSeries - ${formattedDate}` | ||
} | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/server/graphql/mutations/helpers/createMeetingSeriesTitle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export function createMeetingSeriesTitle( | ||
meetingSeriesName: string, | ||
startTime: Date, | ||
timeZone: string | ||
) { | ||
const formattedDate = startTime.toLocaleDateString('en-US', { | ||
month: 'short', | ||
day: 'numeric', | ||
timeZone | ||
}) | ||
|
||
return `${meetingSeriesName} - ${formattedDate}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.