From 29c966810ef18e368e0b0778c80e5d8fa793f72a Mon Sep 17 00:00:00 2001 From: noud Date: Mon, 5 Nov 2012 10:24:50 +0100 Subject: [PATCH] distribution let pull behave same way as a push in regard to distribution. --- app/Controller/ServersController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index b11c067f0..3d2b0e645 100644 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -190,16 +190,20 @@ class ServersController extends AppController { $event['Event']['distribution'] = 'Community'; } if (is_array($event['Event']['Attribute'])) { - foreach ($event['Event']['Attribute'] as &$attribute) { - // Distribution, correct Community to Org only in Attribute - if ($attribute['distribution'] == 'Community') { + foreach ($event['Event']['Attribute'] as $key => &$attribute) { + switch($attribute['distribution']) { + case 'Org': + unset($event['Event']['Attribute'][$key]); + break; + case 'Community': $attribute['distribution'] = 'Org'; - } - // Distribution, correct All to Community in Attribute - if ($attribute['distribution'] == 'All') { + break; + case 'All': $attribute['distribution'] = 'Community'; + break; } } + $event['Event']['Attribute'] = array_values($event['Event']['Attribute']); } // Distribution, set reporter of the event, being the admin that initiated the pull $event['Event']['user_id'] = $this->Auth->user('id');