mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(dashboard): Mail page with every mail, translated text and deleted mail
New Mail page (/mail, characters_mail, under Moderation): every in-game mail newest first and live, with sender and receiver linked to their character and account, the attachment with its icon and name (waiting or claimed), and the state (unread, read, deleted by the player with the time). Filters: state, character (sent or received), account, text. Open shows the body, the attachment's item ID, subkey and data. Locale keys in mail (%[MissionEmail_12_subjectText], the game's sender name) are shown as the client shows them, from locale.xml; the stored text stays under "Stored text". LocaleText::Expand, unit tested. The character Mailbox uses the same view. Staff see mail the player deleted (marked) and a link to the character's mail on the Mail page; the owner sees only what is still in the mailbox, without account IDs. /api/characters/:id/mail keeps its old fields and adds the new ones. Check: /mail with each filter, Open on game, staff and player mail, a mission mail's subject translated; a character's Mailbox as staff and as the owner after deleting a mail in game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ set(DWEBTESTS_SOURCES
|
||||
"ServerOperationsTests.cpp"
|
||||
"PublicPagesTests.cpp"
|
||||
"ModerationToolsTests.cpp"
|
||||
"LocaleTextTests.cpp"
|
||||
"ModeratorHelperTests.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/dDashboardServer/ai/ClaudeClient.cpp"
|
||||
"${PROJECT_SOURCE_DIR}/dDashboardServer/ai/ModeratorPrompt.cpp"
|
||||
|
||||
30
tests/dWebTests/LocaleTextTests.cpp
Normal file
30
tests/dWebTests/LocaleTextTests.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "LocaleText.h"
|
||||
|
||||
namespace {
|
||||
const std::string EMPTY;
|
||||
const std::map<std::string, std::string> PHRASES{ { "MissionEmail_1_subjectText", "Welcome!" }, { "MAIL_SYSTEM_NOTIFICATION", "LEGO Universe" } };
|
||||
|
||||
std::string Expand(const std::string& text) {
|
||||
return LocaleText::Expand(text, [](const std::string& key) -> const std::string& {
|
||||
const auto it = PHRASES.find(key);
|
||||
return it == PHRASES.end() ? EMPTY : it->second;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LocaleTextTest, ReplacesKeys) {
|
||||
EXPECT_EQ(Expand("%[MissionEmail_1_subjectText]"), "Welcome!");
|
||||
EXPECT_EQ(Expand("From %[MAIL_SYSTEM_NOTIFICATION]: %[MissionEmail_1_subjectText] ok"), "From LEGO Universe: Welcome! ok");
|
||||
}
|
||||
|
||||
TEST(LocaleTextTest, LeavesOtherTextAlone) {
|
||||
EXPECT_EQ(Expand("Items returned to you"), "Items returned to you");
|
||||
EXPECT_EQ(Expand("%[Unknown_key] and 100%"), "%[Unknown_key] and 100%");
|
||||
EXPECT_EQ(Expand("%[not closed"), "%[not closed");
|
||||
EXPECT_EQ(Expand("[x] %[]"), "[x] %[]");
|
||||
EXPECT_EQ(Expand(""), "");
|
||||
}
|
||||
Reference in New Issue
Block a user