[Server] Serve report list views through the database interface (#7844)

cmdReportList, cmdReportMyList and cmdReportDetails still prepared their SELECTs
inline through Servatrice_DatabaseInterface and mapped the result columns to
protocol records in the socket handler. Add getReportList,
getReportsSubmittedBy, getReportForDetails and getReportComments to
Server_DatabaseInterface with fail-closed defaults and a ReportLookupResult
outcome, implement them with the previous statements, joins and null handling,
and keep the detail authorization check and the tolerated comment-query failure
in the handler in the same order. Response codes are unchanged.
This commit is contained in:
BruebachL 2026-11-10 12:16:27 +01:00 • committed by GitHub
parent fb836c6e0c
commit 2ba80cb61d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 349 additions and 232 deletions

View file

@ -13,6 +13,7 @@
#include <libcockatrice/protocol/pb/serverinfo_chat_message.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_moderator_login.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_private_chat_message.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_report.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user_alt.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_user_session.pb.h>
#include <libcockatrice/protocol/pb/serverinfo_warning.pb.h>
@ -291,6 +292,15 @@ public:
bool results) override;
int countReportsSubmittedInLastDay(int reporterId) override;
int getReportedUserId(const QString &userName) override;
bool getReportList(bool unresolvedOnly,
int offset,
int limit,
int &totalCount,
QList<ServerInfo_Report> &reports) override;
bool getReportsSubmittedBy(int reporterId, QList<ServerInfo_Report> &reports) override;
Server_DatabaseInterface::ReportLookupResult
getReportForDetails(int reportId, int &reporterId, ServerInfo_Report &report) override;
bool getReportComments(int reportId, QList<ServerInfo_ReportComment> &comments) override;
bool addReport(int reporterId,
const QString &reporterName,
int reportedUserId,