Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUR-10388: CI Unit Test failing when we sync-pm-blocks #5267

Merged
merged 6 commits into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace ProcessMaker\ImportExport\Exporters;

use Illuminate\Support\Facades\Auth;
use ProcessMaker\Events\ScriptExecutorUpdated;
use ProcessMaker\Jobs\BuildScriptExecutor;
use ProcessMaker\Models\User;

class ScriptExecutorExporter extends ExporterBase
{
Expand All @@ -19,16 +21,19 @@ public function export() : void

public function import() : bool
{
$authenticatedUser = Auth::user();
$userId = $authenticatedUser ? $authenticatedUser->id : User::where('username', 'admin')->pluck('id');

switch ($this->mode) {
case 'copy':
case 'new':
BuildScriptExecutor::dispatch($this->model->id, auth()->user()->id);
BuildScriptExecutor::dispatch($this->model->id, $userId);
break;
case 'update':
if (!empty($this->model->getChanges())) {
$original = $this->model->getAttributes();
ScriptExecutorUpdated::dispatch($this->model->id, $original, $this->model->getChanges());
BuildScriptExecutor::dispatch($this->model->id, auth()->user()->id);
BuildScriptExecutor::dispatch($this->model->id, $userId);
}
break;

Expand Down