From 54f872d2a301549a7ada80dbe573689f3f59a35b Mon Sep 17 00:00:00 2001 From: Tom McKay Date: Thu, 18 Feb 2016 07:34:30 -0500 Subject: [PATCH] fixes #12894 - remove 'users' from org update params Updated this PR to only send redhat_repository_url for update. + fixed push of global success message + removed unused var --- .../organizations/organization.factory.js | 2 +- .../manifest/manifest-import.controller.js | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js index c087156a4e7..a821af93b15 100644 --- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js +++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js @@ -14,7 +14,7 @@ angular.module('Bastion.organizations').factory('Organization', return BastionResource('/katello/api/v2/organizations/:id/:action', {id: '@id'}, { - update: { method: 'PUT'}, + update: { method: 'PUT' }, select: { method: 'GET', url: '/organizations/:label/select' diff --git a/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js b/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js index 729f15660f3..1e53e4b8354 100644 --- a/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js +++ b/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js @@ -147,19 +147,29 @@ angular.module('Bastion.subscriptions').controller('ManifestImportController', }; $scope.saveCdnUrl = function (organization) { - var deferred = $q.defer(); + var deferred; + + // @TODO hack needed to prevent upload of fields users, parent_name, and parent_id + // http://projects.theforeman.org/issues/12894 + var whitelistedOrganizationObject = {}, + whitelist = [ + "id", + "redhat_repository_url" + ]; + + angular.forEach(whitelist, function (key) { + whitelistedOrganizationObject[key] = organization[key]; + }); - organization.$update(function (response) { - deferred.resolve(response); - GlobalNotification.setSuccessMessage.push(translate('Repository URL updated')); + deferred = Organization.update(whitelistedOrganizationObject, function () { + GlobalNotification.setSuccessMessage(translate('Repository URL updated')); $scope.refreshTable(); $scope.refreshOrganizationInfo(); }, function (response) { - deferred.reject(response); GlobalNotification.setErrorMessage(translate("An error occurred saving the URL: ") + response.data.error.message); }); - return deferred.promise; + return deferred.$promise; }; $scope.uploadManifest = function (content) {