zaanposni / discord-masz

MASZ is a selfhostable highly sophisticated moderation bot for Discord. Includes a web dashboard and a discord bot.
https://discord.gg/5zjpzw6h3S
Other
71 stars 17 forks source link

Incorrect link in automod tab #439

Closed FlixProd closed 2 years ago

FlixProd commented 2 years ago

When clicking the View Case button on an automoderation, the button link is incorrect, resulting in a blank case page. The button links to https://masz.url.de/guilds/1234456789/cases/66, but when the case is opened from the normal ,,Cases" tab, the case opens under the url https://masz.url.de/guilds/123456789/cases/10 (this is the correct link)

Gif

FlixProd commented 2 years ago

Sorry, looks like a local problem only 🙈 On the demo instance it works correctly

zaanposni commented 2 years ago

This is in fact a real problem. Let me explain it really quick. There are two different ids. On database internal id (auto_increment) and one caseId that is only auto_increment for each guild. The caseId should be used for everything since it is unique per guild and is also what the user is supposed to see. On the demo instance there are only 50 cases per default and only one guild which means that the id always equals the caseId. In your case you might have multiple guilds or cases that got deleted already which means the id and caseId are no longer equal.

Problem is that in this line the AssociatedCaseId which is used to generate the link is assigned incorrectly.

I have already adjusted it for release 2.2.0. I am leaving this issue open for the sake of clarity so I do not forget it in the patchnotes.