MODiX icon indicating copy to clipboard operation
MODiX copied to clipboard

Refactor tag management in front end to not check for maintaining capability on initial load

Open patrickklaeren opened this issue 5 years ago • 3 comments

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.

patrickklaeren avatar Jan 14 '20 01:01 patrickklaeren

Is it done this way so the ui knows to show the edit button?

joshuaedwardcrowe avatar Jan 14 '20 12:01 joshuaedwardcrowe

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.

Scott-Caldwell avatar Jan 14 '20 14:01 Scott-Caldwell

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.

joshuaedwardcrowe avatar Jan 14 '20 15:01 joshuaedwardcrowe

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.

patrickklaeren avatar Mar 26 '24 14:03 patrickklaeren