QoL fixes
This commit is contained in:
@@ -283,6 +283,8 @@ window.cancelAnimFrame = (function () {
|
||||
baseStyle += 'background:rgba(200,30,30,0.95);';
|
||||
} else if (type === 'success') {
|
||||
baseStyle += 'background:rgba(30,130,60,0.95);';
|
||||
} else if (type === 'warning') {
|
||||
baseStyle += 'background:rgba(220,180,0,0.95);color:#000;';
|
||||
} else {
|
||||
baseStyle += 'background:rgba(30,30,30,0.95);';
|
||||
}
|
||||
@@ -5985,7 +5987,7 @@ if (sbtForm) {
|
||||
class NotificationSystem {
|
||||
// Notification type categorization
|
||||
static USER_TYPES = ['comment_reply', 'subscription', 'mention', 'upload_comment'];
|
||||
static SYSTEM_TYPES = ['approve', 'deny', 'item_deleted', 'upload_success', 'upload_error', 'admin_pending', 'report'];
|
||||
static SYSTEM_TYPES = ['approve', 'deny', 'item_deleted', 'upload_success', 'upload_error', 'admin_pending', 'report', 'warning'];
|
||||
|
||||
constructor() {
|
||||
this.bell = document.getElementById('nav-notif-btn');
|
||||
@@ -6185,7 +6187,7 @@ class NotificationSystem {
|
||||
|
||||
// System notifications (deletion, deny, reports) require explicit acknowledgment —
|
||||
// never auto-mark them as read just because the user is viewing that item.
|
||||
const isSystemNotif = ['item_deleted', 'deny', 'admin_pending', 'report'].includes(notifType);
|
||||
const isSystemNotif = ['item_deleted', 'deny', 'admin_pending', 'report', 'warning'].includes(notifType);
|
||||
|
||||
// If the user is currently viewing this item, mark comment-type notifications as read immediately
|
||||
// (they are live on the thread, so no need to show a badge/highlight)
|
||||
@@ -6950,6 +6952,11 @@ class NotificationSystem {
|
||||
link = '/mod/reports';
|
||||
user = (window.f0ckI18n && window.f0ckI18n.notif_moderation) || 'Moderator';
|
||||
msg = (window.f0ckI18n && window.f0ckI18n.notif_new_report) || 'A new user report has been submitted';
|
||||
} else if (n.type === 'warning') {
|
||||
link = `/notifications?tab=system#notif-${n.id}`;
|
||||
user = (window.f0ckI18n && window.f0ckI18n.notif_system) || 'System';
|
||||
msg = (window.f0ckI18n && window.f0ckI18n.account_warning && window.f0ckI18n.account_warning.title) || 'Account Warning';
|
||||
if (n.reason) msg += `<br><div class="notif-reason" style="font-size: 0.85em; color: #ffb8b8; margin-top: 3px;">${n.reason}</div>`;
|
||||
} else {
|
||||
// Comment notification
|
||||
link = `/${n.item_id}#c${n.comment_id || n.reference_id}`;
|
||||
@@ -6961,7 +6968,18 @@ class NotificationSystem {
|
||||
|
||||
// For admin_pending the thumbnail lives in /mod/pending/t/ until approved
|
||||
let thumbSrc, thumbOnerror;
|
||||
if (n.type === 'admin_pending') {
|
||||
if (n.type === 'warning') {
|
||||
return `
|
||||
<div class="notif-item ${n.is_read ? '' : 'unread'} notif-with-thumb" data-id="${n.id}">
|
||||
<div class="notif-thumb" style="display:flex;align-items:center;justify-content:center;background:var(--bg-lighter);color:var(--danger);font-size:1.5em;"><i class="fa-solid fa-triangle-exclamation"></i></div>
|
||||
<div class="notif-content">
|
||||
<div class="notif-user"><strong ${n.username_color ? `style="color: ${n.username_color}"` : ''}>${user}</strong></div>
|
||||
<div class="notif-msg">${msg}</div>
|
||||
<div class="notif-time">${new Date(n.created_at).toLocaleString()}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (n.type === 'admin_pending') {
|
||||
thumbSrc = `/mod/pending/t/${n.item_id}.webp`;
|
||||
thumbOnerror = `this.onerror=null;this.src='/t/${n.item_id}.webp';this.onerror=function(){this.style.display='none';}`;
|
||||
} else {
|
||||
@@ -7080,6 +7098,22 @@ class NotificationSystem {
|
||||
`;
|
||||
}
|
||||
|
||||
if (n.type === 'warning') {
|
||||
const link = `/notifications?tab=system#notif-${n.id}`;
|
||||
return `
|
||||
<a href="${link}" class="notif-item ${n.is_read ? '' : 'unread'} notif-with-thumb" data-id="${n.id}" data-notif-nav="true">
|
||||
<div class="notif-thumb" style="display:flex;align-items:center;justify-content:center;background:var(--bg-lighter);color:var(--danger);font-size:1.5em;"><i class="fa-solid fa-triangle-exclamation"></i></div>
|
||||
<div class="notif-content">
|
||||
<div>
|
||||
<strong>${(window.f0ckI18n && window.f0ckI18n.account_warning && window.f0ckI18n.account_warning.title) || 'Account Warning'}</strong>
|
||||
<div style="font-size: 0.85em; color: #ffb8b8; margin-top: 3px;">${n.reason || 'No reason provided'}</div>
|
||||
</div>
|
||||
<small class="notif-time">${new Date(n.created_at).toLocaleString()}</small>
|
||||
</div>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
|
||||
let typeText = 'Start';
|
||||
if (n.type === 'comment_reply') typeText = (window.f0ckI18n && window.f0ckI18n.notif_replied) || 'replied to you';
|
||||
else if (n.type === 'subscription') typeText = (window.f0ckI18n && window.f0ckI18n.notif_subscribed) || 'commented in a thread you follow';
|
||||
|
||||
@@ -543,13 +543,22 @@
|
||||
|
||||
const result = await res.json();
|
||||
if (result.success) {
|
||||
const dest = result.redirect || '/meme';
|
||||
if (window.loadItemAjax) {
|
||||
window.loadItemAjax(dest);
|
||||
} else if (window.loadPageAjax) {
|
||||
window.loadPageAjax(dest);
|
||||
if (result.manual_approval) {
|
||||
window.flashMessage(window.f0ckI18n?.upload_pending_approval_patient || 'Upload awaits approval', 3000, 'warning');
|
||||
if (window.loadPageAjax) {
|
||||
window.loadPageAjax('/');
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
} else {
|
||||
window.location.href = dest;
|
||||
const dest = result.redirect || '/meme';
|
||||
if (window.loadItemAjax) {
|
||||
window.loadItemAjax(dest);
|
||||
} else if (window.loadPageAjax) {
|
||||
window.loadPageAjax(dest);
|
||||
} else {
|
||||
window.location.href = dest;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -3496,7 +3496,7 @@
|
||||
|
||||
// Tab type arrays
|
||||
const SCROLLER_USER_TYPES = ['comment_reply', 'subscription', 'mention', 'upload_comment'];
|
||||
const SCROLLER_SYSTEM_TYPES = ['approve', 'deny', 'item_deleted', 'upload_success', 'upload_error', 'admin_pending', 'report'];
|
||||
const SCROLLER_SYSTEM_TYPES = ['approve', 'deny', 'item_deleted', 'upload_success', 'upload_error', 'admin_pending', 'report', 'warning'];
|
||||
let sActiveTab = 'user';
|
||||
let sCachedNotifs = [];
|
||||
|
||||
@@ -3600,6 +3600,9 @@
|
||||
} else if (n.type === 'report') {
|
||||
link = '/mod/reports'; user = i18n.notif_moderation || 'Moderator';
|
||||
msg = i18n.notif_new_report || 'New user report';
|
||||
} else if (n.type === 'warning') {
|
||||
link = `/notifications?tab=system#notif-${n.id}`; user = i18n.notif_system || 'System';
|
||||
msg = (i18n.account_warning && i18n.account_warning.title) || 'Account Warning';
|
||||
} else {
|
||||
link = `/${n.item_id}#c${n.reference_id}`;
|
||||
if (n.type === 'comment_reply') msg = i18n.notif_replied || 'replied to you';
|
||||
@@ -3607,8 +3610,13 @@
|
||||
else if (n.type === 'mention') msg = i18n.notif_mentioned || 'highlighted you';
|
||||
else msg = i18n.notif_commented || 'commented';
|
||||
}
|
||||
const thumbSrc = n.type === 'admin_pending' ? `/mod/pending/t/${n.item_id}.webp` : `/t/${n.item_id}.webp`;
|
||||
const thumb = n.item_id ? `<div class="notif-thumb"><img src="${thumbSrc}" alt="" onerror="this.style.display='none'"></div>` : '';
|
||||
let thumb;
|
||||
if (n.type === 'warning') {
|
||||
thumb = `<div class="notif-thumb" style="display:flex;align-items:center;justify-content:center;background:var(--bg-lighter);color:var(--danger);font-size:1.5em;"><i class="fa-solid fa-triangle-exclamation"></i></div>`;
|
||||
} else {
|
||||
const thumbSrc = n.type === 'admin_pending' ? `/mod/pending/t/${n.item_id}.webp` : `/t/${n.item_id}.webp`;
|
||||
thumb = n.item_id ? `<div class="notif-thumb"><img src="${thumbSrc}" alt="" onerror="this.style.display='none'"></div>` : '';
|
||||
}
|
||||
return `<a href="${link}" target="_blank" class="notif-item ${n.is_read ? '' : 'unread'} notif-with-thumb" data-id="${n.id}">
|
||||
${thumb}
|
||||
<div class="notif-content">
|
||||
|
||||
@@ -1971,18 +1971,18 @@ window.initUploadForm = (selector) => {
|
||||
form._f0ckUploader.reset();
|
||||
|
||||
if (isShitpost) {
|
||||
// Flash message removed as requested
|
||||
if (lastData?.manual_approval && typeof window.showFlash === 'function') {
|
||||
window.showFlash('Upload awaits approval, please be patient', 'info');
|
||||
if (lastData?.manual_approval && typeof window.flashMessage === 'function') {
|
||||
window.flashMessage(window.f0ckI18n?.upload_pending_approval_patient || 'Upload awaits approval', 3000, 'warning');
|
||||
}
|
||||
} else {
|
||||
if (!dragModal && statusDiv) {
|
||||
if (lastData?.manual_approval) {
|
||||
if (typeof window.flashMessage === 'function') {
|
||||
window.flashMessage(window.f0ckI18n?.upload_pending_approval_patient || 'Upload awaits approval', 3000, 'warning');
|
||||
}
|
||||
} else if (!dragModal && statusDiv) {
|
||||
statusDiv.innerHTML = '✓ ' + (lastData?.msg || 'Upload successful');
|
||||
statusDiv.className = 'upload-status success';
|
||||
}
|
||||
if (lastData?.manual_approval && typeof window.showFlash === 'function') {
|
||||
window.showFlash('Upload awaits approval, please be patient', 'info');
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -2127,17 +2127,18 @@ window.initUploadForm = (selector) => {
|
||||
if (dragModal) dragModal.classList.remove('show');
|
||||
form._f0ckUploader.reset();
|
||||
if (isShitpost) {
|
||||
// Flash message removed as requested
|
||||
if (lastData?.manual_approval && typeof window.showFlash === 'function') {
|
||||
window.showFlash('Upload awaits approval, please be patient', 'info');
|
||||
if (lastData?.manual_approval && typeof window.flashMessage === 'function') {
|
||||
window.flashMessage(window.f0ckI18n?.upload_pending_approval_patient || 'Upload awaits approval', 3000, 'warning');
|
||||
}
|
||||
} else {
|
||||
if (lastData?.manual_approval) {
|
||||
if (typeof window.flashMessage === 'function') {
|
||||
window.flashMessage(window.f0ckI18n?.upload_pending_approval_patient || 'Upload awaits approval', 3000, 'warning');
|
||||
}
|
||||
} else if (!dragModal && statusDiv) {
|
||||
statusDiv.innerHTML = '✓ ' + (lastData?.msg || 'Upload successful');
|
||||
statusDiv.className = 'upload-status success';
|
||||
}
|
||||
} else if (!dragModal && statusDiv) {
|
||||
statusDiv.innerHTML = '✓ ' + (lastData?.msg || 'Upload successful');
|
||||
statusDiv.className = 'upload-status success';
|
||||
}
|
||||
|
||||
if (!isShitpost && lastData?.manual_approval && typeof window.showFlash === 'function') {
|
||||
window.showFlash('Upload awaits approval, please be patient', 'info');
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user