Notify super admins on new user registration (bell + email)
When a new user registers, all super_admin users receive:
- A database notification shown in the bell (type: new_user), with the
new user's avatar and a link to their channel
- An email congratulating them with the new member's name, email,
join date, gender, and nationality, plus a View Profile CTA
Notification rendering in app.blade.php refactored into notifHref() and
notifThumb() helpers so new_user notifications link to /channel/{slug}
and show a circular avatar instead of a video thumbnail. Also fixed the
legacy /storage/thumbnails/ path to /media/thumbnails/ for video notifications.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
4887d0c517
commit
3fe167e33f
4 files changed
+116
-6
No files matched your search
@@ -1219,17 +1219,34 @@
|
||||
}
|
||||
|
||||
function notifText(d) {
|
||||
var actor = '<strong>' + escHtml(d.actor_name || d.uploader_name || '') + '</strong>';
|
||||
var actor = '<strong>' + escHtml(d.actor_name || d.uploader_name || d.user_name || '') + '</strong>';
|
||||
var title = '"' + escHtml(d.video_title || '') + '"';
|
||||
var preview = d.comment_preview ? ' <em class="yt-notif-preview">"' + escHtml(d.comment_preview) + '"</em>' : '';
|
||||
switch (d.type) {
|
||||
case 'new_comment': return actor + ' commented on your video ' + title + ':' + preview;
|
||||
case 'new_reply': return actor + ' replied to your comment:' + preview;
|
||||
case 'comment_like':return actor + ' liked your comment on ' + title;
|
||||
case 'new_user': return '🎉 ' + actor + ' just joined TAKEONE!';
|
||||
default: return actor + ' uploaded a new video: ' + title;
|
||||
}
|
||||
}
|
||||
|
||||
function notifHref(d) {
|
||||
if (d.type === 'new_user') return '/channel/' + encodeURIComponent(d.user_channel || '');
|
||||
return '/videos/' + escHtml(d.video_route_key || '');
|
||||
}
|
||||
|
||||
function notifThumb(d) {
|
||||
if (d.type === 'new_user') {
|
||||
return d.user_avatar
|
||||
? '<img class="yt-notif-thumb" src="' + escHtml(d.user_avatar) + '" alt="" loading="lazy" onerror="notifThumbFallback(this)" style="border-radius:50%">'
|
||||
: '<div class="yt-notif-thumb-placeholder"><i class="bi bi-person-circle"></i></div>';
|
||||
}
|
||||
return d.video_thumbnail
|
||||
? '<img class="yt-notif-thumb" src="/media/thumbnails/' + escHtml(d.video_thumbnail) + '" alt="" loading="lazy" onerror="notifThumbFallback(this)">'
|
||||
: '<div class="yt-notif-thumb-placeholder"><i class="bi bi-play-circle"></i></div>';
|
||||
}
|
||||
|
||||
function renderNotifications(data) {
|
||||
var unread = data.unread_count;
|
||||
if (unread > 0) {
|
||||
@@ -1248,15 +1265,12 @@
|
||||
|
||||
list.innerHTML = data.notifications.map(function (n) {
|
||||
var d = n.data;
|
||||
var thumb = d.video_thumbnail
|
||||
? '<img class="yt-notif-thumb" src="/storage/thumbnails/' + escHtml(d.video_thumbnail) + '" alt="" loading="lazy" onerror="notifThumbFallback(this)">'
|
||||
: '<div class="yt-notif-thumb-placeholder"><i class="bi bi-play-circle"></i></div>';
|
||||
var dot = !n.read ? '<div class="yt-notif-dot"></div>' : '';
|
||||
return '<a class="yt-notif-item' + (!n.read ? ' unread' : '') + '" '
|
||||
+ 'href="/videos/' + escHtml(d.video_route_key) + '" '
|
||||
+ 'href="' + notifHref(d) + '" '
|
||||
+ 'data-notif-id="' + escHtml(n.id) + '" '
|
||||
+ 'onclick="handleNotifClick(event, this)">'
|
||||
+ thumb
|
||||
+ notifThumb(d)
|
||||
+ '<div class="yt-notif-body">'
|
||||
+ '<div class="yt-notif-text">' + notifText(d) + '</div>'
|
||||
+ '<div class="yt-notif-time">' + escHtml(n.time) + '</div>'
|
||||
|
||||
Reference in new issue
Block a user