summaryrefslogtreecommitdiffstats
path: root/apps/files_external/js
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-08-22 16:07:48 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-08-25 11:50:19 +0200
commit6202ef3258c7db707f32c0bcaa17552b92fa15eb (patch)
treef3a8bbd93a5e13f2e3670304b333edd6ad5c86c1 /apps/files_external/js
parent91ba1b345eff63b79f7111385d1e06e36911a589 (diff)
downloadnextcloud-server-6202ef3258c7db707f32c0bcaa17552b92fa15eb.tar.gz
nextcloud-server-6202ef3258c7db707f32c0bcaa17552b92fa15eb.zip
use displayname lookup route in files_external settings
Diffstat (limited to 'apps/files_external/js')
-rw-r--r--apps/files_external/js/settings.js45
1 files changed, 14 insertions, 31 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index ebc95d64cfd..27ed0254dd3 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -233,41 +233,24 @@ $(document).ready(function() {
}
},
initSelection: function(element, callback) {
-
- var promises = [];
-
- var results = [];
-
- $(element.val().split(",")).each(function (i,userId) {
- var def = new $.Deferred();
- promises.push(def.promise());
-
- var pos = userId.indexOf('(group)');
- if (pos !== -1) {
- //add as group
- results.push({name:userId, displayname:userId.substr(0, pos), type:'group'});
- def.resolve();
- } else {
- $.ajax(OC.generateUrl('apps/files_external/applicable'), {
- data: {
- pattern: userId
- },
- dataType: "json"
- }).done(function(data) {
- if (data.status === "success") {
- if (data.users[userId]) {
- results.push({name:userId, displayname:data.users[userId], type:'user'});
- }
- def.resolve();
- } else {
- //FIXME add error handling
+ $.ajax(OC.generateUrl('displaynames'), {
+ data: {
+ users: element.val().split(",")
+ },
+ dataType: "json"
+ }).done(function(data) {
+ var results = [];
+ if (data.status === "success") {
+ $.each(data.users, function(user, displayname) {
+ if (displayname !== false) {
+ results.push({name:user, displayname:displayname, type:'user'});
}
});
+ callback(results);
+ } else {
+ //FIXME add error handling
}
});
- $.when.apply(undefined, promises).then(function(){
- callback(results);
- });
},
id: function(element) {
return element.name;