Skip to content

Commit

Permalink
Merge pull request #932 from NFDI4Chem/issue-#764
Browse files Browse the repository at this point in the history
fix: archival mail issue
  • Loading branch information
CS76 authored Nov 29, 2023
2 parents d697dee + 8850dfb commit 8199b4a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=info@nmrxiv.org
MAIL_FROM_ADDRESS=info.nmrxiv@uni-jena.de
MAIL_FROM_NAME="${APP_NAME}"

FILESYSTEM_DRIVER=minio
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Project/ArchiveProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public function toggle($project)
$study->datasets()->update(['is_archived' => $archiveState]);
}
$project->is_archived = $archiveState;
$project->save();
if ($project->is_archived) {
$project->sendNotification('archival', $this->prepareSendList($project));
}
$project->save();
}

/**
Expand Down
10 changes: 9 additions & 1 deletion app/Jobs/ArchiveProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Illuminate\Support\Facades\Storage;
use ZipStream;

class ArchiveProject implements ShouldQueue, ShouldBeUnique
class ArchiveProject implements ShouldBeUnique, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

Expand All @@ -35,6 +35,14 @@ public function __construct(Project $project)
$this->project = $project;
}

/**
* Get the unique ID for the job.
*/
public function uniqueId(): string
{
return $this->project->id;
}

/**
* Execute the job.
*/
Expand Down
4 changes: 2 additions & 2 deletions app/Listeners/ProjectArchival.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct()
*/
public function handle(object $event): void
{
Notification::send($event->$sendTo, new ProjectArchivalNotification($event->project));
Notification::send(User::role(['super-admin'])->get(), new ProjectArchivalNotificationToAdmins($this));
Notification::send($event->sendTo, new ProjectArchivalNotification($event->project));
Notification::send(User::role(['super-admin'])->get(), new ProjectArchivalNotificationToAdmins($event->project));
}
}

0 comments on commit 8199b4a

Please sign in to comment.