diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-08-25 15:25:37 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-08-25 15:25:37 +0300 |
commit | c842e29aada60419c0a978ed4cd931ed590d5292 (patch) | |
tree | f0678d8e594f4915827e492e51ec42b342929f59 /app/assets/javascripts/api.js | |
parent | 62ef68c453aa238941598bd36aa68ad7f6fe1c0e (diff) | |
parent | 2adff699cea2cf1e60180d7eae73dfe5e8a09235 (diff) |
Merge branch '31409-fix-group-and-project-search-for-anonymous-users' into 'master'
Fix group and project search for anonymous users
Closes #31409
See merge request !13745
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 4319bfcc57f..78cb3def879 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)); |