Skip to content

Commit

Permalink
Updated patches
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jun 13, 2023
1 parent 64fc6b2 commit 893cb63
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
27 changes: 1 addition & 26 deletions patches/drupal/maestro/edit-task-id-in-query.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,4 @@ index 8893251..2107961 100644
$template = MaestroEngine::getTemplate($templateMachineName);
$task = MaestroEngine::getTemplateTaskByID($templateMachineName, $taskID);
$task['form_state'] = $form_state;
diff --git a/src/Engine/MaestroEngine.php b/src/Engine/MaestroEngine.php
index 288736a..2781c37 100644
--- a/src/Engine/MaestroEngine.php
+++ b/src/Engine/MaestroEngine.php
@@ -3,6 +3,7 @@
namespace Drupal\maestro\Engine;

// Used in the dynamic task call for task execution.
+use Drupal\Core\Session\AccountInterface;
use Drupal\maestro\Engine\Exception\MaestroGeneralException;
use Drupal\maestro\Engine\Exception\MaestroSaveEntityException;
use Drupal\Core\Entity\EntityStorageException;
@@ -638,6 +639,13 @@ class MaestroEngine {
$account = User::load($userID);
$userRoles = $account->getRoles(TRUE);

+ // An authenticated user does not actually have the role "authenticated",
+ // but we may be assigning tasks to authenticated users. Therefore we add
+ // the authenticated role to the list of roles to check for assignment.
+ if ($account->isAuthenticated()) {
+ $userRoles[] = AccountInterface::AUTHENTICATED_ROLE;
+ }
+
$query = \Drupal::entityQuery('maestro_production_assignments')
->accessCheck(FALSE);


31 changes: 31 additions & 0 deletions patches/drupal/maestro/time-dilation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/src/Engine/MaestroEngine.php b/src/Engine/MaestroEngine.php
index 2781c37..8037c52 100644
--- a/src/Engine/MaestroEngine.php
+++ b/src/Engine/MaestroEngine.php
@@ -1538,7 +1538,7 @@ class MaestroEngine {
$taskMachineName = $queueRecord->task_id->getString();
$templateMachineName = MaestroEngine::getTemplateIdFromProcessId($queueRecord->process_id->getString());
// Just days * seconds to get an offset.
- $reminderInterval = intval($queueRecord->reminder_interval->getString()) * 86400;
+ $reminderInterval = intval($queueRecord->reminder_interval->getString()) * 60;
// we're in here because we need a reminder. So do it.
$this->doProductionAssignmentNotifications($templateMachineName, $taskMachineName, $queueID, 'reminder');
$queueRecord->set('next_reminder_time', $currentTime + $reminderInterval);
@@ -1568,7 +1568,7 @@ class MaestroEngine {
$numberOfEscalationsSent = intval($queueRecord->num_escalations_sent->getString());
// First time through, numberOfEscalations is 0... second time it's 1 etc.
// that means that our interval needs to be numberOfEscalations +1 * the offset of the escalation in days.
- $escalationInterval = (1 + $numberOfEscalationsSent) * (intval($queueRecord->escalation_interval->getString()) * 86400);
+ $escalationInterval = (1 + $numberOfEscalationsSent) * (intval($queueRecord->escalation_interval->getString()) * 60);
if ($currentTime > ($createdTime + $escalationInterval)) {
// We need to send out an escalation.
$this->doProductionAssignmentNotifications($templateMachineName, $taskMachineName, $queueID, 'escalation');
@@ -1837,7 +1837,7 @@ class MaestroEngine {
if (array_key_exists('notifications', $nextTask)) {
$reminderInterval = $nextTask['notifications']['reminder_after'];
if (intval($reminderInterval) > 0) {
- $nextReminderTime = $currentTime + (intval($reminderInterval) * 86400);
+ $nextReminderTime = $currentTime + (intval($reminderInterval) * 60);
}
$escalationInterval = $nextTask['notifications']['escalation_after'];
}

0 comments on commit 893cb63

Please sign in to comment.