Skip to content

Commit

Permalink
renames to resultingChatInfoMessage for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarsh-scottlogic committed Mar 22, 2024
1 parent 3740636 commit 06ecc27
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/controller/resetController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function handleResetLevel(req: LevelResetRequest, res: Response) {
req.session.levelState[level].chatHistory = [];
req.session.levelState[level].sentEmails = [];
res.send({
resultingChatMessage: {
resultingChatInfoMessage: {
infoMessage: `Level progress reset`,
chatMessageType: 'RESET_LEVEL',
} as ChatInfoMessage,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/api/LevelResetRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { LEVEL_NAMES } from '@src/models/level';
export type LevelResetRequest = Request<
never,
{
resultingChatMessage?: ChatMessage;
resultingChatInfoMessage?: ChatMessage;
},
never,
{
Expand Down
2 changes: 1 addition & 1 deletion backend/test/unit/controller/resetController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('reset level', () => {
expect(req.session.levelState[level].sentEmails).toEqual([]);

expect(mockSend).toHaveBeenCalledWith({
resultingChatMessage: {
resultingChatInfoMessage: {
infoMessage: 'Level progress reset',
chatMessageType: 'RESET_LEVEL',
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/MainComponent/MainComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ function MainComponent({
// for clearing single level progress
async function resetLevel() {
// reset on the backend
const resultingChatMessage = await resetService.resetLevelProgress(
const resultingChatInfoMessage = await resetService.resetLevelProgress(
currentLevel
);

resetFrontendState();
setMessages((messages: ChatMessage[]) => [
resultingChatMessage,
resultingChatInfoMessage,
...messages,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/models/apiResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type LoadLevelResponse = {
};

type ResetLevelResponse = {
resultingChatMessage: ChatMessageDTO;
resultingChatInfoMessage: ChatMessageDTO;
};

export type { StartResponse, LoadLevelResponse, ResetLevelResponse };
4 changes: 2 additions & 2 deletions frontend/src/service/resetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ async function resetLevelProgress(level: number) {
'Content-Type': 'application/json',
},
});
const { resultingChatMessage } =
const { resultingChatInfoMessage } =
(await response.json()) as ResetLevelResponse;

return makeChatMessageFromDTO(resultingChatMessage);
return makeChatMessageFromDTO(resultingChatInfoMessage);
}

export { resetAllProgress, resetLevelProgress };

0 comments on commit 06ecc27

Please sign in to comment.