diff --git a/lib/mail/GroupsToDisplay.php b/lib/mail/GroupsToDisplay.php index 4db801251..db62e4117 100644 --- a/lib/mail/GroupsToDisplay.php +++ b/lib/mail/GroupsToDisplay.php @@ -55,7 +55,11 @@ public function __construct($groups_to_display=null) */ public function setGroupsToDisplay($groups_to_display) { - $this->groups_to_display[] = $groups_to_display; + if (is_array($groups_to_display)) { + $this->groups_to_display = $groups_to_display; + } else { + $this->groups_to_display[] = $groups_to_display; + } } /** @@ -77,4 +81,4 @@ public function jsonSerialize() { return $this->getGroupsToDisplay(); } -} \ No newline at end of file +} diff --git a/test/unit/KitchenSinkTest.php b/test/unit/KitchenSinkTest.php index 8be7a2b0e..f0b155d90 100644 --- a/test/unit/KitchenSinkTest.php +++ b/test/unit/KitchenSinkTest.php @@ -28,12 +28,10 @@ class KitchenSinkTest extends BaseTestClass "asm": { "group_id": 1, "groups_to_display": [ - [ - 1, - 2, - 3, - 4 - ] + 1, + 2, + 3, + 4 ] }, "attachments": [ @@ -623,4 +621,4 @@ public function testKitchenSinkExampleWithObjects() $isEqual = BaseTestClass::compareJSONObjects($json, $this->REQUEST_OBJECT); $this->assertTrue($isEqual); } -} \ No newline at end of file +}