fix(chat): просмотр фото вложений в модалке, доступ тьюторов к уведомлениям

- изображения во вложениях чата открываются в общей модалке #imgModal
  (data-img + общий обработчик в admin.js) вместо новой вкладки
- Escape и клик по фону закрывают модалку изображения
- .chat-side[hidden] скрывается — раньше правило display:none его не покрывало
- страница уведомлений открывается любому авторизованному пользователю
  (checkAuth вместо requireAdminPage), пункт меню виден всем
This commit is contained in:
dev
2026-10-05 17:51:37 +03:00
parent 235fd43af4
commit 7e4b1a1324
4 changed files with 15 additions and 4 deletions
+9 -2
View File
@@ -93,7 +93,7 @@ function chatFilesHtml(files) {
if (!files || !files.length) return '';
return `<div class="msg-files">${files.map(f => {
if (CHAT_IMAGE_EXT.test(f.name || '')) {
return `<a class="msg-file msg-file-img" href="${chatFileUrl(f)}" target="_blank" rel="noopener">
return `<a class="msg-file msg-file-img" href="${chatFileUrl(f)}" data-img="${esc(chatFileUrl(f))}" title="Открыть">
<img src="${chatFileThumbUrl(f)}" alt="${esc(f.name)}" loading="lazy">
<span class="msg-file-name">${esc(f.name)}</span>
</a>`;
@@ -428,6 +428,7 @@ function initChatPage() {
const newCancel = document.getElementById('chatNewCancel');
const newOk = document.getElementById('chatNewOk');
const attachBox = document.getElementById('chatAttachList');
const imgModal = document.getElementById('imgModal');
if (list) {
list.addEventListener('click', e => {
@@ -491,9 +492,15 @@ function initChatPage() {
});
document.addEventListener('keydown', e => {
if (e.key === 'Escape' && newModal && newModal.classList.contains('open')) newModal.classList.remove('open');
if (e.key !== 'Escape') return;
if (imgModal && imgModal.classList.contains('open')) { imgModal.classList.remove('open'); return; }
if (newModal && newModal.classList.contains('open')) newModal.classList.remove('open');
});
if (imgModal) {
imgModal.addEventListener('click', e => e.currentTarget.classList.remove('open'));
}
if (newBtn) newBtn.hidden = !isAdmin();
const side = document.getElementById('chatSide');
const layout = document.getElementById('chatLayout');
+1 -1
View File
@@ -88,7 +88,7 @@ document.getElementById('nfMoreBtn').addEventListener('click', () => loadNotifyP
document.getElementById('nfReloadBtn').addEventListener('click', () => loadNotifyPage(true));
(async () => {
if (!(await requireAdminPage())) return;
if (!(await checkAuth())) return;
buildSidebar(document.body.dataset.page);
const clearBtn = document.getElementById('nfClearBtn');
if (clearBtn) clearBtn.hidden = !isAdmin();