fix(feedback): вернуть историю версий отзыва и вынести размеры модалок в общий класс
- исправить GET /api/feedbacks/:id/versions: feedbackById возвращает
объект строки, а не {fb, error, code}, из-за чего роут возвращал 404 {}
вместо списка версий
- вынести размеры модалок истории версий (lessonVersionsModal и
fbVersionsModal) в общий CSS-класс .version-modal, чтобы менять
max-width/width/max-height/overflow-y в одном месте
This commit is contained in:
@@ -1016,6 +1016,7 @@ body[data-page=settings] .page-head{align-items:flex-end}
|
||||
}
|
||||
|
||||
.lesson-modal{max-width:560px;width:92vw}
|
||||
.version-modal{max-width:860px;width:94%;max-height:88dvh;overflow-y:auto}
|
||||
.lesson-modal .lesson-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
|
||||
.lesson-modal .hint{font-size:.78rem;color:var(--muted);text-align:right}
|
||||
.lesson-modal textarea{min-height:130px}
|
||||
|
||||
+1
-1
@@ -1028,7 +1028,7 @@ function ensureLessonVersionsModal() {
|
||||
modal.className = 'modal-overlay';
|
||||
modal.id = 'lessonVersionsModal';
|
||||
modal.innerHTML = `
|
||||
<div class="edit-modal lesson-modal">
|
||||
<div class="edit-modal lesson-modal version-modal">
|
||||
<h3>История версий отчёта</h3>
|
||||
<div class="lesson-versions" id="lessonVersionsList"><div class="empty">Загрузка…</div></div>
|
||||
<div class="card-foot" style="justify-content:flex-end;gap:8px">
|
||||
|
||||
@@ -319,7 +319,7 @@
|
||||
<div class="modal-overlay" id="imgModal"><img id="imgModalSrc" alt=""></div>
|
||||
|
||||
<div class="modal-overlay" id="fbVersionsModal">
|
||||
<div class="edit-modal" style="max-width:860px;width:94%;max-height:88dvh;overflow-y:auto">
|
||||
<div class="edit-modal version-modal">
|
||||
<div class="fb-modal-head">
|
||||
<h3 id="fbVersionsTitle">История версий отзыва</h3>
|
||||
<button type="button" class="icon-btn" id="fbVersionsClose" title="Закрыть"><i data-lucide="x"></i></button>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
m.className = 'modal-overlay';
|
||||
m.id = 'fbVersionsModal';
|
||||
m.innerHTML = `
|
||||
<div class="edit-modal" style="max-width:860px;width:94%;max-height:88dvh;overflow-y:auto">
|
||||
<div class="edit-modal version-modal">
|
||||
<div class="fb-modal-head">
|
||||
<h3 id="fbVersionsTitle">История версий отзыва</h3>
|
||||
<button type="button" class="icon-btn" id="fbVersionsCloseBtn" title="Закрыть"><i data-lucide="x"></i></button>
|
||||
|
||||
@@ -9603,8 +9603,9 @@ app.post('/api/lesson-reports/:id/versions/:versionId/restore', requireAuth, asy
|
||||
});
|
||||
|
||||
app.get('/api/feedbacks/:id/versions', requireAuth, async (req, res) => {
|
||||
const { fb, error, code } = await feedbackById(req.user, req.params.id);
|
||||
if (!fb) return res.status(code || 404).json({ error });
|
||||
const fb = await feedbackById(req.user, req.params.id);
|
||||
if (!fb) return res.status(404).json({ error: 'Not found' });
|
||||
if (fb.forbidden) return res.status(403).json({ error: 'Нет доступа' });
|
||||
const { rows } = await pool.query(
|
||||
`SELECT v.id, v.feedback_id, v.text, v.source, v.created_at, u.name AS author_name, u.username AS author_username
|
||||
FROM feedback_versions v
|
||||
@@ -12998,22 +12999,23 @@ app.post('/api/entries', entryLimiter, (req, res, next) => {
|
||||
}
|
||||
await client.query('COMMIT');
|
||||
committed = true;
|
||||
if (entryAutoChecker) entryAutoChecker.notify();
|
||||
invalidateEntries();
|
||||
invalidateStats();
|
||||
broadcastEntryChanged();
|
||||
res.status(201).json({ ...rows[0], files: projectFiles.length, photos: photos.length });
|
||||
const entry = rows[0];
|
||||
res.status(201).json({ ...entry, files: projectFiles.length, photos: photos.length });
|
||||
setImmediate(async () => {
|
||||
try {
|
||||
if (entryAutoChecker) entryAutoChecker.notify();
|
||||
invalidateEntries();
|
||||
invalidateStats();
|
||||
broadcastEntryChanged();
|
||||
for (let i = 0; i < photos.length; i++) {
|
||||
const { rows: ep } = await pool.query(
|
||||
'SELECT id FROM entry_photos WHERE entry_id = $1 AND photo_path = $2 ORDER BY sort_order LIMIT 1',
|
||||
[rows[0].id, `/uploads/${photos[i].filename}`]
|
||||
[entry.id, `/uploads/${photos[i].filename}`]
|
||||
);
|
||||
if (ep.length) enqueueFaceScanBackground('entry', ep[0].id, `/uploads/${photos[i].filename}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Entry face scan enqueue failed:', err);
|
||||
console.error('Entry post-commit failed:', err);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user