mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Serve report submission through the database interface (#7843)
cmdReport and sendPendingReportNotifications still issued their SQL inline through Servatrice_DatabaseInterface: the daily report cap, the reported-user lookup, the report insert, both pending-notification selects and the notified flips. Add the two notification records and seven report methods to Server_DatabaseInterface with fail-closed defaults, implement them with the previous statements and binds, and let both functions ask the injected interface. Check order, response codes and notification payloads are unchanged.
This commit is contained in:
parent
9b00972b4d
commit
fb836c6e0c
4 changed files with 242 additions and 87 deletions
|
|
@ -391,6 +391,65 @@ public:
|
|||
{
|
||||
return ReplayWriteResult::Failed;
|
||||
}
|
||||
/** @brief One resolved or dismissed report whose reporter has not been told yet. */
|
||||
struct PendingReportNotification
|
||||
{
|
||||
int reportId = 0;
|
||||
QString reportedUserName;
|
||||
QString status;
|
||||
QString resolutionNote;
|
||||
};
|
||||
/** @brief One unannounced comment on a report the user reported, was assigned, or moderates. */
|
||||
struct PendingReportCommentNotification
|
||||
{
|
||||
qlonglong commentId = 0;
|
||||
int reportId = 0;
|
||||
QString authorName;
|
||||
QString commentText;
|
||||
};
|
||||
/** @brief Reports the reporter submitted in the last day, for the daily cap. */
|
||||
virtual int countReportsSubmittedInLastDay(int /* reporterId */)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/** @brief Resolves a user name for the report's reported-user column, -1 when unknown. */
|
||||
virtual int getReportedUserId(const QString & /* userName */)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
/** @brief Stores a new open report, returning whether the insert succeeded. */
|
||||
virtual bool addReport(int /* reporterId */,
|
||||
const QString & /* reporterName */,
|
||||
int /* reportedUserId */,
|
||||
const QString & /* reportedUserName */,
|
||||
int /* gameId */,
|
||||
int /* roomId */,
|
||||
const QString & /* category */,
|
||||
const QString & /* description */,
|
||||
const QString & /* chatLog */)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/** @brief Collects the reporter's resolved or dismissed reports that were not announced yet. */
|
||||
virtual bool getPendingReportNotifications(int /* reporterId */,
|
||||
QList<PendingReportNotification> & /* notifications */)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/** @brief Marks a report notification as delivered so it is not announced again. */
|
||||
virtual void markReportNotified(int /* reportId */)
|
||||
{
|
||||
}
|
||||
/** @brief Collects comments on the user's reports that were not announced yet. */
|
||||
virtual bool getPendingReportCommentNotifications(int /* userId */,
|
||||
QList<PendingReportCommentNotification> & /* notifications */)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/** @brief Marks a comment notification as delivered so it is not announced again. */
|
||||
virtual void markReportCommentNotified(qlonglong /* commentId */)
|
||||
{
|
||||
}
|
||||
/** @brief Append a moderator/admin action to the server audit log. */
|
||||
virtual void addAuditRecord(const QString & /* user */,
|
||||
const QString & /* ipaddress */,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue