Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jkmarx/hot fix owner name r 1.6.2 #2510

Merged
merged 5 commits into from
Jan 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion refinery/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,11 @@ def transform_res_list(self, user, res_list, request, **kwargs):
for res in res_list:
is_owner = res.id in owned_res_set
setattr(res, 'is_owner', is_owner)
owner = res.get_owner()
setattr(
res,
'owner',
user_uuid if is_owner else None
owner.profile.uuid if owner is not None else owner
)
setattr(
res,
Expand Down Expand Up @@ -333,6 +334,7 @@ def res_sharing(self, request, **kwargs):

perm_obj = {
'owner': mod_res[0].owner,
'is_owner': mod_res[0].is_owner,
'share_list': mod_res[0].share_list,
'user_perms': user_perms
}
Expand Down
7 changes: 4 additions & 3 deletions refinery/ui/source/js/data-set-about/ctrls/sharing-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function AboutSharingCtrl (
var vm = this;
vm.dataSetSharing = dataSetPermsService.dataSetSharing;
vm.groupList = dataSetPermsService.groupList;
vm.ownerName = '';
vm.ownerName = dataSetPermsService.ownerName;

vm.refreshDataSetSharing = function () {
var dataSetUuid = $window.dataSetUuid;
Expand All @@ -31,10 +31,11 @@ function AboutSharingCtrl (
vm.refreshOwnerName = function (userUuid) {
userService.get(userUuid).then(function (response) {
if (_.has(response, 'fullName') && response.fullName) {
vm.ownerName = response.fullName;
dataSetPermsService.ownerName = response.fullName;
} else if (_.has(response, 'userName') && response.userName) {
vm.ownerName = response.userName;
dataSetPermsService.ownerName = response.userName;
}
vm.ownerName = dataSetPermsService.ownerName;
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
vm.dataSetSharing = {};
vm.groupList = [];
vm.owner = '';
vm.ownerName = '';
vm.getDataSetSharing = getDataSetSharing;
vm.userPerms = 'none';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
expect(factory.dataSetSharing).toEqual({});
expect(factory.groupList).toEqual([]);
expect(factory.owner).toEqual('');
expect(factory.ownerName).toEqual('');
});

describe('refreshDataSetPerms', function () {
Expand Down