i dont even know what this PR is supposed to be about anymore, everyone lost the plot somewhere in the middle of act 2 #74
1 changed files with 3 additions and 6 deletions
OH, I'm SUCH an IDIOT!
This code runs in a loop. And it always starts with the root space. So it always finds a space. And it then never clears it out. Also, it was after the break;, so EVEN IF it somehow reached our room as false, and then was gonna update it to true because it was a space - it now would not have done that because the loop will had been ended. Fixed by moving the code to where it made any sense.
commit
f53190f186
|
|
@ -189,18 +189,15 @@ as.router.post("/api/link", defineEventHandler(async event => {
|
||||||
// When finding a room during iteration, see if it was the requested room (to confirm that the room is in the space)
|
// When finding a room during iteration, see if it was the requested room (to confirm that the room is in the space)
|
||||||
if (room.room_id === parsedBody.matrix) {
|
if (room.room_id === parsedBody.matrix) {
|
||||||
foundRoom = true
|
foundRoom = true
|
||||||
|
// And also, now that we know that the room object is our intended room - we can test for its type.
|
||||||
|
if (room.room_type && room.room_type === "m.space") foundSpace = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foundRoom && foundVia) break
|
if (foundRoom && foundVia) break
|
||||||
|
|
||||||
if (room.room_type && room.room_type === "m.space") {
|
|
||||||
foundSpace = true
|
|
||||||
}
|
|
||||||
console.log(room.room_type+"@"+room.room_id + " ==> "+ foundSpace)
|
|
||||||
}
|
}
|
||||||
if (!foundRoom) throw createError({status: 400, message: "Bad Request", data: "Matrix room needs to be part of the bridged space"})
|
if (!foundRoom) throw createError({status: 400, message: "Bad Request", data: "Matrix room needs to be part of the bridged space"})
|
||||||
|
|
||||||
//Ensure link rules are upheld
|
// Ensure link rules are upheld
|
||||||
const rule = guildRoute.linkRules.get(channel.type)
|
const rule = guildRoute.linkRules.get(channel.type)
|
||||||
if (!rule || rule.unsupported) throw createError({status:400, message: "Bad Request", data: "You cannot bridge to " + (rule ? (rule.humanName+"(type-"+channel.type+" channels)") : ("unknown-type ("+channel.type+") channels")) + " because: " + (rule ? rule.unsupported : "OOYE doesn't even know what they are yet.")})
|
if (!rule || rule.unsupported) throw createError({status:400, message: "Bad Request", data: "You cannot bridge to " + (rule ? (rule.humanName+"(type-"+channel.type+" channels)") : ("unknown-type ("+channel.type+") channels")) + " because: " + (rule ? rule.unsupported : "OOYE doesn't even know what they are yet.")})
|
||||||
else if (foundSpace && rule.type === "TYPING") throw createError({status: 400, message: "Bad Request", data: "Matrix room cannot be of type m.space when bridging to "+rule.humanName})
|
else if (foundSpace && rule.type === "TYPING") throw createError({status: 400, message: "Bad Request", data: "Matrix room cannot be of type m.space when bridging to "+rule.humanName})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue