Fixes #9 and closes #8. This adds a way to mark servers as read.

Servers are also marked as read when joining them.
You can now also mark DMs as read.
This commit is contained in:
Paul
2021-08-07 12:30:19 +01:00
parent 2f06112921
commit 0ea80b5717
7 changed files with 54 additions and 11 deletions

View File

@@ -75,6 +75,7 @@ type Action =
| { action: "copy_selection" }
| { action: "copy_text"; content: string }
| { action: "mark_as_read"; channel: Channel }
| { action: "mark_server_as_read"; server: Server }
| { action: "retry_message"; message: QueuedMessage }
| { action: "cancel_message"; message: QueuedMessage }
| { action: "mention"; user: string }
@@ -178,10 +179,17 @@ function ContextMenus(props: Props) {
message,
});
client.req(
"PUT",
`/channels/${data.channel._id}/ack/${message}` as "/channels/id/ack/id",
);
data.channel.ack(message);
}
break;
case "mark_server_as_read":
{
dispatch({
type: "UNREADS_MARK_MULTIPLE_READ",
channels: data.server.channel_ids,
});
data.server.ack();
}
break;
@@ -547,6 +555,16 @@ function ContextMenus(props: Props) {
generateAction({ action: "mark_as_read", channel });
}
if (server && unread) {
generateAction(
{
action: "mark_server_as_read",
server,
},
"mark_as_read",
);
}
if (contextualChannel) {
if (user && user._id !== userId) {
generateAction({