mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 08:30:58 -05:00
chore: handle all updates to messages
This commit is contained in:
parent
ca69a0b4c5
commit
11a17feaae
5 changed files with 14 additions and 15 deletions
|
@ -141,7 +141,7 @@
|
|||
"remark-math": "^5.1.1",
|
||||
"remark-parse": "^10.0.1",
|
||||
"remark-rehype": "^10.1.0",
|
||||
"revolt.js": "6.0.12",
|
||||
"revolt.js": "6.0.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"sass": "^1.35.1",
|
||||
"semver": "^7.3.7",
|
||||
|
|
|
@ -34,19 +34,19 @@ export class ChannelRenderer {
|
|||
});
|
||||
|
||||
this.receive = this.receive.bind(this);
|
||||
this.edit = this.edit.bind(this);
|
||||
this.updated = this.updated.bind(this);
|
||||
this.delete = this.delete.bind(this);
|
||||
|
||||
const client = this.channel.client;
|
||||
client.addListener("message", this.receive);
|
||||
client.addListener("message/update", this.edit);
|
||||
client.addListener("message/updated", this.updated);
|
||||
client.addListener("message/delete", this.delete);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
const client = this.channel.client;
|
||||
client.removeListener("message", this.receive);
|
||||
client.removeListener("message/update", this.edit);
|
||||
client.removeListener("message/updated", this.updated);
|
||||
client.removeListener("message/delete", this.delete);
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,8 @@ export class ChannelRenderer {
|
|||
this.currentRenderer.receive(this, message);
|
||||
}
|
||||
|
||||
private edit(id: string, patch: Partial<Message>) {
|
||||
this.currentRenderer.edit(this, id, patch);
|
||||
private updated(id: string, message: Message) {
|
||||
this.currentRenderer.updated(this, id, message);
|
||||
}
|
||||
|
||||
private delete(id: string) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { runInAction } from "mobx";
|
||||
|
||||
import { noopAsync } from "../../js";
|
||||
import { SMOOTH_SCROLL_ON_RECEIVE } from "../Singleton";
|
||||
import { RendererRoutines } from "../types";
|
||||
|
||||
|
@ -72,7 +71,7 @@ export const SimpleRenderer: RendererRoutines = {
|
|||
});
|
||||
});
|
||||
},
|
||||
edit: async (renderer) => {
|
||||
updated: async (renderer) => {
|
||||
renderer.emitScroll({
|
||||
type: "StayAtBottom",
|
||||
smooth: false,
|
||||
|
|
|
@ -29,10 +29,10 @@ export interface RendererRoutines {
|
|||
) => Promise<void>;
|
||||
|
||||
receive: (renderer: ChannelRenderer, message: Message) => Promise<void>;
|
||||
edit: (
|
||||
updated: (
|
||||
renderer: ChannelRenderer,
|
||||
id: string,
|
||||
partial: Partial<Message>,
|
||||
message: Message,
|
||||
) => Promise<void>;
|
||||
delete: (renderer: ChannelRenderer, id: string) => Promise<void>;
|
||||
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -3696,7 +3696,7 @@ __metadata:
|
|||
remark-math: ^5.1.1
|
||||
remark-parse: ^10.0.1
|
||||
remark-rehype: ^10.1.0
|
||||
revolt.js: 6.0.12
|
||||
revolt.js: 6.0.13
|
||||
rimraf: ^3.0.2
|
||||
sass: ^1.35.1
|
||||
semver: ^7.3.7
|
||||
|
@ -7890,9 +7890,9 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"revolt.js@npm:6.0.12":
|
||||
version: 6.0.12
|
||||
resolution: "revolt.js@npm:6.0.12"
|
||||
"revolt.js@npm:6.0.13":
|
||||
version: 6.0.13
|
||||
resolution: "revolt.js@npm:6.0.13"
|
||||
dependencies:
|
||||
"@insertish/exponential-backoff": 3.1.0-patch.2
|
||||
"@insertish/isomorphic-ws": ^4.0.1
|
||||
|
@ -7906,7 +7906,7 @@ __metadata:
|
|||
revolt-api: 0.5.5
|
||||
ulid: ^2.3.0
|
||||
ws: ^8.2.2
|
||||
checksum: 1ff667daf3e7c9b32ee383d56f79db9d5112b1ca87eb406c749fa3ce5f8adb59cd48ec3cb935932a5cc5da0af6f82e2dd7b5b83fa0705e02f66c050bc848401a
|
||||
checksum: 15fae99ced07c93942122bcc190bb03c62bf6c9bb90ca35aec5c1ed12f547e1dad7b596c549784ba8bf38ebbb96e62af195305ec92ec9fadf69969a1681b8e23
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
Loading…
Reference in a new issue