this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Handle admin notifications & unhandled ones

+16 -2
+2
src/components/icon.jsx
··· 95 95 'arrow-down-circle': () => 96 96 import('@iconify-icons/mingcute/arrow-down-circle-line'), 97 97 clipboard: () => import('@iconify-icons/mingcute/clipboard-line'), 98 + 'account-edit': () => import('@iconify-icons/mingcute/user-edit-line'), 99 + 'account-warning': () => import('@iconify-icons/mingcute/user-warning-line'), 98 100 }; 99 101 100 102 function Icon({
+14 -2
src/components/notification.jsx
··· 18 18 favourite: 'heart', 19 19 poll: 'poll', 20 20 update: 'pencil', 21 + 'admin.signup': 'account-edit', 22 + 'admin.report': 'account-warning', 21 23 }; 22 24 23 25 /* ··· 54 56 'favourite+reblog+account': (count) => 55 57 `boosted & favourited ${count} of your posts.`, 56 58 'favourite+reblog_reply': 'boosted & favourited your reply.', 59 + 'admin.signup': 'signed up.', 60 + 'admin.report': 'reported a post.', 57 61 }; 58 62 59 63 function Notification({ notification, instance, reload, isStatic }) { ··· 102 106 } else { 103 107 text = contentText[type]; 104 108 } 105 - } else { 109 + } else if (contentText[type]) { 106 110 text = contentText[type]; 111 + } else { 112 + // Anticipate unhandled notification types, possibly from Mastodon forks or non-Mastodon instances 113 + // This surfaces the error to the user, hoping that users will report it 114 + text = `[Unknown notification type: ${type}]`; 107 115 } 116 + 108 117 if (typeof text === 'function') { 109 118 text = text(_statuses?.length || _accounts?.length); 110 119 } ··· 114 123 return null; 115 124 } 116 125 126 + const formattedCreatedAt = 127 + notification.createdAt && new Date(notification.createdAt).toLocaleString(); 128 + 117 129 return ( 118 130 <div class={`notification notification-${type}`} tabIndex="0"> 119 131 <div 120 132 class={`notification-type notification-${type}`} 121 - title={new Date(notification.createdAt).toLocaleString()} 133 + title={formattedCreatedAt} 122 134 > 123 135 {type === 'favourite+reblog' ? ( 124 136 <>