[Client] Alt investigation entry points and in-tab navigation

TabModeration gains an Open alt graph button plus alts-table double-click, both routing to the User Alts tab. UserContextMenu gains an Investigate alts action. TabAlts gains row double-click navigation with a Back history stack so moderators can walk the alt graph without retyping names.
This commit is contained in:
Lukas Brübach 2026-10-13 20:23:33 +02:00
parent f468315826
commit 3823dfa087
6 changed files with 78 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#include "libcockatrice/protocol/pb/serverinfo_moderator_login.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user_alt.pb.h"
#include "libcockatrice/protocol/pb/serverinfo_user_session.pb.h"
#include "tab_supervisor.h"
#include <QAbstractItemView>
#include <QDateTime>
@ -139,7 +140,19 @@ TabModeration::TabModeration(TabSupervisor *_tabSupervisor, AbstractClient *_cli
altsGroup = new QGroupBox;
altsTable = new QTableWidget(0, COL_ALTS_COUNT);
configureTable(altsTable);
connect(altsTable, &QTableWidget::cellDoubleClicked, this, [this](int row, int) {
auto *userItem = altsTable->item(row, COL_ALTS_USER);
if (userItem != nullptr && !userItem->text().isEmpty()) {
getTabSupervisor()->openTabAlts(userItem->text());
}
});
openAltsButton = new QPushButton;
connect(openAltsButton, &QPushButton::clicked, this, &TabModeration::openAltsGraph);
auto *altsHeader = new QHBoxLayout;
altsHeader->addStretch();
altsHeader->addWidget(openAltsButton);
auto *altsLayout = new QVBoxLayout(altsGroup);
altsLayout->addLayout(altsHeader);
altsLayout->addWidget(altsTable);
sessionsGroup = new QGroupBox;
@ -197,6 +210,8 @@ void TabModeration::retranslateUi()
userInfoNotesLabel->setText(tr("Admin notes:"));
altsGroup->setTitle(tr("Alts"));
openAltsButton->setText(tr("Open alt graph"));
openAltsButton->setToolTip(tr("Open this user in the User Alts tab"));
sessionsGroup->setTitle(tr("Sessions"));
staffGroup->setTitle(tr("Staff Last Logins"));
@ -227,6 +242,7 @@ void TabModeration::clearUserData()
sessionsTable->setRowCount(0);
resetPasswordButton->setEnabled(false);
removeAvatarButton->setEnabled(false);
openAltsButton->setEnabled(false);
}
void TabModeration::investigate(const QString &userName)
@ -247,6 +263,7 @@ void TabModeration::investigateUser()
currentUser = userName;
resetPasswordButton->setEnabled(true);
removeAvatarButton->setEnabled(true);
openAltsButton->setEnabled(true);
altsTable->setRowCount(0);
sessionsTable->setRowCount(0);
requestUserInfo(userName);
@ -254,6 +271,14 @@ void TabModeration::investigateUser()
requestAlts(userName);
}
void TabModeration::openAltsGraph()
{
if (currentUser.isEmpty()) {
return;
}
getTabSupervisor()->openTabAlts(currentUser);
}
void TabModeration::requestUserInfo(const QString &userName)
{
userInfoNameValue->setText(userName);