PLT-5458: If someone posts a channel link to channel_A that you don't belong to, it doesn't render properly (#7833)

* add channel link hints to post props

* optimization

* update regex, add unit test

* fix rebase issue
Этот коммит содержится в:
Chris
2017-11-28 15:02:56 -06:00
коммит произвёл Christopher Speller
родитель 27ba68a789
Коммит b87fae646a
9 изменённых файлов: 252 добавлений и 0 удалений

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

@@ -757,6 +757,18 @@ func (a *App) GetChannelByName(channelName, teamId string) (*model.Channel, *mod
}
}
func (a *App) GetChannelsByNames(channelNames []string, teamId string) ([]*model.Channel, *model.AppError) {
if result := <-a.Srv.Store.Channel().GetByNames(teamId, channelNames, true); result.Err != nil && result.Err.Id == "store.sql_channel.get_by_name.missing.app_error" {
result.Err.StatusCode = http.StatusNotFound
return nil, result.Err
} else if result.Err != nil {
result.Err.StatusCode = http.StatusBadRequest
return nil, result.Err
} else {
return result.Data.([]*model.Channel), nil
}
}
func (a *App) GetChannelByNameForTeamName(channelName, teamName string) (*model.Channel, *model.AppError) {
var team *model.Team