From c7048e8cb1568ce35e76fc1882b82f93b53a568a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 22 Feb 2021 20:54:46 +1100 Subject: [PATCH] Fixes for user present name --- app/Jobs/Mail/NinjaMailerJob.php | 4 ++-- app/Models/User.php | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index a040556d38..a33eb48ca8 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -142,7 +142,7 @@ class NinjaMailerJob implements ShouldQueue $user = User::find($this->decodePrimaryKey($sending_user)); - nlog("Sending via {$user->present()->name()}"); + nlog("Sending via {$user->name()}"); $google = (new Google())->init(); $google->getClient()->setAccessToken(json_encode($user->oauth_user_token)); @@ -164,7 +164,7 @@ class NinjaMailerJob implements ShouldQueue $this->nmo ->mailable - ->from($user->email, $user->present()->name()) + ->from($user->email, $user->name()) ->withSwiftMessage(function ($message) use($token) { $message->getHeaders()->addTextHeader('GmailToken', $token); }); diff --git a/app/Models/User.php b/app/Models/User.php index f5e94281a5..36c7aec6ac 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -103,6 +103,12 @@ class User extends Authenticatable implements MustVerifyEmail 'deleted_at' => 'timestamp', ]; + + public function name() + { + return $this->first_name . ' ' . $this->last_name; + } + public function getEntityType() { return self::class;