store: guests will only receive results of which channels they are in (#20295)
* store: guests will only receive results of which channels they are in * api4/channel_test: add test case for guest accounts channel autocomplete * apply to searchengine and also for AutocompleteInTeam Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cffe921e62
Коммит
fe3816cc20
@@ -2781,7 +2781,12 @@ func (a *App) AutocompleteChannels(userID, term string) (model.ChannelListWithTe
|
||||
includeDeleted := *a.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
term = strings.TrimSpace(term)
|
||||
|
||||
channelList, err := a.Srv().Store.Channel().Autocomplete(userID, term, includeDeleted)
|
||||
user, appErr := a.GetUser(userID)
|
||||
if appErr != nil {
|
||||
return nil, appErr
|
||||
}
|
||||
|
||||
channelList, err := a.Srv().Store.Channel().Autocomplete(userID, term, includeDeleted, user.IsGuest())
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("AutocompleteChannels", "app.channel.search.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -2793,7 +2798,12 @@ func (a *App) AutocompleteChannelsForTeam(teamID, userID, term string) (model.Ch
|
||||
includeDeleted := *a.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
term = strings.TrimSpace(term)
|
||||
|
||||
channelList, err := a.Srv().Store.Channel().AutocompleteInTeam(teamID, userID, term, includeDeleted)
|
||||
user, appErr := a.GetUser(userID)
|
||||
if appErr != nil {
|
||||
return nil, appErr
|
||||
}
|
||||
|
||||
channelList, err := a.Srv().Store.Channel().AutocompleteInTeam(teamID, userID, term, includeDeleted, user.IsGuest())
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("AutocompleteChannels", "app.channel.search.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user