Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ export abstract class BaseClient {
abstract markAllAsRead(options?: RequestOptions): Promise<void>;

abstract markNotificationAsRead(
payload: { notification: types.Notification; read: boolean },
payload: {
kind: types.NotificationDataType;
notification_id: number;
read: boolean;
},
options?: RequestOptions,
): Promise<void>;

Expand Down
10 changes: 5 additions & 5 deletions src/providers/lemmyv0/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,11 @@ export class UnsafeLemmyV0Client implements BaseClient {
payload: Parameters<BaseClient["markNotificationAsRead"]>[0],
options?: RequestOptions,
): ReturnType<BaseClient["markNotificationAsRead"]> {
const { notification, read } = payload;
switch (notification.kind) {
const { kind, notification_id, read } = payload;
switch (kind) {
case "mention":
await this.#client.markPersonMentionAsRead(
{ person_mention_id: notification.id, read },
{ person_mention_id: notification_id, read },
options,
);
return;
Expand All @@ -713,13 +713,13 @@ export class UnsafeLemmyV0Client implements BaseClient {
return;
case "private_message":
await this.#client.markPrivateMessageAsRead(
{ private_message_id: notification.id, read },
{ private_message_id: notification_id, read },
options,
);
return;
case "reply":
await this.#client.markCommentReplyAsRead(
{ comment_reply_id: notification.id, read },
{ comment_reply_id: notification_id, read },
options,
);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/lemmyv1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export class UnsafeLemmyV1Client implements BaseClient {
): ReturnType<BaseClient["markNotificationAsRead"]> {
await unwrap(
await this.#client.markNotificationAsRead(
{ notification_id: payload.notification.id, read: payload.read },
{ notification_id: payload.notification_id, read: payload.read },
options,
),
);
Expand Down
8 changes: 4 additions & 4 deletions src/providers/piefed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,13 +781,13 @@ export class UnsafePiefedClient implements BaseClient {
payload: Parameters<BaseClient["markNotificationAsRead"]>[0],
options?: RequestOptions,
): ReturnType<BaseClient["markNotificationAsRead"]> {
const { notification, read } = payload;
switch (notification.kind) {
const { kind, notification_id, read } = payload;
switch (kind) {
case "mention":
case "reply":
await this.#client.POST("/api/alpha/comment/mark_as_read", {
...options,
body: { comment_reply_id: notification.id, read },
body: { comment_reply_id: notification_id, read },
});
return;
case "mod_action":
Expand All @@ -796,7 +796,7 @@ export class UnsafePiefedClient implements BaseClient {
case "private_message":
await this.#client.POST("/api/alpha/private_message/mark_as_read", {
...options,
body: { private_message_id: notification.id, read },
body: { private_message_id: notification_id, read },
});
return;
}
Expand Down
Loading