[Server] Serve report mutations through the database interface (#7846)

cmdReportAssign, cmdReportResolve, cmdReportReopen and cmdReportAddComment still
ran their lookups and updates inline through Servatrice_DatabaseInterface. Add
assignReport, resolveReport, reopenReport, getUserNameById,
getReportNotificationTarget, countReportCommentsInLastHour,
getReportCommentTarget and addReportComment to Server_DatabaseInterface with
fail-closed defaults, and model the outcomes as ReportAssignResult and
ReportUpdateResult so "no such report", "wrong state" and "query failed" stay
distinguishable. Authorization checks, audit records, notification recipients
and every response code stay in the handler.
This commit is contained in:
BruebachL 2026-11-10 12:16:28 +01:00 • committed by GitHub
parent a54e13756c
commit 948035af06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 339 additions and 148 deletions

View file

@ -303,6 +303,20 @@ public:
bool getReportComments(int reportId, QList<ServerInfo_ReportComment> &comments) override;
bool getReportStats(ReportStatsRecord &stats) override;
bool getReportUserInfo(const QString &userName, ReportUserInfoRecord &info) override;
Server_DatabaseInterface::ReportAssignResult assignReport(int reportId, int moderatorId) override;
Server_DatabaseInterface::ReportUpdateResult
resolveReport(int reportId, const QString &status, const QString &note, int moderatorId) override;
Server_DatabaseInterface::ReportUpdateResult reopenReport(int reportId) override;
bool getUserNameById(int userId, QString &userName) override;
bool getReportNotificationTarget(int reportId, int &reporterId, QString &reportedUserName) override;
int countReportCommentsInLastHour(int authorId) override;
bool getReportCommentTarget(int reportId, ReportCommentTargetRecord &target) override;
bool addReportComment(int reportId,
const QString &authorName,
int authorId,
const QString &commentText,
bool isModerator,
qlonglong &commentId) override;
bool addReport(int reporterId,
const QString &reporterName,
int reportedUserId,