1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 15:38:15 +00:00

[share] share to group: modified group list

This commit is contained in:
llj
2018-08-10 17:32:09 +08:00
parent d7510c0773
commit 76183310e0

View File

@@ -677,42 +677,11 @@ define([
return item_data; return item_data;
}, },
// for common repo
prepareAvailableGroups: function(options) { prepareAvailableGroups: function(options) {
var groups = []; var groups = [];
$.ajax({ $.ajax({
url: Common.getUrl({ url: Common.getUrl({
name: app.pageOptions.enable_share_to_all_groups ? 'shareable_groups' : 'groups' name: 'shareable_groups'
}),
type: 'GET',
dataType: 'json',
cache: false,
success: function(data){
for (var i = 0, len = data.length; i < len; i++) {
groups.push({
'id': data[i].id,
'name': data[i].name
});
}
groups.sort(function(a, b) {
return Common.compareTwoWord(a.name, b.name);
});
},
error: function(xhr, textStatus, errorThrown) {
// do nothing
},
complete: function() {
options.callback(groups);
}
});
},
// for group owned repo
prepareAvailableGroupsForGroupOwnedRepo: function(options) {
var groups = [];
$.ajax({
url: Common.getUrl({
name: 'all_groups'
}), }),
type: 'GET', type: 'GET',
dataType: 'json', dataType: 'json',
@@ -796,11 +765,7 @@ define([
}); });
$table.removeClass('hide'); $table.removeClass('hide');
}; };
if (_this.is_group_owned_repo) { _this.prepareAvailableGroups({'callback': prepareGroupsSelector});
_this.prepareAvailableGroupsForGroupOwnedRepo({'callback': prepareGroupsSelector});
} else {
_this.prepareAvailableGroups({'callback': prepareGroupsSelector});
}
}, },
error: function(xhr, textStatus, errorThrown) { error: function(xhr, textStatus, errorThrown) {
var err_msg = Common.prepareAjaxErrorMsg(xhr); var err_msg = Common.prepareAjaxErrorMsg(xhr);