As proposed by Vladislav, disable the toggle buddy button upon disconnect too.
Hide the chat input then as well, since it's going to become invisible with D339 too.
Moves the code to open and close the leaderboard from XML to JS, this way it is easier to read, compare, change and extend.
Remove a return from displayProfile which is never triggered.
Split displayProfile into two functions as merging them just produced spaghetti code.
Details
- Reviewers
vladislavbelov - Commits
- rP19501: JS lobby cleanup.
Open the lobby window in one instance. Open the lobby window with the same account in a second instance.
See that the first instance became disconnected.
Type a non-existing name in the user profile button and verify that there is no fake profile displayed of a non-existing user.
Click on some playernames of the leaderboard.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/929/ for more details.
We shouldn't hide current description in the left when open Rating/Lookup, because it strange disappear and appear again after closing.
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
137 ↗ | (On Diff #1544) | for (let button in ...) |
Improvement suggested by Vladislav: Only hide the previously selected playerinfo if there was no player selected yet.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/932/ for more details.
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
619 ↗ | (On Diff #1547) | Duplicate, I think, because all these functions are the same, except initialization, so it could like: function setLeaderboardVisibility(visible) { if (visible) { Engine.SendGetBoardList(); lookupSelectedUserProfile("leaderboardBox"); } Engine.GetGUIObjectByName("leaderboard").hidden = !visible; Engine.GetGUIObjectByName("fade").hidden = !visible; } |
634 ↗ | (On Diff #1547) | Too obvious duplicate, it'd better to have like: function setUserProfileVisibility(visible) { Engine.GetGUIObjectByName("profileFetch").hidden = !visible; Engine.GetGUIObjectByName("fade").hidden = !visible; } |
Ogled that unification too, but didn't think of an if statement to fix the non-unified part. That proposal looks better indeed. That's the good side of moving the code from XML to JS.
Also there has been a bug, if one opens the leaderboard and then closes it again, it should have selected the playerlist entry again (obvious from the XML too).
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
137 ↗ | (On Diff #1544) | (doesn't work) |
Ogled that unification too, but didn't think of an if statement to fix the non-unified part. That proposal looks better indeed. That's the good side of moving the code from XML to JS.
Also there has been a bug, if one opens the leaderboard and then closes it again, it should have selected the playerlist entry again (obvious from the XML too).
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
624 ↗ | (On Diff #1566) | Why playersBox? There is a bug, when click on Leaderboard, fast close it by Escape, and open User Profile Lookup, then it'll try automatically search a selected user. Keyword: fast click, until it loading, I think. |
binaries/data/mods/public/gui/lobby/lobby.js | ||
---|---|---|
624 ↗ | (On Diff #1566) |
Because that is already the case in the current system. When closing the window, it should display the previously selected profile again.
Exists already as well. It's because the current code assumes that the server is faster than the user. It will not check whether the received profile is the one of the user requested. It would have to process things synchroneously and remember which request goes to which window. (So a simple ignoring wouldn't fix all cases). Would be a rewrite and if that is worthwhile at all, should be done in a separate patch. |
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/947/ for more details.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/951/ for more details.