fix(shorts): плановая очистка, бэкап, часовой пояс и экранирование
- purgeScheduledDeletions() теперь чистит short_messages по purge_at - short_messages добавлена в BACKUP_TABLES/BACKUP_SEQUENCE_TABLES, normalizeRestoreData и restore (поле автора проверяется на живость) - сид short_messages_retention_days перенесён и в db/init.sql - used_at по умолчанию берётся в зоне приложения (appTodayIso), а не по UTC - поле «Использовано» скрыто при создании, открыто при правке - удалён пустой escInline и мёртвые data-message/canEdit: сырой текст сообщения попадал в атрибут неэкранированным
This commit is contained in:
+17
-2
@@ -8,12 +8,13 @@ const BACKUP_TABLES = [
|
||||
'group_photos', 'entry_photos', 'modules', 'student_photos', 'share_links', 'photo_jobs',
|
||||
'lesson_reports', 'lesson_report_versions', 'audit_log', 'notifications',
|
||||
'notification_reads', 'banned_ips', 'chat_threads', 'chat_messages', 'chat_attachments',
|
||||
'short_messages',
|
||||
];
|
||||
const BACKUP_SEQUENCE_TABLES = [
|
||||
'groups', 'students', 'entries', 'project_files', 'branches', 'users', 'group_photos',
|
||||
'entry_photos', 'modules', 'student_photos', 'share_links', 'photo_jobs', 'lesson_reports',
|
||||
'lesson_report_versions', 'audit_log', 'notifications', 'chat_threads', 'chat_messages',
|
||||
'chat_attachments',
|
||||
'chat_attachments', 'short_messages',
|
||||
];
|
||||
|
||||
function isSupportedBackupVersion(data) {
|
||||
@@ -500,7 +501,21 @@ function normalizeRestoreData(data) {
|
||||
size: optInt(x.size, 0, 2147483647) ?? 0,
|
||||
created_at: optTs(x.created_at),
|
||||
}));
|
||||
return { groups, students, entries, project_files, settings, branches, users, user_branches, entry_photos, student_photos, group_photos, share_links, modules, photo_jobs, lesson_reports, lesson_report_versions, audit_log, notifications, notification_reads, banned_ips, chat_threads, chat_messages, chat_attachments };
|
||||
const short_messages = (data.short_messages || []).map(x => ({
|
||||
id: reqInt(x.id),
|
||||
resident: reqStr(x.resident, 200),
|
||||
lesson_date: reqDate(x.lesson_date),
|
||||
topic: optStr(x.topic, 500),
|
||||
message: reqStr(x.message, 10000),
|
||||
used: !!x.used,
|
||||
used_at: optDate(x.used_at),
|
||||
author_id: optInt(x.author_id, 0, 2147483647),
|
||||
deleted_at: optTs(x.deleted_at),
|
||||
purge_at: optTs(x.purge_at),
|
||||
created_at: optTs(x.created_at),
|
||||
updated_at: optTs(x.updated_at),
|
||||
}));
|
||||
return { groups, students, entries, project_files, settings, branches, users, user_branches, entry_photos, student_photos, group_photos, share_links, modules, photo_jobs, lesson_reports, lesson_report_versions, audit_log, notifications, notification_reads, banned_ips, chat_threads, chat_messages, chat_attachments, short_messages };
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user