MM-55468 Ensure custom status emojis exist (#25501)
* MM-55468 Ensure custom status emojis exist * Fix plugin API unit test * Print underlying error as detailed error message * Convert CustomStatusModal tests to React Testing Library and improve a11y * Don't suggest custom statuses with non-existent emojis * Silence test error by providing fake translation strings
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
109f4643c6
Коммит
b1e745894b
@@ -77,6 +77,13 @@ func (a *App) SetCustomStatus(c request.CTX, userID string, cs *model.CustomStat
|
||||
return model.NewAppError("SetCustomStatus", "api.custom_status.set_custom_statuses.update.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
// Ensure the emoji exists before saving the custom status even if it's deleted afterwards
|
||||
if cs.Emoji != "" {
|
||||
if err := a.confirmEmojiExists(c, cs.Emoji); err != nil {
|
||||
return model.NewAppError("SetCustomStatus", "api.custom_status.set_custom_statuses.emoji_not_found", nil, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
|
||||
user, err := a.GetUser(userID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Ссылка в новой задаче
Block a user