MM-30041: Return correct error message for user save (#16117)

* MM-30041: Return correct error message for user save

We were collapsing all types of user conflict into a single
error message. Fixed it by inspecting the field of the invalidError type
and returning the correct message.

https://mattermost.atlassian.net/browse/MM-30041

```release-note
NONE
```

* Fix test errors

* Fix wrong message in test when comparing error messages

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
Этот коммит содержится в:
Agniva De Sarker
2020-10-30 11:14:06 +05:30
коммит произвёл GitHub
родитель 1aadd36644
Коммит 325bff1176
7 изменённых файлов: 82 добавлений и 7 удалений

Просмотреть файл

@@ -881,7 +881,7 @@ func CheckErrorMessage(t *testing.T, resp *model.Response, errorId string) {
t.Helper()
require.NotNilf(t, resp.Error, "should have errored with message: %s", errorId)
require.Equalf(t, resp.Error.Id, errorId, "incorrect error message, actual: %s, expected: %s", resp.Error.Id, errorId)
require.Equalf(t, errorId, resp.Error.Id, "incorrect error message, actual: %s, expected: %s", resp.Error.Id, errorId)
}
func CheckStartsWith(t *testing.T, value, prefix, message string) {