Skip to content

Commit 23006d7

Browse files
committed
fix: mark as done enterprise server. additional guards
Signed-off-by: Adam Setch <[email protected]>
1 parent 6a6c701 commit 23006d7

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

src/renderer/components/NotificationRow.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export const NotificationRow: FC<INotificationRow> = ({
5050

5151
openNotification(notification);
5252

53-
if (settings.markAsDoneOnOpen) {
53+
if (
54+
isMarkAsDoneFeatureSupported(notification.account) &&
55+
settings.markAsDoneOnOpen
56+
) {
5457
markNotificationsAsDone([notification]);
5558
} else {
5659
markNotificationsAsRead([notification]);

src/renderer/hooks/useNotifications.ts

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,24 @@ export const useNotifications = (): NotificationsState => {
103103

104104
try {
105105
await Promise.all(
106-
readNotifications.map((notification) =>
107-
markNotificationThreadAsRead(
108-
notification.id,
109-
notification.account.hostname,
110-
notification.account.token,
111-
),
112-
),
106+
readNotifications.map((notification) => {
107+
if (
108+
isMarkAsDoneFeatureSupported(readNotifications[0].account) &&
109+
state.settings.markAsDoneOnOpen
110+
) {
111+
markNotificationThreadAsDone(
112+
notification.id,
113+
notification.account.hostname,
114+
notification.account.token,
115+
);
116+
} else {
117+
markNotificationThreadAsRead(
118+
notification.id,
119+
notification.account.hostname,
120+
notification.account.token,
121+
);
122+
}
123+
}),
113124
);
114125

115126
const updatedNotifications = removeNotifications(
@@ -174,7 +185,10 @@ export const useNotifications = (): NotificationsState => {
174185
notification.account.token,
175186
);
176187

177-
if (state.settings.markAsDoneOnUnsubscribe) {
188+
if (
189+
isMarkAsDoneFeatureSupported(notification.account) &&
190+
state.settings.markAsDoneOnUnsubscribe
191+
) {
178192
await markNotificationsAsDone(state, [notification]);
179193
} else {
180194
await markNotificationsAsRead(state, [notification]);

0 commit comments

Comments
 (0)