Manual fixes for AI slop
This commit is contained in:
@@ -240,22 +240,22 @@ const NotificationItem = (props) => {
|
||||
const otherTags = unmatchedTags(notification.tags);
|
||||
const tags = otherTags.length > 0 ? otherTags.join(", ") : null;
|
||||
const handleDelete = async () => {
|
||||
console.log(`[Notifications] Deleting notification ${notification.id}`);
|
||||
await subscriptionManager.deleteNotification(notification.id);
|
||||
notification.history?.forEach(async (revision) => {
|
||||
console.log(`[Notifications] Deleting revision ${revision.id}`);
|
||||
await subscriptionManager.deleteNotification(revision.id);
|
||||
});
|
||||
if (notification.sid) {
|
||||
console.log(`[Notifications] Deleting all notifications with sid ${notification.sid}`);
|
||||
await subscriptionManager.deleteNotificationBySid(notification.subscriptionId, notification.sid);
|
||||
} else {
|
||||
console.log(`[Notifications] Deleting notification ${notification.id}`);
|
||||
await subscriptionManager.deleteNotification(notification.id);
|
||||
}
|
||||
};
|
||||
const handleMarkRead = async () => {
|
||||
console.log(`[Notifications] Marking notification ${notification.id} as read`);
|
||||
await subscriptionManager.markNotificationRead(notification.id);
|
||||
notification.history
|
||||
?.filter((revision) => revision.new === 1)
|
||||
.forEach(async (revision) => {
|
||||
console.log(`[Notifications] Marking revision ${revision.id} as read`);
|
||||
await subscriptionManager.markNotificationRead(revision.id);
|
||||
});
|
||||
if (notification.sid) {
|
||||
console.log(`[Notifications] Marking notification with sid ${notification.sid} as read`);
|
||||
await subscriptionManager.markNotificationReadBySid(notification.subscriptionId, notification.sid);
|
||||
} else {
|
||||
console.log(`[Notifications] Marking notification ${notification.id} as read`);
|
||||
await subscriptionManager.markNotificationRead(notification.id);
|
||||
}
|
||||
};
|
||||
const handleCopy = (s) => {
|
||||
copyToClipboard(s);
|
||||
|
||||
@@ -50,12 +50,23 @@ export const useConnectionListeners = (account, subscriptions, users, webPushTop
|
||||
};
|
||||
|
||||
const handleNotification = async (subscriptionId, notification) => {
|
||||
if (notification.deleted && notification.sid) {
|
||||
return handleDeletedNotification(subscriptionId, notification);
|
||||
}
|
||||
return handleNewOrUpdatedNotification(subscriptionId, notification);
|
||||
};
|
||||
|
||||
const handleNewOrUpdatedNotification = async (subscriptionId, notification) => {
|
||||
const added = await subscriptionManager.addNotification(subscriptionId, notification);
|
||||
if (added) {
|
||||
await subscriptionManager.notify(subscriptionId, notification);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeletedNotification = async (subscriptionId, notification) => {
|
||||
await subscriptionManager.deleteNotificationBySid(subscriptionId, notification.sid);
|
||||
};
|
||||
|
||||
const handleMessage = async (subscriptionId, message) => {
|
||||
const subscription = await subscriptionManager.get(subscriptionId);
|
||||
|
||||
@@ -231,7 +242,9 @@ export const useIsLaunchedPWA = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (isIOSStandalone) {
|
||||
return () => {}; // No need to listen for events on iOS
|
||||
return () => {
|
||||
// No need to listen for events on iOS
|
||||
};
|
||||
}
|
||||
const handler = (evt) => {
|
||||
console.log(`[useIsLaunchedPWA] App is now running ${evt.matches ? "standalone" : "in the browser"}`);
|
||||
|
||||
Reference in New Issue
Block a user