From 98dc469772fb7f6762aeb2351213cd515c070b76 Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Sun, 9 Jun 2024 22:29:04 +0200 Subject: [PATCH 1/3] fix: pass `` to email --- app/Mail/Digest.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/Mail/Digest.php b/app/Mail/Digest.php index 9d04259..4379ee4 100644 --- a/app/Mail/Digest.php +++ b/app/Mail/Digest.php @@ -24,17 +24,24 @@ class Digest extends Mailable /** * The current trip locations as a JSON object. * - * @var string + * @var obj */ public $locations; /** * The current trip checkins as a JSON object. * - * @var string + * @var obj */ public $checkinsList; + /** + * The current trip object. + * + * @var obj + */ + public $trip; + /** * Create a new message instance. * @@ -45,7 +52,7 @@ class Digest extends Mailable public function __construct(string $digest_type, string $trip_id) { $this->digest_type = $digest_type; - $trip = (new TrackerController)->get_trip_data($trip_id); + $this->trip = (new TrackerController)->get_trip_data($trip_id); $cutoffDateTime = new DateTime(); switch ($this->digest_type) { @@ -65,7 +72,7 @@ class Digest extends Mailable } $this->checkinsList = array_filter( - $trip->checkins, + $this->trip->checkins, function ($elem) use ($cutoffDateTime) { $elemDateTime = new DateTime($elem->created_at); return $elemDateTime > $cutoffDateTime; @@ -80,7 +87,11 @@ class Digest extends Mailable */ public function build() { - return $this->view('emails.digest') - ->subject("track.bengoldsworthy.net ".ucwords($this->digest_type)." Digest"); + return $this->view( + 'emails.digest', + [ + 'trip' => $this->trip + ] + )->subject("track.bengoldsworthy.net ".ucwords($this->digest_type)." Digest"); } } From 1d8fb6b40799d658b6fbb24d01fb33b4f94cea95 Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Sun, 9 Jun 2024 22:29:25 +0200 Subject: [PATCH 2/3] build: `prune -a` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9fcaf26..5184eda 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "deploy:public": "rsync --delete -rP public ovhvps:~/track", "deploy:dependencies": "rsync --delete -rP vendor ovhvps:~/track", "deploy:full": "npm run deploy && npm run deploy:public && npm run deploy:dependencies && npm run deploy:finish", - "deploy:finish": "ssh ovhvps 'cd track && docker compose down && docker system prune -f && docker compose up -d --build'", + "deploy:finish": "ssh ovhvps 'cd track && docker compose down && docker system prune -a -f && docker compose up -d --build'", "lint": "npm run lint:php; npm run lint:css", "lint:fix": "npm run lint:php:fix; npm run lint:css:fix", "lint:php": "./vendor/bin/phpcs", From 0d777d214ccb2c29727114fa39e53294fed3b4bc Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Sun, 9 Jun 2024 22:29:37 +0200 Subject: [PATCH 3/3] use `secure_url()` --- resources/views/partials/checkins-list.blade.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/views/partials/checkins-list.blade.php b/resources/views/partials/checkins-list.blade.php index 8d30cf6..eb9d24f 100644 --- a/resources/views/partials/checkins-list.blade.php +++ b/resources/views/partials/checkins-list.blade.php @@ -11,11 +11,11 @@ $path = "/" . $trip_slug . "/" .$hasEmbed . "/" . $filepath[1]; $embed = ''; if (isset($email)) { - $embed .= '

If your email client doesn\'t support video embeds, here is a link to the file instead.

'; + $embed .= '

If your email client doesn\'t support video embeds, here is a link to the file instead.

'; } } else { $embed = '

[The video \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]

'; @@ -28,11 +28,11 @@ $path = "/" . $trip_slug . "/" .$hasEmbed . "/" . $filepath[1]; $embed = ''; if (isset($email)) { - $embed .= '

If your email client doesn\' support audio embeds, here is a link to the file instead.

'; + $embed .= '

If your email client doesn\' support audio embeds, here is a link to the file instead.

'; } } else { $embed = '

[The recording \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]

';