Page MenuHomeWildfire Games

Fix lobby GUI Kick messages historic property following arbitrary CreateGUIMessage arguments in rP22856/D2264

Authored by elexis on Sep 11 2019, 11:56 AM.



In rP22856/D2264 the CreateGUIMessage function was reworked to consume arbitrary JS Values.
Before the commit, the "historic" property was always set, but with that commit it was only set for historic messages.
This works for chat messages ("historic": msg.historic lines in lobby.js`, but JS complains about an the property being undefined for the kick messages, and kicking is something I hadn't tested and may now pay with embarassment.

handleKick(false, msg.nick, msg.reason, msg.time, msg.historic);

The freezing should be performed for the copied historic message as well, because it is a new object, so the fact that its frozen was not transferred.

Test Plan

Join the lobby with two 0ad instances and a moderator account, have one of the players kicked, open the lobby dialog.
Consider whether it is cleaner to always define the property or whether it is cleaner to use the !!msg.historic cheat in JS.

The freezing can be tested by modifying the msg in lobby.js if historic = true, e.g.

		"room-message": msg => {
			if (msg.historic)
				msg.elexis = "stupid";

Diff Detail

rP 0 A.D. Public Repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Sep 11 2019, 11:56 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build:

Successful build - Chance fights ever on the side of the prudent.

Link to build:

elexis edited the summary of this revision. (Show Details)Sep 11 2019, 12:05 PM
elexis edited the test plan for this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Sep 11 2019, 12:15 PM
This revision was automatically updated to reflect the committed changes.