ID validation is done using disparate code throughout the Mattermost server code. We would like the validation to be centralized to a single function or method. Any instance of len(foo) != 26 (etc) should be replaced with the centralized function/method.
Note that there is an existing function model.IsValidId which could either be used or be the basis for the solution.
If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.
New contributors please see our Developer's Guide.
@mkraft I would like to work on it. Few thoughts/questions brewing in my mind
validations.go or something on similar lines. However many of the validations methods are in utils which is an antipattern. I propose creating a validations.go in model package and moving the functions which seem apt.!= 26 with model.IsValidId. I could find 98 matches across 39 files on a case by case basis.Thoughts?
@RajatVaryani Yes that sounds good as long as you can put the validations there without dependency cycles.
Folks, I won't be able to contribute. Please make it open to the public.
If no one is working on this, I would like to pick this up!
Hi @shibasisp, just wanted to check if you have any questions about the ticket. Please let us know if you need any help
Apologies for the delay. Been stuck up in some personal work. Will try to wrap it up as soon as possible.