mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -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({
|
dispatcher({
|
||||||
type: "UNREADS_MARK_READ",
|
type: "UNREADS_MARK_READ",
|
||||||
channel: channel._id,
|
channel: channel._id,
|
||||||
message,
|
message
|
||||||
request: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ctx.client.req('PUT', `/channels/${channel._id}/ack/${message}` as '/channels/id/ack/id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,7 @@ export function registerEvents({
|
||||||
dispatcher({
|
dispatcher({
|
||||||
type: "UNREADS_MARK_READ",
|
type: "UNREADS_MARK_READ",
|
||||||
channel: packet.id,
|
channel: packet.id,
|
||||||
message: packet.message_id,
|
message: packet.message_id
|
||||||
request: false
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,13 +91,18 @@ function ContextMenus(props: WithDispatcher) {
|
||||||
writeClipboard(document.getSelection()?.toString() ?? '');
|
writeClipboard(document.getSelection()?.toString() ?? '');
|
||||||
break;
|
break;
|
||||||
case "mark_as_read":
|
case "mark_as_read":
|
||||||
|
{
|
||||||
if (data.channel.channel_type === 'SavedMessages') return;
|
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({
|
props.dispatcher({
|
||||||
type: "UNREADS_MARK_READ",
|
type: "UNREADS_MARK_READ",
|
||||||
channel: data.channel._id,
|
channel: data.channel._id,
|
||||||
message: data.channel.channel_type === 'TextChannel' ? data.channel.last_message : data.channel.last_message._id,
|
message
|
||||||
request: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.req('PUT', `/channels/${data.channel._id}/ack/${message}` as '/channels/id/ack/id');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "retry_message":
|
case "retry_message":
|
||||||
|
|
|
@ -10,7 +10,6 @@ export type UnreadsAction =
|
||||||
type: "UNREADS_MARK_READ";
|
type: "UNREADS_MARK_READ";
|
||||||
channel: string;
|
channel: string;
|
||||||
message: string;
|
message: string;
|
||||||
request: boolean;
|
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "UNREADS_SET";
|
type: "UNREADS_SET";
|
||||||
|
@ -28,10 +27,6 @@ export type UnreadsAction =
|
||||||
export function unreads(state = {} as Unreads, action: UnreadsAction): Unreads {
|
export function unreads(state = {} as Unreads, action: UnreadsAction): Unreads {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "UNREADS_MARK_READ":
|
case "UNREADS_MARK_READ":
|
||||||
if (action.request) {
|
|
||||||
// client.req('PUT', `/channels/${action.channel}/ack/${action.message}` as '/channels/id/ack/id');
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
[action.channel]: {
|
[action.channel]: {
|
||||||
|
|
Loading…
Reference in a new issue