1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 23:29:42 +02:00

Fix change folder owner action

This commit is contained in:
zinyando 2016-08-24 13:09:38 +02:00
parent ee977c977a
commit abac9347e1
3 changed files with 17 additions and 18 deletions

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
// by contacting <sales@documize.com>.
//
// https://documize.com
@ -27,17 +27,16 @@ export default Ember.Controller.extend(NotifierMixin, {
actions: {
changeOwner: function (folderId, userId) {
let self = this;
this.get('folderService').getFolder(folderId).then(function (folder) {
this.get('folderService').getFolder(folderId).then((folder) => {
folder.set('userId', userId);
self.get('folderService').save(folder).then(function () {
self.showNotification("Changed");
self.audit.record('changed-folder-owner');
this.get('folderService').save(folder).then(() => {
this.showNotification("Changed");
this.audit.record('changed-folder-owner');
});
self.send('onChangeOwner');
this.send('onChangeOwner');
});
}
}
});
});

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
// by contacting <sales@documize.com>.
//
// https://documize.com
@ -29,17 +29,17 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
let nonPrivateFolders = model.rejectBy('folderType', 2);
controller.set('folders', nonPrivateFolders);
this.get('folderService').getProtectedFolderInfo().then(function (people) {
people.forEach(function (person) {
person.isEveryone = person.userId === '';
person.isOwner = false;
this.get('folderService').getProtectedFolderInfo().then((people) => {
people.forEach((person) => {
person.set('isEveryone', person.get('userId') === '');
person.set('isOwner', false);
});
nonPrivateFolders.forEach(function (folder) {
let shared = people.filterBy('folderId', folder.get('id'));
let person = shared.findBy('userId', folder.get('userId'));
if (is.not.undefined(person)) {
person.isOwner = true;
person.set('isOwner', true);
}
folder.set('sharedWith', shared);
@ -56,4 +56,4 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
this.refresh();
}
}
});
});

View file

@ -98,7 +98,7 @@ export default BaseService.extend({
data = response.map((obj) => {
let data = this.get('store').normalize('protected-folder-participant', obj);
return this.get('store').push({ data: data });
return this.get('store').push(data);
});
return data;