[MM-24065] Guest users should be able to search by channel (#14302)
* Remove unnecessary check for PERMISSION_LIST_TEAM_CHANNELS In the autocompleteChannelsForTeamForSearch method we're checking for the PERMISSION_LIST_TEAM_CHANNELS permission in order to avoid filtering channels in the autocomplete search but this check is not necessary. Now we're going directly to the database to search for those channels in this specific method and we're filtering by channel membership and team so there is no chance that we are going to filter undesired channels to the user. [Here](https://github.com/mattermost/mattermost-server/blob/v5.22.0/store/sqlstore/channel_store.go#L2014) is the query where you can see the filtering we're making
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
176db1e189
Коммит
cff7de9e68
@@ -865,11 +865,6 @@ func autocompleteChannelsForTeamForSearch(c *Context, w http.ResponseWriter, r *
|
||||
return
|
||||
}
|
||||
|
||||
if !c.App.SessionHasPermissionToTeam(*c.App.Session(), c.Params.TeamId, model.PERMISSION_LIST_TEAM_CHANNELS) {
|
||||
c.SetPermissionError(model.PERMISSION_LIST_TEAM_CHANNELS)
|
||||
return
|
||||
}
|
||||
|
||||
name := r.URL.Query().Get("name")
|
||||
|
||||
channels, err := c.App.AutocompleteChannelsForSearch(c.Params.TeamId, c.App.Session().UserId, name)
|
||||
@@ -878,8 +873,6 @@ func autocompleteChannelsForTeamForSearch(c *Context, w http.ResponseWriter, r *
|
||||
return
|
||||
}
|
||||
|
||||
// Don't fill in channels props, since unused by client and potentially expensive.
|
||||
|
||||
w.Write([]byte(channels.ToJson()))
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user