Skip to content
Snippets Groups Projects
Commit aa3e80d6 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Merge remote-tracking branch 'public/master' into ISAICP-9114

parents 98139a18 fe34a078
No related branches found
No related tags found
1 merge request!194Release v2.0.0
...@@ -16,7 +16,8 @@ upgrade_commands: ...@@ -16,7 +16,8 @@ upgrade_commands:
- vendor/bin/drush joinup:node-access-rebuild - vendor/bin/drush joinup:node-access-rebuild
- vendor/bin/drush joinup:search-api-tasks - vendor/bin/drush joinup:search-api-tasks
- vendor/bin/drush joinup:unpublish-alert --category - vendor/bin/drush joinup:unpublish-alert --category
- scripts/check_status_report.php # TODO: Re-enable in ISAICP-9191.
# - scripts/check_status_report.php
append: append:
acceptance: acceptance:
- vendor/bin/drush joinup:acc - vendor/bin/drush joinup:acc
......
...@@ -10,10 +10,12 @@ Feature: Subscribing to community content in collections ...@@ -10,10 +10,12 @@ Feature: Subscribing to community content in collections
| Products of Bulgaria | published | | Products of Bulgaria | published |
| Cities of Bulgaria | published | | Cities of Bulgaria | published |
And users: And users:
| Username | E-mail | First name | Family name | Notification frequency | | Username | E-mail | First name | Family name | Notification frequency | Status |
| hristo | hristo@example.bg | Hristo | Draganov | daily | | hristo | hristo@example.bg | Hristo | Draganov | daily | active |
| bisera | bisera@example.bg | Bisera | Kaloyancheva | weekly | | bisera | bisera@example.bg | Bisera | Kaloyancheva | weekly | active |
| kalin | kalin@primer.bg | Kalin | Antov | monthly | | kalin | kalin@primer.bg | Kalin | Antov | monthly | active |
| aleks | aleks@primer.bg | Aleksandar | Begov | monthly | blocked |
| penka | penka@primer.bg | Penka | Ramil | monthly | cancelled |
And the following collection user memberships: And the following collection user memberships:
| collection | user | roles | | collection | user | roles |
| Products of Bulgaria | hristo | | | Products of Bulgaria | hristo | |
...@@ -22,6 +24,8 @@ Feature: Subscribing to community content in collections ...@@ -22,6 +24,8 @@ Feature: Subscribing to community content in collections
| Cities of Bulgaria | hristo | | | Cities of Bulgaria | hristo | |
| Cities of Bulgaria | bisera | | | Cities of Bulgaria | bisera | |
| Cities of Bulgaria | kalin | facilitator | | Cities of Bulgaria | kalin | facilitator |
| Cities of Bulgaria | aleks | |
| Cities of Bulgaria | penka | |
And the following collection content subscriptions: And the following collection content subscriptions:
| collection | user | subscriptions | | collection | user | subscriptions |
| Products of Bulgaria | hristo | discussion, event, news, solution | | Products of Bulgaria | hristo | discussion, event, news, solution |
...@@ -30,10 +34,15 @@ Feature: Subscribing to community content in collections ...@@ -30,10 +34,15 @@ Feature: Subscribing to community content in collections
| Cities of Bulgaria | hristo | document, event, solution | | Cities of Bulgaria | hristo | document, event, solution |
| Cities of Bulgaria | bisera | discussion, event, news | | Cities of Bulgaria | bisera | discussion, event, news |
| Cities of Bulgaria | kalin | discussion, document, news, solution | | Cities of Bulgaria | kalin | discussion, document, news, solution |
| Cities of Bulgaria | aleks | discussion, document, news |
| Cities of Bulgaria | penka | discussion, document, news |
And all message digests have been delivered And all message digests have been delivered
Scenario: Receive a digest of content that is published in my collections Scenario: Receive a digest of content that is published in my collections
Given discussion content: # Start on clean.
Given I mark all emails as read
And discussion content:
| title | body | collection | state | author | | title | body | collection | state | author |
| Duck liver | Rich buttery and delicate | Products of Bulgaria | published | hristo | | Duck liver | Rich buttery and delicate | Products of Bulgaria | published | hristo |
| Sofia | Grows without aging | Cities of Bulgaria | published | kalin | | Sofia | Grows without aging | Cities of Bulgaria | published | kalin |
...@@ -143,6 +152,9 @@ Feature: Subscribing to community content in collections ...@@ -143,6 +152,9 @@ Feature: Subscribing to community content in collections
| Sunflower seeds | | Sunflower seeds |
And the content subscription digest sent to kalin should have the subject "Joinup: Monthly digest message" And the content subscription digest sent to kalin should have the subject "Joinup: Monthly digest message"
# No message for aleks@primer.bg (blocked) and penka@primer.bg (cancelled).
And 4 e-mails should have been sent to recipients "kalin@primer.bg, hristo@example.bg, bisera@example.bg"
# Clean out the message queue for the next test. # Clean out the message queue for the next test.
And I mark all emails as read And I mark all emails as read
......
...@@ -13,10 +13,13 @@ Feature: Subscribing to community content in solutions ...@@ -13,10 +13,13 @@ Feature: Subscribing to community content in solutions
| Products of Bulgaria | published | Bulgaria | | Products of Bulgaria | published | Bulgaria |
| Cities of Bulgaria | published | Bulgaria | | Cities of Bulgaria | published | Bulgaria |
And users: And users:
| Username | E-mail | First name | Family name | Notification frequency | | Username | E-mail | First name | Family name | Notification frequency | Status |
| hristo | hristo@example.bg | Hristo | Draganov | daily | | hristo | hristo@example.bg | Hristo | Draganov | daily | active |
| bisera | bisera@example.bg | Bisera | Kaloyancheva | weekly | | bisera | bisera@example.bg | Bisera | Kaloyancheva | weekly | active |
| kalin | kalin@primer.bg | Kalin | Antov | monthly | | kalin | kalin@primer.bg | Kalin | Antov | monthly | active |
| aleks | aleks@primer.bg | Aleksandar | Begov | monthly | blocked |
| penka | penka@primer.bg | Penka | Ramil | monthly | cancelled |
And the following solution user memberships: And the following solution user memberships:
| solution | user | roles | | solution | user | roles |
| Products of Bulgaria | hristo | | | Products of Bulgaria | hristo | |
...@@ -25,6 +28,8 @@ Feature: Subscribing to community content in solutions ...@@ -25,6 +28,8 @@ Feature: Subscribing to community content in solutions
| Cities of Bulgaria | hristo | | | Cities of Bulgaria | hristo | |
| Cities of Bulgaria | bisera | | | Cities of Bulgaria | bisera | |
| Cities of Bulgaria | kalin | facilitator | | Cities of Bulgaria | kalin | facilitator |
| Cities of Bulgaria | aleks | |
| Cities of Bulgaria | penka | |
And the following solution content subscriptions: And the following solution content subscriptions:
| solution | user | subscriptions | | solution | user | subscriptions |
| Products of Bulgaria | hristo | discussion, event, news, distribution | | Products of Bulgaria | hristo | discussion, event, news, distribution |
...@@ -33,10 +38,15 @@ Feature: Subscribing to community content in solutions ...@@ -33,10 +38,15 @@ Feature: Subscribing to community content in solutions
| Cities of Bulgaria | hristo | document, event | | Cities of Bulgaria | hristo | document, event |
| Cities of Bulgaria | bisera | discussion, event, news | | Cities of Bulgaria | bisera | discussion, event, news |
| Cities of Bulgaria | kalin | discussion, document, news | | Cities of Bulgaria | kalin | discussion, document, news |
| Cities of Bulgaria | aleks | discussion, document, news |
| Cities of Bulgaria | penka | discussion, document, news |
And all message digests have been delivered And all message digests have been delivered
Scenario: Receive a digest of content that is published in my solutions Scenario: Receive a digest of content that is published in my solutions
Given discussion content: # Start on clean.
Given I mark all emails as read
And discussion content:
| title | body | solution | state | author | | title | body | solution | state | author |
| Duck liver | Rich buttery and delicate | Products of Bulgaria | published | hristo | | Duck liver | Rich buttery and delicate | Products of Bulgaria | published | hristo |
| Sofia | Grows without aging | Cities of Bulgaria | published | kalin | | Sofia | Grows without aging | Cities of Bulgaria | published | kalin |
...@@ -159,6 +169,9 @@ Feature: Subscribing to community content in solutions ...@@ -159,6 +169,9 @@ Feature: Subscribing to community content in solutions
| Sunflower seeds | | Sunflower seeds |
And the content subscription digest sent to kalin should have the subject "Joinup: Monthly digest message" And the content subscription digest sent to kalin should have the subject "Joinup: Monthly digest message"
# No message for aleks@primer.bg (blocked) and penka@primer.bg (cancelled).
And 4 e-mails should have been sent to recipients "kalin@primer.bg, hristo@example.bg, bisera@example.bg"
# Clean out the message queue for the next test. # Clean out the message queue for the next test.
And I mark all emails as read And I mark all emails as read
......
...@@ -4,9 +4,6 @@ Feature: Minimal install clone testing. ...@@ -4,9 +4,6 @@ Feature: Minimal install clone testing.
Scenario: Visit Joinup collection. Scenario: Visit Joinup collection.
Given I am an anonymous user Given I am an anonymous user
When I visit "/collection/portal"
Then I should see the link "Federation of solutions"
When I visit "/search?keys=joinup&f[0]=type:collection" When I visit "/search?keys=joinup&f[0]=type:collection"
Then I should see the "The Portal" tile Then I should see the "The Portal" tile
And I should see "The European Commission provides this common place" And I should see "The European Commission provides this common place"
...@@ -20,5 +17,5 @@ Feature: Minimal install clone testing. ...@@ -20,5 +17,5 @@ Feature: Minimal install clone testing.
When I visit "/interoperable_solutions" When I visit "/interoperable_solutions"
Then I should see the link "Solutions" Then I should see the link "Solutions"
And "Solutions" should be the active item in the "Navigation bar" region And "Solutions" should be the active item in the "Navigation bar" region
Then I visit "/collection/joinup" Then I visit "/collection/portal"
And no menu items should be active in the "Navigation bar" region And no menu items should be active in the "Navigation bar" region
...@@ -364,17 +364,32 @@ public function clearMailCollectorCache(): void { ...@@ -364,17 +364,32 @@ public function clearMailCollectorCache(): void {
* *
* @param int $count * @param int $count
* The expected count of e-mails sent. * The expected count of e-mails sent.
* @param string|null $recipients
* (optional) A list of recipient emails.
* *
* @throws \Exception * @throws \Exception
* Thrown when the count doesn't match the actual number. * Thrown when the count doesn't match the actual number.
* *
* @Then :count e-mail(s) should have been sent * @Then :count e-mail(s) should have been sent
* @Then :count e-mail(s) should have been sent to recipients :recipients
*/ */
public function assertNumberOfEmailSent($count): void { public function assertNumberOfEmailSent(int $count, ?string $recipients = NULL): void {
$mails = $this->getMails(); $mails = $this->getMails();
if (count($mails) != $count) { if (count($mails) != $count) {
throw new \Exception("Invalid number of e-mail sent. Expected $count, sent " . count($mails)); throw new \Exception("Invalid number of e-mail sent. Expected $count, sent " . count($mails));
} }
if ($recipients) {
$expected_recipients = $this->explodeCommaSeparatedStepArgument($recipients);
$actual_recipients = array_unique(array_map(
fn(array $mail): string => $mail['to'],
$mails,
));
sort($expected_recipients);
sort($actual_recipients);
if ($expected_recipients !== $actual_recipients) {
throw new ExpectationFailedException("Expected recipients $recipients. Got " . implode(', ', $actual_recipients));
}
}
} }
/** /**
......
...@@ -156,6 +156,7 @@ public static function massageFieldsBeforeUserCreate(BeforeUserCreateScope $scop ...@@ -156,6 +156,7 @@ public static function massageFieldsBeforeUserCreate(BeforeUserCreateScope $scop
self::convertObjectPropertyValues($user, 'status', [ self::convertObjectPropertyValues($user, 'status', [
'blocked' => 0, 'blocked' => 0,
'active' => 1, 'active' => 1,
'cancelled' => -1,
]); ]);
} }
......
...@@ -75,6 +75,12 @@ function joinup_subscription_entity_bundle_info_alter(&$bundles): void { ...@@ -75,6 +75,12 @@ function joinup_subscription_entity_bundle_info_alter(&$bundles): void {
* community content items within each group are sorted alphabetically. * community content items within each group are sorted alphabetically.
*/ */
function joinup_subscription_message_digest_aggregate_alter(array &$context, UserInterface $account, MessageNotifierInterface $notifier): void { function joinup_subscription_message_digest_aggregate_alter(array &$context, UserInterface $account, MessageNotifierInterface $notifier): void {
if (!$account->isActive()) {
// Prevent delivery when the user is blocked or cancelled.
$context['deliver'] = FALSE;
return;
}
// Only act on the group community content digest. Bail out if this contains // Only act on the group community content digest. Bail out if this contains
// any other message. // any other message.
if (!array_reduce($context['messages'], function (bool $carry, MessageInterface $message): bool { if (!array_reduce($context['messages'], function (bool $carry, MessageInterface $message): bool {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment