mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 07:42:48 +08:00
Only search users via rest API if user has permission (#73)
Closes https://github.com/flarum/core/issues/3070 If the user doesn't have permission to search users, there will currently be browser errors, as the current implementation will still attempt to search and autocomplete. In this PR, we check for permission before searching. The dropdown will still support autocomplete of users currently participating in the discussion.
This commit is contained in:
parent
ac427a8a4a
commit
a2832af01f
|
@ -224,7 +224,7 @@ export default function addComposerAutocomplete() {
|
|||
|
||||
// Don't send API calls searching for users until at least 2 characters have been typed.
|
||||
// This focuses the mention results on users and posts in the discussion.
|
||||
if (typed.length > 1) {
|
||||
if (typed.length > 1 && app.forum.attribute('canSearchUsers')) {
|
||||
throttledSearch(typed, searched, returnedUsers, returnedUserIds, dropdown, buildSuggestions);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user