#132 - clean up notifications (#147)

* #132 - added translations

* wip

* #132 - added translations

* #132 - cs fix

* #132 - cs fix

Co-authored-by: Adrian Hopek <adrian.hopek@blumilk.pl>
This commit is contained in:
Ewelina Lasowy
2022-05-17 15:17:09 +02:00
committed by GitHub
parent 74f33d6c0b
commit 7154caa340
22 changed files with 92 additions and 46 deletions

View File

@@ -27,9 +27,10 @@ class VacationRequestCreatedNotification extends Notification
public function toSlack(): SlackMessage
{
$url = route("vacation.requests.show", ["vacationRequest" => $this->vacationRequest->id]);
$seeDetails = __("See details");
return (new SlackMessage())
->text("{$this->buildDescription()}\n <${url}|Zobacz szczegóły>");
->text("{$this->buildDescription()}\n <${url}|${seeDetails}>");
}
/**
@@ -97,8 +98,8 @@ class VacationRequestCreatedNotification extends Notification
$name = $this->vacationRequest->name;
if ($this->vacationRequest->creator()->is($this->vacationRequest->user)) {
return __("The vacation request :title from user :user has been created successfully.", [
"user" => $this->vacationRequest->user->profile->full_name,
return __("The vacation request :title has been created successfully.", [
"requester" => $this->vacationRequest->user->profile->full_name,
"title" => $name,
]);
}

View File

@@ -29,9 +29,10 @@ class VacationRequestStatusChangedNotification extends Notification
public function toSlack(): SlackMessage
{
$url = route("vacation.requests.show", ["vacationRequest" => $this->vacationRequest->id]);
$seeDetails = __("See details");
return (new SlackMessage())
->text("{$this->buildDescription()}\n <${url}|Zobacz szczegóły>");
->text("{$this->buildDescription()}\n <${url}|${seeDetails}>");
}
/**

View File

@@ -30,9 +30,10 @@ class VacationRequestWaitsForApprovalNotification extends Notification
public function toSlack(): SlackMessage
{
$url = route("vacation.requests.show", ["vacationRequest" => $this->vacationRequest->id]);
$seeDetails = __("See details");
return (new SlackMessage())
->text("{$this->buildDescription()}\n <${url}|Zobacz szczegóły>");
->text("{$this->buildDescription()}\n <${url}|${seeDetails}>");
}
/**

View File

@@ -29,7 +29,7 @@ class VacationRequestsSummaryNotification extends Notification
public function toSlack(): SlackMessage
{
return (new SlackMessage())
->text("Wnioski oczekujące na Twoją akcję - stan na dzień {$this->day->toDisplayString()}:")
->text(__("Requests wait for your approval - status for day :date:", ["date" => $this->day->toDisplayString()]))
->withAttachment(new VacationRequestsAttachment($this->vacationRequests));
}
@@ -55,16 +55,18 @@ class VacationRequestsSummaryNotification extends Notification
"user" => $user,
]),
)
->line("Lista wniosków oczekujących na Twoją akcję - stan na dzień {$this->day->toDisplayString()}:")
->subject("Wnioski oczekujące na akcje - stan na dzień {$this->day->toDisplayString()}");
->line (__("Requests list waits for your approval - status for day :date:", ["date" => $this->day->toDisplayString()]))
->subject(__("Requests wait for your approval - status for day :date:", ["date" => $this->day->toDisplayString()]));
foreach ($this->vacationRequests as $request) {
$url = route("vacation.requests.show", ["vacationRequest" => $request->id]);
$message->line(
"Wniosek nr {$request->name} użytkownika {$request->user->profile->full_name} ({$request->from->toDisplayString()} - {$request->to->toDisplayString()})",
__("- [request no. :request](:url) of user :user (:startDate - :endDate)", ["request" => $request->name, "url" => $url, "user" => $request->user->profile->full_name, "startDate" => $request->from->toDisplayString(), "endDate" => $request->to->toDisplayString()]),
);
}
return $message
->action("Przejdź do wniosków", $url);
->action(__("Go to requests"), $url);
}
}