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
2 changed files with 11 additions and 5 deletions
Filter out the root space
commit
c8bf730ec4
|
|
@ -257,6 +257,11 @@ block body
|
||||||
ul.my8.ml24
|
ul.my8.ml24
|
||||||
each row in removedEncryptedRooms
|
each row in removedEncryptedRooms
|
||||||
li: a(href=`https://matrix.to/#/${row.room_id}`)= row.name
|
li: a(href=`https://matrix.to/#/${row.room_id}`)= row.name
|
||||||
|
h3.mt24 Unavailable rooms: Root space
|
||||||
|
.s-card.p0
|
||||||
|
ul.my8.ml24
|
||||||
|
each row in removedRootSpaceRooms
|
||||||
|
li: a(href=`https://matrix.to/#/${row.room_id}`) (#{row.room_type}) #{row.name}
|
||||||
h3.mt24 Unavailable rooms: Archived thread
|
h3.mt24 Unavailable rooms: Archived thread
|
||||||
p If you still want to link with any of these rooms (eg. you accidentally unlinked it and want to bring it back, or you're migrating from a different bridge that happens to use OOYE's prefixes), please remove the [⛓️] or [🔒⛓️] prefix in Matrix's room settings and refresh the page.
|
p If you still want to link with any of these rooms (eg. you accidentally unlinked it and want to bring it back, or you're migrating from a different bridge that happens to use OOYE's prefixes), please remove the [⛓️] or [🔒⛓️] prefix in Matrix's room settings and refresh the page.
|
||||||
.s-card.p0
|
.s-card.p0
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,9 @@ function getPosition(channel, channels) {
|
||||||
* @param {DiscordTypes.APIGuild} guild
|
* @param {DiscordTypes.APIGuild} guild
|
||||||
* @param {Ty.R.Hierarchy[]} rooms
|
* @param {Ty.R.Hierarchy[]} rooms
|
||||||
* @param {string[]} roles
|
* @param {string[]} roles
|
||||||
|
* @param {string?} space
|
||||||
*/
|
*/
|
||||||
function getChannelRoomsLinks(guild, rooms, roles) {
|
function getChannelRoomsLinks(guild, rooms, roles, space) {
|
||||||
let channelIDs = discord.guildChannelMap.get(guild.id)
|
let channelIDs = discord.guildChannelMap.get(guild.id)
|
||||||
assert(channelIDs)
|
assert(channelIDs)
|
||||||
|
|
||||||
|
|
@ -149,7 +150,7 @@ function getChannelRoomsLinks(guild, rooms, roles) {
|
||||||
let linkedRoomIDs = linkedChannels.map(c => c.room_id)
|
let linkedRoomIDs = linkedChannels.map(c => c.room_id)
|
||||||
let unlinkedRooms = [...rooms]
|
let unlinkedRooms = [...rooms]
|
||||||
let removedLinkedRooms = dUtils.filterTo(unlinkedRooms, r => !linkedRoomIDs.includes(r.room_id))
|
let removedLinkedRooms = dUtils.filterTo(unlinkedRooms, r => !linkedRoomIDs.includes(r.room_id))
|
||||||
let removedWrongTypeRooms = []
|
let removedRootSpaceRooms = dUtils.filterTo(unlinkedRooms, r => r.room_id !== space)
|
||||||
let removedEncryptedRooms = dUtils.filterTo(unlinkedRooms, r => !r.encryption && !r["im.nheko.summary.encryption"])
|
let removedEncryptedRooms = dUtils.filterTo(unlinkedRooms, r => !r.encryption && !r["im.nheko.summary.encryption"])
|
||||||
// https://discord.com/developers/docs/topics/threads#active-archived-threads
|
// https://discord.com/developers/docs/topics/threads#active-archived-threads
|
||||||
// need to filter out linked archived threads from unlinkedRooms, will just do that by comparing against the name
|
// need to filter out linked archived threads from unlinkedRooms, will just do that by comparing against the name
|
||||||
|
|
@ -157,7 +158,7 @@ function getChannelRoomsLinks(guild, rooms, roles) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
linkedChannelsWithDetails, unlinkedChannels, unlinkedRooms,
|
linkedChannelsWithDetails, unlinkedChannels, unlinkedRooms,
|
||||||
removedUncachedChannels, removedWrongTypeChannels, removedPrivateChannels, removedLinkedRooms, removedWrongTypeRooms, removedArchivedThreadRooms, removedEncryptedRooms
|
removedUncachedChannels, removedWrongTypeChannels, removedPrivateChannels, removedLinkedRooms, removedRootSpaceRooms, removedArchivedThreadRooms, removedEncryptedRooms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -198,14 +199,14 @@ as.router.get("/guild", defineEventHandler(async event => {
|
||||||
|
|
||||||
// Easy mode guild that hasn't been linked yet - need to remove elements that would require an existing space
|
// Easy mode guild that hasn't been linked yet - need to remove elements that would require an existing space
|
||||||
if (!row.space_id) {
|
if (!row.space_id) {
|
||||||
const links = getChannelRoomsLinks(guild, [], roles)
|
const links = getChannelRoomsLinks(guild, [], roles, row.space_id)
|
||||||
return pugSync.render(event, "guild.pug", {guild, guild_id, ...links, ...row})
|
return pugSync.render(event, "guild.pug", {guild, guild_id, ...links, ...row})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Linked guild
|
// Linked guild
|
||||||
const api = getAPI(event)
|
const api = getAPI(event)
|
||||||
const rooms = await api.getFullHierarchy(row.space_id)
|
const rooms = await api.getFullHierarchy(row.space_id)
|
||||||
const links = getChannelRoomsLinks(guild, rooms, roles)
|
const links = getChannelRoomsLinks(guild, rooms, roles, row.space_id)
|
||||||
return pugSync.render(event, "guild.pug", {guild, guild_id, ...links, ...row})
|
return pugSync.render(event, "guild.pug", {guild, guild_id, ...links, ...row})
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue