diff options
author | Nick Thomas <nick@gitlab.com> | 2017-08-22 18:10:49 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-08-24 13:32:50 +0300 |
commit | 061472864ceaa4dc837eebcaa583f7b81d4e7e54 (patch) | |
tree | e760782a7247ca457edafe13de309e67364354ea /app/assets/javascripts/api.js | |
parent | 502d6464b07154d74eecbeddbf2cd6dba841380f (diff) |
Fix group and project search for anonymous users
Diffstat (limited to 'app/assets/javascripts/api.js')
-rw-r--r-- | app/assets/javascripts/api.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 56f91e95bb9..3d0ba65fd36 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -55,13 +55,18 @@ const Api = { // Return projects list. Filtered by query projects(query, options, callback) { const url = Api.buildUrl(Api.projectsPath); + const defaults = { + search: query, + per_page: 20, + }; + + if (gon.current_user_id) { + defaults.membership = true; + } + return $.ajax({ url, - data: Object.assign({ - search: query, - per_page: 20, - membership: true, - }, options), + data: Object.assign(defaults, options), dataType: 'json', }) .done(projects => callback(projects)); |