forked from cadence/Carbon
Support redactions
This commit is contained in:
parent
6b88ede18e
commit
3535d87b8a
1 changed files with 13 additions and 1 deletions
|
@ -180,6 +180,7 @@ class ReactiveTimeline extends ElemJS {
|
|||
const group = new EventGroup(this, [event])
|
||||
this.list.splice(i, 0, group)
|
||||
this.childAt(i, group)
|
||||
event.setGroup(group)
|
||||
return true
|
||||
} else if (this.list[i] && this.list[i].data.sender === event.data.sender) {
|
||||
// if (printed++ < 100) console.log("tryadd success, using existing group")
|
||||
|
@ -246,7 +247,9 @@ class Timeline extends Subscribable {
|
|||
let id = eventData.event_id
|
||||
// handle local echoes
|
||||
if (eventData.sender === lsm.get("mx_user_id") && eventData.content && this.pending.has(eventData.content["chat.carbon.message.pending_id"])) {
|
||||
id = eventData.content["chat.carbon.message.pending_id"]
|
||||
const target = this.map.get(eventData.content["chat.carbon.message.pending_id"])
|
||||
this.map.set(id, target)
|
||||
this.map.delete(eventData.content["chat.carbon.message.pending_id"])
|
||||
}
|
||||
// handle timeline events
|
||||
if (this.map.has(id)) {
|
||||
|
@ -257,6 +260,15 @@ class Timeline extends Subscribable {
|
|||
if (eventData.type === "m.reaction") {
|
||||
continue
|
||||
}
|
||||
// skip redacted events
|
||||
if (eventData.unsigned && eventData.unsigned.redacted_by) {
|
||||
continue
|
||||
}
|
||||
// handle redactions
|
||||
if (eventData.type === "m.room.redaction") {
|
||||
if (this.map.has(eventData.redacts)) this.map.get(eventData.redacts).removeEvent()
|
||||
continue
|
||||
}
|
||||
// add new event
|
||||
const event = new Event(eventData)
|
||||
this.map.set(id, event)
|
||||
|
|
Loading…
Reference in a new issue