zorchenhimer / MoviePolls

Voting to decide on a movie to watch with MovieNight
https://discord.gg/F2VSgjJ
16 stars 6 forks source link

Rewrite#60 #63

Closed CptPie closed 4 years ago

CptPie commented 4 years ago

This PRs goal is to improve overall readability of the code as well as reducing the size of the biggest function in server.go.

When this will get merged into master it will fix #60.

CptPie commented 4 years ago

This situation should never be possible. Both the options for formfill and autofill are disabled, so why is it giving me something to submit if it won't accept anything?

Yeah i see your point there, for now i took your advice to remove the enableautofill config value.

Additionally, if only auto-fill is enabled the user shouldn't need to check a box to auto-fill. Making things more inconsistent, the checkbox is apparently ignored anyway.

Yeah that shouldnt have been there, i messed up the {{end}} location for the formfill block, this is now not rendered unless formfill is enabled.

Lastly, these error messages are inconsistent (and one is incorrect): The description label isn't highlighted but throws an error. This same error is missing the word "not", and should be more specific of which fields couldn't be read.

That was caused by my new error handling approach which exits the formfill function as soon as one error is detected (like an exit early). I removed this approach and now all errors are returned at the end of the checks.

zorchenhimer commented 4 years ago

Thanks!