feat/add-unlink-space-button #63
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "Elliu/out-of-your-element:feat/add-unlink-space-button"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add an unlink space button in the /guild page
This unlinks every rooms in the linked space, then self power down the bridge user, and leave the space
@ -213,0 +271,4 @@// but when selected we get the "Please add the bot to your server using the buttons on the home page." page//// So either keep as-is, or delete from guild_active, but also leave the discord guild? Not sure if we want that or not// db.prepare("DELETE FROM guild_active WHERE guild_id=?").run(guild_id)Hi, there is this issue here, I'm not sure what would be the best thing to do with this situation, please let me know if you have any ideas of what should be best
Nice find, thanks for pointing it out. For further reading, the purpose and values of guild_active are explained here: https://gitdab.com/cadence/out-of-your-element/src/branch/main/docs/self-service-room-creation-rules.md
The message "Please add the bot to your server using the buttons on the home page" is deliberately designed to appear in this situation. However, the user experience here could be better.
There's a couple of possible paths forward here:
Because per the explainer doc, it's bad to leave around the a guild_active entry if you don't want the guild to be bridged. If Easy Mode was previously selected, it would cause channels to bridge themselves again just from anybody sending a message in the server. That would be pretty weird if somebody just clicked unbridge and it starts bridging again seemingly by itself! So we can't just do nothing here.
I'll let you pick which path forward you'd like to go with. I don't have any preference between the first two.
I note that you've coded it to always leave the Matrix space after this operation. I don't think it would be out of character for it to leave the Discord server as well.
10d14bbdaato16309f26b3Just an initial eyeball. I haven't executed this code yet.
@ -119,4 +175,2 @@// Check guild ID or nonceconst guildID = parsedBody.guild_idif (!managed.has(guildID)) throw createError({status: 403, message: "Forbidden", data: "Can't edit a guild you don't have Manage Server permissions in"})You deleted the thing that checks that the user has Manage Server permissions and you didn't put it back.
Not sure how this wasn't caught by tests. Maybe I need to add more tests.
I think I preferred how this looked before, where the checks were done inline, rather than how it looks now, where you've extracted each check to a function. Sure, there was some repetition of code before, but I think it was easier to read because you can just read down the file and see everything, rather than having to jump around looking in to each function.
If you keep the checked as extracted functions, I would like to see more descriptive function names + descriptions of what happens in the
/** */comments on the function so they can be hovered to see their intention. The current names are not so good:validateUserHaveRightsOnGuild- what kind of validation outcome + what kind of user + what kind of rights? tryensureDiscordUserHasManageServervalidateGuildAccess- what kind of validation outcome + what kind of access + whose access? try coming up with a better name@ -678,2 +680,4 @@}))t.equal(error.data, "Channel ID 665310973967597573 is not currently bridged")db.prepare("INSERT INTO channel_room (channel_id, room_id, name, nick, thread_parent, custom_avatar, last_bridged_pin_timestamp, speedbump_id, speedbump_checked, speedbump_webhook_id, guild_id, custom_topic) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(row.channel_id, row.room_id, row.name, row.nick, row.thread_parent, row.custom_avatar, row.last_bridged_pin_timestamp, row.speedbump_id, row.speedbump_checked, row.speedbump_webhook_id, row.guild_id, row.custom_topic)What is the purpose of this database operation?
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.