Display Welcome Message as Most Recent Message (#4720)

* Move Join Message Block

- Moves Join Message code block to after the for loop that gets old chat message, which makes the Join Message the most recent message in the chat box instead of the oldest
-Only the rc.enqueuePostResponseItem() line really needs to move for functionality, but I have moved the whole block for readability

* Comply with formatting guide

-Remove offending white space
This commit is contained in:
SlightlyCircuitous 2022-12-11 17:40:47 -05:00 committed by GitHub
parent 26d7fe2ff0
commit 6a5e0a8501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -680,11 +680,6 @@ Response::ResponseCode Server_ProtocolHandler::cmdJoinRoom(const Command_JoinRoo
room->addClient(this);
rooms.insert(room->getId(), room);
Event_RoomSay joinMessageEvent;
joinMessageEvent.set_message(room->getJoinMessage().toStdString());
joinMessageEvent.set_message_type(Event_RoomSay::Welcome);
rc.enqueuePostResponseItem(ServerMessage::ROOM_EVENT, room->prepareRoomEvent(joinMessageEvent));
QReadLocker chatHistoryLocker(&room->historyLock);
QList<ServerInfo_ChatMessage> chatHistory = room->getChatHistory();
ServerInfo_ChatMessage chatMessage;
@ -698,6 +693,11 @@ Response::ResponseCode Server_ProtocolHandler::cmdJoinRoom(const Command_JoinRoo
rc.enqueuePostResponseItem(ServerMessage::ROOM_EVENT, room->prepareRoomEvent(roomChatHistory));
}
Event_RoomSay joinMessageEvent;
joinMessageEvent.set_message(room->getJoinMessage().toStdString());
joinMessageEvent.set_message_type(Event_RoomSay::Welcome);
rc.enqueuePostResponseItem(ServerMessage::ROOM_EVENT, room->prepareRoomEvent(joinMessageEvent));
Response_JoinRoom *re = new Response_JoinRoom;
room->getInfo(*re->mutable_room_info(), true);