mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-25 14:12:49 +00:00
feat(mail): keep mail a player deletes, marked deleted, for staff
Deleting mail in game now sets mail.deleted_at (migrations mysql 95, sqlite 78) instead of removing the row. Every read for the game skips deleted mail: the mailbox, a single mail (claim, read, delete), the unread count, the economy scan of waiting attachments and the UGC lookup of mailed models. Deleting a character still removes its mail. Check: delete a mail in game; it leaves the mailbox, the unread count drops, and the row is still in the mail table with deleted_at set. Parity test: ParitySeeded.Mail (DeleteMail). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ public:
|
||||
// Insert a new mail into the database.
|
||||
virtual void InsertNewMail(const MailInfo& mail) = 0;
|
||||
|
||||
// Get the mail for the given character id.
|
||||
// Get the mail for the given character id. Mail the player deleted is left out (as in every read below).
|
||||
virtual std::vector<MailInfo> GetMailForPlayer(const LWOOBJID characterId, const uint32_t numberOfMail) = 0;
|
||||
|
||||
// Get the mail for the given mail id.
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
// Claim the item from the given mail.
|
||||
virtual void ClaimMailItem(const uint64_t mailId) = 0;
|
||||
|
||||
// Delete the given mail.
|
||||
// A player deleted the mail: it is marked deleted (deleted_at) and kept for staff, and the game never shows it again.
|
||||
virtual void DeleteMail(const uint64_t mailId) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace UgcLookupSql {
|
||||
}
|
||||
|
||||
inline std::string Mail(const std::vector<LWOOBJID>& subkeys, LOT modelItemLot) {
|
||||
return "SELECT id, receiver_id, receiver_name, attachment_lot, attachment_subkey, attachment_config FROM mail WHERE attachment_count > 0 AND "
|
||||
return "SELECT id, receiver_id, receiver_name, attachment_lot, attachment_subkey, attachment_config FROM mail WHERE attachment_count > 0 AND deleted_at = 0 AND "
|
||||
"(attachment_lot = " + std::to_string(modelItemLot) + (subkeys.empty() ? "" : " OR attachment_subkey IN (" + IdList(subkeys) + ")") +
|
||||
") ORDER BY id DESC LIMIT 500;";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user