Add "mark as read" button

pull/330/head
Philipp Heckel 2022-05-07 19:16:08 -04:00
parent 344da326cd
commit 15ac5ed23b
5 changed files with 13 additions and 10 deletions

View File

@ -35,6 +35,7 @@ to [@Joeharrison94](https://github.com/Joeharrison94) for the input.
* Better parsing of the user actions, allowing quotes (no ticket) * Better parsing of the user actions, allowing quotes (no ticket)
* Make web app more accessible ([#217](https://github.com/binwiederhier/ntfy/issues/217)) * Make web app more accessible ([#217](https://github.com/binwiederhier/ntfy/issues/217))
* Add "mark as read" icon button to notification ([#243](https://github.com/binwiederhier/ntfy/pull/243), thanks to [@wunter8](https://github.com/wunter8))
**Bugs:** **Bugs:**

View File

@ -27,7 +27,7 @@
"notifications_list": "Notifications list", "notifications_list": "Notifications list",
"notifications_list_item": "Notification", "notifications_list_item": "Notification",
"notifications_mark_read": "Mark as read", "notifications_mark_read": "Mark as read",
"notifications_delete": "Delete notification", "notifications_delete": "Delete",
"notifications_copied_to_clipboard": "Copied to clipboard", "notifications_copied_to_clipboard": "Copied to clipboard",
"notifications_tags": "Tags", "notifications_tags": "Tags",
"notifications_priority_x": "Priority {{priority}}", "notifications_priority_x": "Priority {{priority}}",

View File

@ -117,7 +117,7 @@ class SubscriptionManager {
async markNotificationRead(notificationId) { async markNotificationRead(notificationId) {
await db.notifications await db.notifications
.where({id: notificationId, new: 1}) .where({id: notificationId})
.modify({new: 0}); .modify({new: 0});
} }

View File

@ -8,9 +8,9 @@ import Dexie from 'dexie';
const db = new Dexie('ntfy'); const db = new Dexie('ntfy');
db.version(2).stores({ db.version(1).stores({
subscriptions: '&id,baseUrl', subscriptions: '&id,baseUrl',
notifications: '&id,subscriptionId,time,new,[subscriptionId+new],[id+new]', // compound keys for query performance notifications: '&id,subscriptionId,time,new,[subscriptionId+new]', // compound key for query performance
users: '&baseUrl,username', users: '&baseUrl,username',
prefs: '&key' prefs: '&key'
}); });

View File

@ -152,12 +152,14 @@ const NotificationItem = (props) => {
return ( return (
<Card sx={{ minWidth: 275, padding: 1 }} role="listitem" aria-label={t("notifications_list_item")}> <Card sx={{ minWidth: 275, padding: 1 }} role="listitem" aria-label={t("notifications_list_item")}>
<CardContent> <CardContent>
<IconButton onClick={handleDelete} sx={{ float: 'right', marginRight: -1, marginTop: -1 }} aria-label={t("notifications_delete")}> <Tooltip title={t("notifications_delete")} enterDelay={500}>
<CloseIcon /> <IconButton onClick={handleDelete} sx={{ float: 'right', marginRight: -1, marginTop: -1 }} aria-label={t("notifications_delete")}>
</IconButton> <CloseIcon />
</IconButton>
</Tooltip>
{notification.new === 1 && {notification.new === 1 &&
<Tooltip title={t("notifications_mark_read")}> <Tooltip title={t("notifications_mark_read")} enterDelay={500}>
<IconButton onClick={handleMarkRead} sx={{ float: 'right', marginRight: -1, marginTop: -1 }} aria-label={t("notifications_mark_read")}> <IconButton onClick={handleMarkRead} sx={{ float: 'right', marginRight: -0.5, marginTop: -1 }} aria-label={t("notifications_mark_read")}>
<CheckIcon /> <CheckIcon />
</IconButton> </IconButton>
</Tooltip>} </Tooltip>}