MODiX
MODiX copied to clipboard
Refactor tag management in front end to not check for maintaining capability on initial load
Currently we iterate over all active tags for a guild and check if the logged in user can edit the tag - regardless if they will edit the given tags. This means an exponentially growing query/load as more tags are created.
https://github.com/discord-csharp/MODiX/blob/master/Modix/Controllers/TagController.cs#L46-L49
Should be refactored, as such that the call to check if the user can edit a tag is only done when a user actually requests to edit a tag.
Is it done this way so the ui knows to show the edit button?
Yes. Given that it's pretty rare to want to edit a tag, I think it's probably fine just to always show the button and display an error dialog if they try to edit a tag that they aren't allowed to edit.
Alternately, we could try to get a paginated query working so that we only do the query for the tags being shown on the current page of the grid, but the grids we use have a selection for number of rows currently displayed, so someone could still generate a large load by just choosing to display like 100 rows.
Yes. Given that it's pretty rare to want to edit a tag, I think it's probably fine just to always show the button and display an error dialog if they try to edit a tag that they aren't allowed to edit.
I disagree with this (I'd argue its somewhat poor UI), but seems like the lesser evil tthan an expensive query.
Alternately, we could try to get a paginated query working so that we only do the query for the tags being shown on the current page of the grid, but the grids we use have a selection for number of rows currently displayed, so someone could still generate a large load by just choosing to display like 100 rows.
This is typically the approach most of the devs I know go for.
As part of a new effort to refocus on priorities, I will close this. If you feel this is imperative to the bot, a new issue can be opened to supersede this.