Skip to content

Commit

Permalink
fix: fix telegram formatting message (monicahq/chandler#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaiss authored Jan 13, 2023
1 parent bf4a138 commit f65a521
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@ public function handle()
$userNotificationChannel = UserNotificationChannel::findOrFail($scheduledReminder->user_notification_channel_id);

$contactReminder = ContactReminder::find($scheduledReminder->contact_reminder_id);
$contact = $contactReminder->contact;
$contactName = NameHelper::formatContactName($userNotificationChannel->user, $contact);

if ($userNotificationChannel->type === UserNotificationChannel::TYPE_EMAIL) {
$contact = $contactReminder->contact;
$contactName = NameHelper::formatContactName($userNotificationChannel->user, $contact);

Notification::route('mail', $userNotificationChannel->content)
->notify(new ReminderTriggered($userNotificationChannel, $contactReminder->label, $contactName));
}

if ($userNotificationChannel->type === UserNotificationChannel::TYPE_TELEGRAM) {
Notification::route('telegram', $userNotificationChannel->content)
->notify(new ReminderTriggered($userNotificationChannel, $contactReminder->label, ''));
->notify(new ReminderTriggered($userNotificationChannel, $contactReminder->label, $contactName));
}

$this->updateScheduledContactReminderTriggeredAt($scheduledReminder);
Expand Down
6 changes: 3 additions & 3 deletions app/Notifications/ReminderTriggered.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public function toTelegram($notifiable)
]);

// content contains the label of the ContactReminder object
$content = '🔔 Reminder:'.'\n'.
$this->content.'\n'.
trans('email.reminder_triggered_for').'\n'.
$content = '🔔 Reminder: '.
$this->content.' '.
trans('email.reminder_triggered_for').' '.
$this->contactName;

return TelegramMessage::create()
Expand Down

0 comments on commit f65a521

Please sign in to comment.