feat(FalukantService, MessagesDialog): enhance character data handling in notifications
All checks were successful
Deploy to production / deploy (push) Successful in 2m3s

- Added mappings for character titles and genders in the FalukantService to enrich notifications with additional character information.
- Updated the MessagesDialog component to utilize the new title and gender data, improving the display of director names based on their titles and genders.
- Ensured that character names are displayed correctly, enhancing the overall user experience in notifications.
This commit is contained in:
Torsten Schulz (local)
2026-05-08 08:25:36 +02:00
parent cc89fd4bef
commit 0e572f8cbe
2 changed files with 27 additions and 4 deletions

View File

@@ -8916,6 +8916,8 @@ async function enrichNotificationsWithCharacterNames(notifications) {
if (!ids.length && !regionIdList.length) return;
const nameMap = new Map();
const titleTrMap = new Map();
const genderMap = new Map();
if (ids.length) {
const characters = await FalukantCharacter.findAll({
where: { id: { [Op.in]: ids } },
@@ -8928,12 +8930,13 @@ async function enrichNotificationsWithCharacterNames(notifications) {
});
for (const c of characters) {
const title = String(c.nobleTitle?.labelTr || '').trim();
const first = c.definedFirstName?.name || '';
const last = c.definedLastName?.name || '';
const baseName = `${first} ${last}`.trim();
const display = [title, baseName].filter(Boolean).join(' ').trim() || null;
nameMap.set(Number(c.id), display || `#${c.id}`);
const displayName = baseName || `#${c.id}`;
nameMap.set(Number(c.id), displayName);
titleTrMap.set(Number(c.id), String(c.nobleTitle?.labelTr || '').trim() || null);
genderMap.set(Number(c.id), String(c.gender || '').trim() || null);
}
}
let regionNameById = new Map();
@@ -9008,6 +9011,17 @@ async function enrichNotificationsWithCharacterNames(notifications) {
const resolved = nameMap.get(Number(foundId));
// Set character_name directly (characterName is a getter that reads from character_name)
n.character_name = resolved;
const titleTr = titleTrMap.get(Number(foundId)) || null;
const gender = genderMap.get(Number(foundId)) || null;
if (n.dataValues) {
if (parsed?.director_character_id != null) {
n.dataValues.director_title_tr = titleTr;
n.dataValues.director_gender = gender;
} else {
n.dataValues.character_title_tr = titleTr;
n.dataValues.character_gender = gender;
}
}
}
if (parsed?.region_id != null && regionNameById.has(Number(parsed.region_id))) {