Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- improve Slack messages about request #367

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,29 @@ protected function buildDescription(): string
{
$title = $this->vacationRequest->name;
$requester = $this->vacationRequest->user->profile->full_name;
$from = $this->vacationRequest->from;
$to = $this->vacationRequest->to;

$date = $from->equalTo($to)
? "{$from->toDisplayString()}"
: "{$from->toDisplayString()} - {$to->toDisplayString()}";

$days = $this->vacationRequest->vacations()->count();

if ($this->vacationRequest->state->equals(WaitingForTechnical::class)) {
return __("The request :title from user :requester is waiting for your technical approval.", [
return __("The request :title is waiting for your technical approval.\nUser: :requester\nDate: :date (number of days: :days)", [
"title" => $title,
"requester" => $requester,
"date" => $date,
"days" => $days,
]);
}

return __("The request :title from user :requester is waiting for your administrative approval.", [
return __("The request :title is waiting for your administrative approval.\nUser: :requester\nDate: :date (number of days: :days)", [
"title" => $title,
"requester" => $requester,
"date" => $date,
"days" => $days,
]);
}
}
27 changes: 24 additions & 3 deletions app/Infrastructure/Slack/SlackActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,21 @@ protected function handleTechnicalApproval(User $user, VacationRequest $vacation

$acceptAsTechnical->execute($vacationRequest, $user);

$from = $vacationRequest->from;
$to = $vacationRequest->to;

$date = $from->equalTo($to)
? "{$from->toDisplayString()}"
: "{$from->toDisplayString()} - {$to->toDisplayString()}";

$days = $vacationRequest->vacations()->count();

return response()->json([
"text" => __("The request :title from user :requester has been approved by you as a technical approver.", [
"text" => __("The request :title has been approved by you as a technical approver.\nUser: :requester\nDate: :date (number of days: :days)", [
"title" => $vacationRequest->name,
"requester" => $vacationRequest->user->profile->full_name,
"technical" => $user->profile->full_name,
"date" => $date,
"days" => $days,
]),
]);
}
Expand All @@ -104,10 +114,21 @@ protected function handleAdministrativeApproval(User $user, VacationRequest $vac

$acceptAsAdministrative->execute($vacationRequest, $user);

$from = $vacationRequest->from;
$to = $vacationRequest->to;

$date = $from->equalTo($to)
? "{$from->toDisplayString()}"
: "{$from->toDisplayString()} - {$to->toDisplayString()}";

$days = $vacationRequest->vacations()->count();

return response()->json([
"text" => __("The request :title from user :requester has been approved by you as an administrative approver.", [
"text" => __("The request :title has been approved by you as an administrative approver.\nUser: :requester\nDate: :date (number of days: :days)", [
"title" => $vacationRequest->name,
"requester" => $vacationRequest->user->profile->full_name,
"date" => $date,
"days" => $days,
]),
]);
}
Expand Down
6 changes: 4 additions & 2 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@
"Click here for details": "Kliknij, aby zobaczyć szczegóły",
"Request :title is waiting for your technical approval": "Wniosek :title czeka na akceptację techniczną",
"Request :title is waiting for your administrative approval": "Wniosek :title czeka na akceptację administracyjną",
"The request :title from user :requester is waiting for your technical approval.": "Wniosek :title użytkownika :requester czeka na Twoją akceptację techniczną.",
"The request :title from user :requester is waiting for your administrative approval.": "Wniosek :title użytkownika :requester czeka na Twoją akceptację administracyjną.",
"The request :title is waiting for your technical approval.\nUser: :requester\nDate: :date (number of days: :days)": "Wniosek :title czeka na Twoją akceptację techniczną.\nPracownik: :requester\nData: :date (liczba dni: :days)",
"The request :title is waiting for your administrative approval.\nUser: :requester\nDate: :date (number of days: :days)": "Wniosek :title czeka na Twoją akceptację administracyjną.\nPracownik: :requester\nData: :date (liczba dni: :days)",
"The request :title has been approved by you as a technical approver.\nUser: :requester\nDate: :date (number of days: :days)": "Wniosek :title został zaakceptowany przez Ciebie jako przełożonego technicznego.\nPracownik: :requester\nData: :date (liczba dni: :days)",
"The request :title has been approved by you as an administrative approver.\nUser: :requester\nDate: :date (number of days: :days)": "Wniosek :title został zaakceptowany przez Ciebie jako przełożonego administracyjnego.\nPracownik: :requester\nData: :date (liczba dni: :days)",
"Request :title has been :status": "Wniosek :title został :status",
"Request :title in :application": "Wniosek :title w aplikacji :application",
"The request :title from user :requester has been :status.": "Wniosek :title użytkownika :requester został :status.",
Expand Down
Loading