WIP: feature: threads'n'forums #74
1 changed files with 5 additions and 2 deletions
|
|
@ -213,12 +213,15 @@ async event => {
|
||||||
|
|
||||||
let processCommands = true
|
let processCommands = true
|
||||||
if (event.content["m.relates_to"]?.rel_type === "m.thread") {
|
if (event.content["m.relates_to"]?.rel_type === "m.thread") {
|
||||||
const toRedact = event.room_id
|
/**@type {string|null} */
|
||||||
|
let toRedact = event.room_id
|
||||||
const bridgedTo = utils.getThreadRoomFromThreadEvent(event.content["m.relates_to"].event_id)
|
const bridgedTo = utils.getThreadRoomFromThreadEvent(event.content["m.relates_to"].event_id)
|
||||||
processCommands = false
|
processCommands = false
|
||||||
|
|
||||||
if (bridgedTo) event.room_id = bridgedTo;
|
if (bridgedTo) event.room_id = bridgedTo;
|
||||||
else if (await bridgeThread(event)) {
|
else if (!await bridgeThread(event)) toRedact = null; //Don't remove anything, if there is nowhere to relocate it to.
|
||||||
|
|
||||||
|
if (toRedact) {
|
||||||
api.redactEvent(toRedact, event.event_id)
|
api.redactEvent(toRedact, event.event_id)
|
||||||
event.content["m.relates_to"] = undefined
|
event.content["m.relates_to"] = undefined
|
||||||
api.sendEvent(event.room_id, event.type, {...event.content, body: event.content.body+"\n ~ "+event.sender, formatted_body: event.content.formatted_body ? event.content.formatted_body+"<br> ~ "+event.sender :undefined })
|
api.sendEvent(event.room_id, event.type, {...event.content, body: event.content.body+"\n ~ "+event.sender, formatted_body: event.content.formatted_body ? event.content.formatted_body+"<br> ~ "+event.sender :undefined })
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue