Create direct message respect the user role (Guest/Normal user) (#11697)

* Create direct message respect the user role (Guest/Normal user)

* Fixing build

* Updating Timer store layer
Этот коммит содержится в:
Jesús Espino
2019-08-06 11:33:32 +02:00
коммит произвёл GitHub
родитель 619f0ebf5c
Коммит 2df3951f6f
7 изменённых файлов: 37 добавлений и 24 удалений

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

@@ -340,15 +340,19 @@ func (a *App) createDirectChannel(userId string, otherUserId string) (*model.Cha
close(uc2)
}()
if result := <-uc1; result.Err != nil {
result := <-uc1
if result.Err != nil {
return nil, model.NewAppError("CreateDirectChannel", "api.channel.create_direct_channel.invalid_user.app_error", nil, userId, http.StatusBadRequest)
}
user := result.Data.(*model.User)
if result := <-uc2; result.Err != nil {
result = <-uc2
if result.Err != nil {
return nil, model.NewAppError("CreateDirectChannel", "api.channel.create_direct_channel.invalid_user.app_error", nil, otherUserId, http.StatusBadRequest)
}
otherUser := result.Data.(*model.User)
channel, err := a.Srv.Store.Channel().CreateDirectChannel(userId, otherUserId)
channel, err := a.Srv.Store.Channel().CreateDirectChannel(user, otherUser)
if err != nil {
if err.Id == store.CHANNEL_EXISTS_ERROR {
return channel, err