[MM-34076] Add Plugin API User custom status (#17435)

* add missing client for custom user status

* add custom user status plugin api

* update based on feedback review

* add GetCustomStatus

* update interfaces
Этот коммит содержится в:
Carlos Tadeu Panato Junior
2021-11-10 17:11:20 +01:00
коммит произвёл GitHub
родитель 0a3e7f4d55
Коммит bb5a74a42b
13 изменённых файлов: 290 добавлений и 4 удалений

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

@@ -406,6 +406,10 @@ func (a *App) UpdateDNDStatusOfUsers() {
}
func (a *App) SetCustomStatus(userID string, cs *model.CustomStatus) *model.AppError {
if cs == nil || (cs.Emoji == "" && cs.Text == "") {
return model.NewAppError("SetCustomStatus", "api.custom_status.set_custom_statuses.update.app_error", nil, "", http.StatusBadRequest)
}
user, err := a.GetUser(userID)
if err != nil {
return err
@@ -439,6 +443,15 @@ func (a *App) RemoveCustomStatus(userID string) *model.AppError {
return nil
}
func (a *App) GetCustomStatus(userID string) (*model.CustomStatus, *model.AppError) {
user, err := a.GetUser(userID)
if err != nil {
return &model.CustomStatus{}, err
}
return user.GetCustomStatus(), nil
}
func (a *App) addRecentCustomStatus(userID string, status *model.CustomStatus) *model.AppError {
var newRCS model.RecentCustomStatuses