Skip to content

Commit

Permalink
feat: enhance notification content (#65)
Browse files Browse the repository at this point in the history
* Show the staging system in the operation ping

* Display the full operation details when pinging the operation
  • Loading branch information
alkari-verende authored Jan 11, 2022
1 parent 710ad53 commit 127f04b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static function BuildSlackNotificationAttachment($op) {
setting('kassie.calendar.slack_emoji_importance_empty', true));

$fields[trans('calendar::seat.fleet_commander')] = $op->fc ? $op->fc : trans('calendar::seat.unknown');
$fields[trans('calendar::seat.staging_system')] = $op->staging_sys ? $op->staging_sys : trans('calendar::seat.unknown');

return function ($attachment) use ($op, $url, $fields) {
$attachment->title($op->title, $url)
Expand Down
6 changes: 4 additions & 2 deletions src/Notifications/OperationPinged.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\SlackMessage;
use Seat\Kassie\Calendar\Helpers\Helper;

/**
* Class OperationPinged.
Expand All @@ -30,11 +31,12 @@ public function via($notifiable)
*/
public function toSlack($notifiable)
{
$content = trans('calendar::seat.notification_ping_operation') . '*' . trans('calendar::seat.starts_in') . ' ' . $notifiable->starts_in . '* : <' . url('/calendar/operation') . '|' . $notifiable->title . '>';
$attachment = Helper::BuildSlackNotificationAttachment($notifiable);

return (new SlackMessage)
->success()
->from('SeAT Calendar', ':calendar:')
->content($content);
->content(trans('calendar::seat.notification_ping_operation') . '*' . trans('calendar::seat.starts_in') . ' ' . $notifiable->starts_in . '*')
->attachment($attachment);
}
}
1 change: 1 addition & 0 deletions src/resources/lang/en/seat.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
'staging_sys' => 'Staging system',
'staging_info' => 'Staging info',
'fleet_commander' => 'Fleet Commander',
'staging_system' => 'Staging System',
'character' => 'Character',

'notification_new_operation' => '<!channel> :rocket: A new operation has been posted !',
Expand Down

0 comments on commit 127f04b

Please sign in to comment.