feat: enhance notifications view and improve i18n support
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
- Updated NotificationsView.vue to display item.context in notifications. - Added new translations for multiple languages in .i18n-translate-cache.json. - Extended fill-i18n-locales.js to include Cebuano (ceb) locale support.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import notificationService from '../services/notificationService.js';
|
||||
import Member from '../models/Member.js';
|
||||
import Club from '../models/Club.js';
|
||||
|
||||
const serialize = (recipient) => {
|
||||
const event = recipient.event?.toJSON?.() || recipient.event || {};
|
||||
@@ -21,7 +23,18 @@ const serialize = (recipient) => {
|
||||
export const listNotifications = async (req, res) => {
|
||||
try {
|
||||
const items = await notificationService.listForUser(req.user.id, req.query);
|
||||
res.json(items.map(serialize));
|
||||
const serialized = await Promise.all(items.map(async (item) => {
|
||||
const result = serialize(item);
|
||||
const club = result.clubId ? await Club.findByPk(result.clubId, { attributes: ['name'] }) : null;
|
||||
if (result.type === 'member.rating_changed' && result.payload?.memberId) {
|
||||
const member = await Member.findByPk(result.payload.memberId, { attributes: ['firstName', 'lastName'] });
|
||||
const memberName = [member?.firstName, member?.lastName].filter(Boolean).join(' ');
|
||||
if (memberName) result.title = memberName;
|
||||
}
|
||||
result.context = club?.name || '';
|
||||
return result;
|
||||
}));
|
||||
res.json(serialized);
|
||||
} catch (error) { res.status(500).json({ error: 'Posteingang konnte nicht geladen werden.' }); }
|
||||
};
|
||||
|
||||
|
||||
@@ -807,7 +807,7 @@ class MemberService {
|
||||
priority: 'normal',
|
||||
resourceType: 'member',
|
||||
resourceId: String(member.id),
|
||||
title: `(Q)TTR geändert: ${firstName} ${lastName}`,
|
||||
title: `${firstName} ${lastName}`,
|
||||
body: changes.join(', '),
|
||||
route: '/members',
|
||||
payload: { memberId: member.id, clubId: Number(clubId), oldTtr, newTtr: member.ttr, oldQttr, newQttr: member.qttr },
|
||||
|
||||
Reference in New Issue
Block a user