Skip to content
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

2992_Core_mapping_the_created_items_are_disapeared_after_logout_gameplay #2993

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const actionHandlers: Record<string, ActionHandler> = {
newState.feedbackMessages = (action as SetWargameFeedbackAction).payload
},
[SET_LATEST_FEEDBACK_MESSAGE]: (newState, action) => {
newState.feedbackMessages.unshift(
newState.feedbackMessages.push(
(action as SetLatestFeedbackMessageAction).payload
)
},
Expand Down
1 change: 0 additions & 1 deletion client/src/Components/CoreMappingChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const CoreMappingChannel: React.FC<{ channelId: string }> = ({ channelId }) => {
const messageHandler = (message: MappingMessage | MappingMessageDelta): void => {
sendMappingMessage(state.currentWargame, message)
}

const coreMappingComponent = useMemo(() => {
return <CoreMapping
postBack={messageHandler}
Expand Down
3 changes: 2 additions & 1 deletion client/src/Components/local/atoms/core-mapping/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ const CoreMapping: React.FC<PropTypes> = ({ messages, channel, playerForce, play
const custMessage = message as MappingMessage | MappingMessageDelta
return custMessage.messageType === MAPPING_MESSAGE || custMessage.messageType === MAPPING_MESSAGE_DELTA
} else return false
})
}).reverse()

if (mappingMessages.length) {
const mappingMessage = mappingMessages.find((msg: Message) => msg.messageType === MAPPING_MESSAGE)
if (mappingMessage) {
Expand Down
9 changes: 3 additions & 6 deletions client/src/Helpers/handle-channel-updates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CHANNEL_CHAT, CHANNEL_COLLAB, CHAT_CHANNEL_ID, CUSTOM_MESSAGE, expiredStorage, INFO_MESSAGE, INFO_MESSAGE_CLIPPED } from 'src/config'
import { CHANNEL_COLLAB, CHAT_CHANNEL_ID, CUSTOM_MESSAGE, expiredStorage, INFO_MESSAGE, INFO_MESSAGE_CLIPPED } from 'src/config'
import {
ChannelTypes, ChannelUI, ForceData, MessageChannel,
MessageCustom, MessageInfoType, MessageInfoTypeClipped, PlayerMessage, PlayerMessageLog, PlayerUiChannels, PlayerUiChatChannel, Role, SetWargameMessage, TemplateBodysByKey
Expand Down Expand Up @@ -86,11 +86,8 @@ const handleNonInfoMessage = (data: SetWargameMessage, channel: string, message:
const present = theChannel.messages.some((msg: MessageChannel) => msg._id === message._id)
if (!present) {
// chat messages need to go at the end, not the start
if (theChannel.cData.channelType === CHANNEL_CHAT) {
theChannel.messages.push(newObj)
} else {
theChannel.messages.unshift(newObj)
}
theChannel.messages.push(newObj)

Copy link
Contributor

@IanMayo IanMayo Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @lilitkarapetyan - I'm nervous about the impact of this change across all of the channels that use this logic. Could you check please new messages get added properly to each type of channel (including mapping).

Actually, @Tristina1788 - it could do with a good test from you too, please. We need to check messages are shown in the correct order in all channel types, and that new messages are correctly shown. This should also include changes to message in a Collab channel.

// update message count, if it's not from us
if (!ourMessage) {
theChannel.unreadMessageCount = (theChannel.unreadMessageCount || 0) + 1
Expand Down
Loading