[UserList] Fix join/spectate from the profile hover card doing nothing (#7383)

The games list in the profile hover card offered "Join game" and
"Spectate", but UserInfoPopup::joinGameRequested was only forwarded to an
identical UserListWidget::joinGameRequested signal that nothing connected
to. Clicking either entry sent no command, opened no tab and showed no
error.

Route the request to TabSupervisor, which owns the join flow. The popup's
games list spans every room the user is in, so the target room may not be
open yet; IntentJoinServerGame already joins the room first and retries,
which is why this goes through the intent rather than straight to
GameSelector.

Extract the intent construction that joinReportGame already had into a
shared joinGameByIntent helper instead of duplicating it.

Also stop disabling "Join game" for games that are full or already
running. GameSelector::joinGame() offers to join as a spectator in that
case, so a greyed-out entry read as a dead button; GameSelector's own
context menu never disables it either.

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-02 18:57:07 +02:00 • committed by GitHub
parent 750d5b3c21
commit 4ce2e8c3d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 37 additions and 8 deletions

View file

@ -1100,10 +1100,27 @@ void TabSupervisor::replayLeft(TabGame *tab)
}
void TabSupervisor::joinReportGame(const int gameId, const int roomId)
{
joinGameByIntent(gameId, roomId, true);
}
void TabSupervisor::joinGameFromUserCard(const int gameId, const int roomId, const bool asSpectator)
{
joinGameByIntent(gameId, roomId, asSpectator);
}
/**
* Runs the join/spectate intent for @p gameId in @p roomId.
*
* The intent owns the whole flow: if the room tab is not open yet it joins the
* room first, then retries the game, so callers do not have to care whether the
* room happens to be on screen.
*/
void TabSupervisor::joinGameByIntent(const int gameId, const int roomId, const bool asSpectator)
{
auto *remoteClient = qobject_cast<RemoteClient *>(client);
if (!remoteClient) {
actShowPopup(tr("Report joins are only available on a remote server."));
actShowPopup(tr("Game joins are only available on a remote server."));
return;
}
@ -1112,7 +1129,7 @@ void TabSupervisor::joinReportGame(const int gameId, const int roomId)
ctx->roomContext.serverContext.port = QString::number(remoteClient->peerPort());
ctx->roomContext.roomId = roomId;
ctx->gameId = gameId;
ctx->asSpectator = true;
ctx->asSpectator = asSpectator;
auto *joinGameIntent = new IntentJoinServerGame(this, remoteClient, std::move(ctx));
joinGameIntent->setParent(this);