forked from cadence/out-of-your-element
Fix web page exploding for unlinked guilds
Now it should at least show something, though features like invite won't work correctly. More work needed.
This commit is contained in:
parent
20b575c5f7
commit
0fe02dce22
4 changed files with 90 additions and 6 deletions
|
@ -96,7 +96,7 @@ as.router.get("/guild", defineEventHandler(async event => {
|
|||
// Unlinked guild
|
||||
if (!row) {
|
||||
const links = getChannelRoomsLinks(guild_id, [])
|
||||
return pugSync.render(event, "guild.pug", {guild_id, nonce, ...links})
|
||||
return pugSync.render(event, "guild.pug", {guild, guild_id, nonce, ...links})
|
||||
}
|
||||
|
||||
// Linked guild
|
||||
|
|
|
@ -33,15 +33,34 @@ test("web guild: access denied when guild id messed up", async t => {
|
|||
t.match(content, /the selected server doesn't exist/)
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
test("web invite: access denied with invalid nonce", async t => {
|
||||
const content = await router.test("get", "/invite?nonce=1")
|
||||
t.match(content, /This QR code has expired./)
|
||||
})
|
||||
|
||||
test("web guild: can view guild", async t => {
|
||||
|
||||
|
||||
test("web guild: can view unbridged guild", async t => {
|
||||
const content = await router.test("get", "/guild?guild_id=66192955777486848", {
|
||||
sessionData: {
|
||||
managedGuilds: ["66192955777486848"]
|
||||
},
|
||||
api: {
|
||||
async getStateEvent(roomID, type, key) {
|
||||
return {}
|
||||
},
|
||||
async getMembers(roomID, membership) {
|
||||
return {chunk: []}
|
||||
},
|
||||
async getFullHierarchy(roomID) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
})
|
||||
t.match(content, /<h1[^<]*Function & Arg/)
|
||||
})
|
||||
|
||||
test("web guild: can view bridged guild", async t => {
|
||||
const content = await router.test("get", "/guild?guild_id=112760669178241024", {
|
||||
sessionData: {
|
||||
managedGuilds: ["112760669178241024"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue