summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-11-28 15:02:56 -0600
committerChristopher Speller <crspeller@gmail.com>2017-11-28 13:02:56 -0800
commitb87fae646a624507f5b2c1270cae1d3585f589ac (patch)
treed81b683cda11b08ed04d7e2431b04a84a715d851 /app/channel.go
parent27ba68a7894d5204b8d75dc7353774977d62fa15 (diff)
downloadchat-b87fae646a624507f5b2c1270cae1d3585f589ac.tar.gz
chat-b87fae646a624507f5b2c1270cae1d3585f589ac.tar.bz2
chat-b87fae646a624507f5b2c1270cae1d3585f589ac.zip
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
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/channel.go b/app/channel.go
index 50067d42d..16c5dd084 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -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