-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
741 transformed messages not showing correctly #800
741 transformed messages not showing correctly #800
Conversation
…wn in the frontend
…used stuff from file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some potential type cleanup, but this is good work 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, just some very minor advice on using undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful 👌
* combines two separate bits of logic for winning level in processChatResponse * renames increamentNumCompletedLevels to updateNumCompletedLevels * renames ChatHistoryMessage to ChatMessageDTO * refactors getChatHistory * further refactors getChatHistory to remove immutability * refactors makeChatMessageFromDTO * removed some outdated comments * adds reminder comment and transformedMessage as propery to chatHistoryMessage * sets transformed message inn chat history * adds ability to retrieve transformed message from the dto * add the transformed info message in backend rather than frontend * adds the transformedMessageInfo to the chat response so it can be shown in the frontend * combine message transformation objects into one object * tidies random sequence transformation test * finalise random sequence transformation test * tidy up xml tagging transformation test * tidy up xml tagging transformation test with escaping * removes unnecessary test and reorders * moves no transformation into transformation test block and removes unused stuff from file * moves transform message tests into separate test file * remove isTriggered from defence object * complete message transformation test * use undefined instead of null for transofrmed messages * updates test * removes isTriggered from test to make it pass * implements undefined tricks
Description
Fixes a bug where transformed messages would appear differently after page refresh. A user's transformed message stays shown with the original message in bold, and the info message "xml tagging enabled, your message has been transformed" remains.
Screenshots
Notes
main ticket changes
transformedMessage
which keeps a pre-message, message and post-message string, allowing us to render those parts of the string differently in the chat feed. The backend chat history now stores an optionaltransformedMessage
of this type, which is returned to the frontend for rendering. This fixes the transformed message appearing differently after refresh.ChatHttpResponse
testing
refactoring
processChatResponse
which were both checking if we had met the win condition.incrementNumCompletedLevels
toupdateNumCompletedLevels
(this is called when we win a level. Renamed it because we don't increment if the beaten level has been beaten before.)ChatHistoryMessage
toChatMessageDTO
(this is the object that is returned when the frontend requests the entire chat history)getChatHistory
method in frontend's chatService.ts just to make it read a bit more clearly.transformedMessage
,transformedMessageInfo
andtransformedMessageCombined
are now packaged under one object:messageTransformation
. It is an object of this type, which is now returned bytransformMessage
isTriggered
property fromDefence
because it wasn't being used anymore (replaced by defenceReport)Concerns
Checklist
Have you done the following?