[🐴] Clean up after deleting message (#3950)

* Clean up after removal

* Remove console
zio/stable
Eric Bailey 2024-05-10 10:40:52 -05:00 committed by GitHub
parent 54c4baacb6
commit d7f3a8d01f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

View File

@ -35,11 +35,13 @@ describe(`#/state/messages/convo`, () => {
it.todo( it.todo(
`successfully sent messages are re-ordered, if needed, by events received from server`, `successfully sent messages are re-ordered, if needed, by events received from server`,
) )
it.todo(`pending messages are cleaned up from state after firehose event`)
}) })
describe(`deleting messages`, () => { describe(`deleting messages`, () => {
it.todo(`messages are optimistically deleted from the chat`) it.todo(`messages are optimistically deleted from the chat`)
it.todo(`messages are confirmed deleted via events from the server`) it.todo(`messages are confirmed deleted via events from the server`)
it.todo(`deleted messages are cleaned up from state after firehose event`)
}) })
describe(`log handling`, () => { describe(`log handling`, () => {

View File

@ -678,14 +678,10 @@ export class Convo {
/* /*
* Update if we have this in state. If we don't, don't worry about it. * Update if we have this in state. If we don't, don't worry about it.
*/ */
// TODO check for other storage spots if (
if (this.pastMessages.has(ev.message.id)) { this.pastMessages.has(ev.message.id) ||
/* this.newMessages.has(ev.message.id)
* For now, we remove deleted messages from the thread, if we receive one. ) {
*
* To support them, it'd look something like this:
* this.pastMessages.set(ev.message.id, ev.message)
*/
this.pastMessages.delete(ev.message.id) this.pastMessages.delete(ev.message.id)
this.newMessages.delete(ev.message.id) this.newMessages.delete(ev.message.id)
this.deletedMessages.delete(ev.message.id) this.deletedMessages.delete(ev.message.id)