1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 16:10:26 +00:00

Shared with me (#2393)

* update api of shared with me

return 'group_name' field if current library is a group owned library

* add api for delete shared in group owned repo

* [shared with me] modification for 'group owned repo'
This commit is contained in:
llj
2018-09-21 15:43:16 +08:00
committed by Daniel Pan
parent c51da1c832
commit 28cc3762b0
3 changed files with 24 additions and 5 deletions

View File

@@ -52,9 +52,21 @@ define([
}
};
var url,
repo_id = this.model.get('id'),
owner = this.model.get('owner');
if (owner.indexOf('@seafile_group') == -1) {
url = Common.getUrl({name: 'beshared_repo', repo_id: repo_id})
+ "?share_type=personal&from=" + encodeURIComponent(owner);
} else {
url = Common.getUrl({
name: 'group-owned-library-user-share-in-library',
repo_id: repo_id
});
}
$.ajax({
url: Common.getUrl({name: 'beshared_repo', repo_id: this.model.get('id')})
+ "?share_type=personal&from=" + encodeURIComponent(this.model.get('owner')),
url: url,
type: 'DELETE',
beforeSend: Common.prepareCSRFToken,
dataType: 'json',
@@ -69,9 +81,15 @@ define([
var icon_size = Common.isHiDPI() ? 48 : 24;
var icon_url = this.model.getIconUrl(icon_size);
var tmpl = $(window).width() >= 768 ? this.template : this.mobileTemplate;
var owner_name_shown = obj.owner_name;
if (obj.owner.indexOf('@seafile_group') != -1) {
owner_name_shown = obj.group_name;
}
_.extend(obj, {
'icon_url': icon_url,
'icon_title': this.model.getIconTitle()
'icon_title': this.model.getIconTitle(),
'owner_name_shown': owner_name_shown
});
this.$el.html(tmpl(obj));
return this;