mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-24 22:52:09 -05:00
Send ack PUTs for unreads.
This commit is contained in:
parent
3c8c9a672f
commit
b1a4604653
4 changed files with 16 additions and 16 deletions
|
@ -25,9 +25,10 @@ export function useUnreads({ channel, unreads, dispatcher }: UnreadProps, contex
|
|||
dispatcher({
|
||||
type: "UNREADS_MARK_READ",
|
||||
channel: channel._id,
|
||||
message,
|
||||
request: true
|
||||
message
|
||||
});
|
||||
|
||||
ctx.client.req('PUT', `/channels/${channel._id}/ack/${message}` as '/channels/id/ack/id');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,8 +62,7 @@ export function registerEvents({
|
|||
dispatcher({
|
||||
type: "UNREADS_MARK_READ",
|
||||
channel: packet.id,
|
||||
message: packet.message_id,
|
||||
request: false
|
||||
message: packet.message_id
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -91,13 +91,18 @@ function ContextMenus(props: WithDispatcher) {
|
|||
writeClipboard(document.getSelection()?.toString() ?? '');
|
||||
break;
|
||||
case "mark_as_read":
|
||||
if (data.channel.channel_type === 'SavedMessages') return;
|
||||
props.dispatcher({
|
||||
type: "UNREADS_MARK_READ",
|
||||
channel: data.channel._id,
|
||||
message: data.channel.channel_type === 'TextChannel' ? data.channel.last_message : data.channel.last_message._id,
|
||||
request: true
|
||||
});
|
||||
{
|
||||
if (data.channel.channel_type === 'SavedMessages') return;
|
||||
|
||||
let message = data.channel.channel_type === 'TextChannel' ? data.channel.last_message : data.channel.last_message._id;
|
||||
props.dispatcher({
|
||||
type: "UNREADS_MARK_READ",
|
||||
channel: data.channel._id,
|
||||
message
|
||||
});
|
||||
|
||||
client.req('PUT', `/channels/${data.channel._id}/ack/${message}` as '/channels/id/ack/id');
|
||||
}
|
||||
break;
|
||||
|
||||
case "retry_message":
|
||||
|
|
|
@ -10,7 +10,6 @@ export type UnreadsAction =
|
|||
type: "UNREADS_MARK_READ";
|
||||
channel: string;
|
||||
message: string;
|
||||
request: boolean;
|
||||
}
|
||||
| {
|
||||
type: "UNREADS_SET";
|
||||
|
@ -28,10 +27,6 @@ export type UnreadsAction =
|
|||
export function unreads(state = {} as Unreads, action: UnreadsAction): Unreads {
|
||||
switch (action.type) {
|
||||
case "UNREADS_MARK_READ":
|
||||
if (action.request) {
|
||||
// client.req('PUT', `/channels/${action.channel}/ack/${action.message}` as '/channels/id/ack/id');
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
[action.channel]: {
|
||||
|
|
Loading…
Reference in a new issue