Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ public function draftToReadyToPublish(ServiceModerationEvent $event) {
}

// Dispatch messages to group administration.
$user = reset($accounts);
if (!empty($user)) {
foreach ($accounts as $user) {
$this->dispatchMessage($entity, $user, 'group_ready_to_publish_notificat');
$this->messenger->addStatus($this->t('Notified @group administration', ['@group' => $group->label()]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ protected function getEntityGroupAdministration(ContentEntityInterface $entity,
if (empty($allowed['publish'])) {
continue;
}
$accounts[$account->getLastAccessedTime()] = $account;
$accounts[] = $account;
}

ksort($accounts);

return $accounts;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ class ServiceStateChangedNotificationSubscriberTest extends GroupKernelTestBase
*/
private $orgUser2;

/**
* Organisation user instance.
*
* @var \Drupal\Core\Entity\EntityInterface|\Drupal\user\Entity\User
*/
private $orgUser3;

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -113,6 +120,9 @@ protected function setUp(): void {
$this->orgUser2 = $this->createUserWithRoles(['specialist editor', 'editor']);
$this->orgGroup->addMember($this->orgUser2, ['group_roles' => ['organisation-editor']]);

$this->orgUser3 = $this->createUserWithRoles(['specialist editor', 'editor']);
$this->orgGroup->addMember($this->orgUser3, ['group_roles' => ['organisation-administrator']]);

// Add service provider to organisation group as subgroup.
$this->orgGroup->addRelationship($this->spGroup, 'subgroup:service_provider');

Expand Down Expand Up @@ -209,6 +219,8 @@ public function testServiceReadyToPublishMunicipalityNotification() {
// has been sent to group administration.
$this->assertEquals('message_notify_group_ready_to_publish_notificat', $mails[0]['id']);
$this->assertEquals($this->orgUser->getEmail(), $mails[0]['to']);
$this->assertEquals('message_notify_group_ready_to_publish_notificat', $mails[1]['id']);
$this->assertEquals($this->orgUser3->getEmail(), $mails[1]['to']);
}

/**
Expand Down