#116 - integration with slack #129

Merged
Baakoma merged 19 commits from #116-integration-with-slack into main 2022-04-27 09:57:13 +02:00
28 changed files with 531 additions and 239 deletions
Showing only changes of commit 25816cc47a - Show all commits

View File

@@ -9,13 +9,13 @@ use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\ServiceProvider;
use Toby\Domain\Slack\Channels\SlackApiChannel;
use Toby\Domain\Slack\SlackApiChannel;
class AppServiceProvider extends ServiceProvider
{
public function register()
public function register(): void
{
Notification::resolved(function (ChannelManager $service) {
Notification::resolved(function (ChannelManager $service): void {
$service->extend("slack", fn(Application $app) => $app->make(SlackApiChannel::class));
});
}

View File

@@ -0,0 +1,45 @@
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
<?php
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
declare(strict_types=1);
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
namespace Toby\Domain;
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
use Illuminate\Support\Carbon;
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
use Illuminate\Support\Collection;
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
use Toby\Domain\Enums\VacationType;
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
use Toby\Eloquent\Models\User;
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
use Toby\Eloquent\Models\Vacation;
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
class DailySummaryRetriever
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
{
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
public function __construct(
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
protected VacationTypeConfigRetriever $configRetriever,
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
) {}
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
public function getAbsences(Carbon $date): Collection
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
{
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
return Vacation::query()
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->with(["user", "vacationRequest"])
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->whereDate("date", $date)
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->approved()
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => $this->configRetriever->isVacation($type)))
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->get();
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
}
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
public function getRemoteDays(Carbon $date): Collection
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
{
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
return Vacation::query()
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->with(["user", "vacationRequest"])
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->whereDate("date", $date)
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->approved()
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => !$this->configRetriever->isVacation($type)))
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->get();
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
}
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
public function getBirthdays(Carbon $date): Collection
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
{
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
return User::query()
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->whereRelation("profile", "birthday", $date)
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
->get();
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
}
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```
}
krzysztofrewak commented 2022-04-26 10:07:42 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => $this->configRetriever->isVacation($type))) ```
krzysztofrewak commented 2022-04-26 10:07:53 +02:00 (Migrated from github.com)
Review
            ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type)))
```suggestion ->whereTypes(VacationType::all()->filter(fn(VacationType $type): bool => !$this->configRetriever->isVacation($type))) ```

View File

@@ -0,0 +1,42 @@
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
<?php
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
declare(strict_types=1);
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
namespace Toby\Domain\Notifications;
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
use Illuminate\Bus\Queueable;
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
use Illuminate\Notifications\Notification;
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
use Toby\Eloquent\Models\User;
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
class KeyHasBeenGivenNotification extends Notification
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
{
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
use Queueable;
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
public function __construct(
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
protected User $sender,
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
protected User $recipient,
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
) {}
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
public function via(): array
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
{
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
return ["slack"];
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
}
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
public function toSlack($notifiable): string
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
{
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
return __(":sender gives key no :key to :recipient", [
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
"sender" => $this->getName($this->sender),
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
"recipient" => $this->getName($this->recipient),
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
"key" => $notifiable->id,
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
]);
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
}
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
protected function getName(User $user): string
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
{
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
if ($user->profile->slack_id !== null) {
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
return "<@{$user->profile->slack_id}>";
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
}
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
return $user->profile->full_name;
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
}
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?
}
krzysztofrewak commented 2022-04-26 10:08:38 +02:00 (Migrated from github.com)
Review

Maybe these "slack" and other channels could be gathered somewhere and used as constants or enums?

Maybe these `"slack"` and other channels could be gathered somewhere and used as constants or enums?

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Toby\Eloquent\Models\User;
class KeyHasBeenTakenNotification extends Notification
{
use Queueable;
public function __construct(
protected User $recipient,
protected User $sender,
) {}
public function via(): array
{
return ["slack"];
}
public function toSlack($notifiable): string
{
return __(":recipient takes key no :key from :sender", [
"recipient" => $this->getName($this->recipient),
"sender" => $this->getName($this->sender),
"key" => $notifiable->id,
]);
}
protected function getName(User $user): string
{
if ($user->profile->slack_id !== null) {
return "<@{$user->profile->slack_id}>";
}
return $user->profile->full_name;
}
}

View File

@@ -0,0 +1,55 @@
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
<?php
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
declare(strict_types=1);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
namespace Toby\Domain\Slack;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Exception;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Illuminate\Http\Request as IlluminateRequest;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Illuminate\Http\Response as IlluminateResponse;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Illuminate\Support\Collection;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Illuminate\Validation\ValidationException;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Spatie\SlashCommand\Attachment;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Spatie\SlashCommand\Controller as SlackController;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Spatie\SlashCommand\Exceptions\RequestCouldNotBeHandled;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Spatie\SlashCommand\Exceptions\SlackSlashCommandException;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
use Spatie\SlashCommand\Response;
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
class Controller extends SlackController
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
{
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
/**
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
* @throws RequestCouldNotBeHandled
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
*/
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
public function getResponse(IlluminateRequest $request): IlluminateResponse
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
{
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$this->guardAgainstInvalidRequest($request);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$handler = $this->determineHandler();
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
try {
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$response = $handler->handle($this->request);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
} catch (SlackSlashCommandException $exception) {
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$response = $exception->getResponse($this->request);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
} catch (ValidationException $exception) {
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$response = $this->prepareValidationResponse($exception);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
} catch (Exception $exception) {
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$response = $this->convertToResponse($exception);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
}
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
return $response->getIlluminateResponse();
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
}
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
protected function prepareValidationResponse(ValidationException $exception): Response
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
{
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
$errors = (new Collection($exception->errors()))
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
->map(
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
fn(array $message) => Attachment::create()
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
->setColor("danger")
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
->setText($message[0]),
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
);
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
return Response::create($this->request)
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
->withText(":x: Komenda `/{$this->request->command} {$this->request->text}` jest niepoprawna:")
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
->withAttachments($errors->all());
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
}
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>
}
krzysztofrewak commented 2022-04-26 10:11:59 +02:00 (Migrated from github.com)
Review

Please add return type here.

Please add return type here.
krzysztofrewak commented 2022-04-26 10:12:17 +02:00 (Migrated from github.com)
Review

@EwelinaLasowy , what do you think about word Komenda? :>

@EwelinaLasowy , what do you think about word Komenda? :>

View File

@@ -4,48 +4,32 @@ declare(strict_types=1);
namespace Toby\Domain\Slack\Handlers;
use Illuminate\Support\Collection;
use Spatie\SlashCommand\Attachment;
use Spatie\SlashCommand\AttachmentField;
use Spatie\SlashCommand\Handlers\CatchAll as BaseCatchAllHandler;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Spatie\SlashCommand\Handlers\BaseHandler;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Toby\Domain\Slack\Traits\ListsHandlers;
class CatchAll extends BaseCatchAllHandler
class CatchAll extends BaseHandler
{
use ListsHandlers;
public function canHandle(Request $request): bool
{
return true;
}
public function handle(Request $request): Response
{
$response = $this->respondToSlack("Nie rozpoznaję tej komendy: `/{$request->command} {$request->text}`");
$handlers = $this->findAvailableHandlers();
$attachmentFields = $this->mapHandlersToAttachments($handlers);
[$command] = explode(' ', $this->request->text ?? "");
$alternativeHandlers = $this->findAlternativeHandlers($command);
if ($alternativeHandlers->count()) {
$response->withAttachment($this->getCommandListAttachment($alternativeHandlers));
}
if ($this->containsHelpHandler($alternativeHandlers)) {
$response->withAttachment(Attachment::create()
->setText("Aby wyświetlić wszystkie komendy, napisz: `/toby pomoc`")
return $this->respondToSlack(":x: Nie rozpoznaję tej komendy. Lista wszystkich komend:")
->withAttachment(
Attachment::create()
->setColor("danger")
->useMarkdown()
->setFields($attachmentFields),
);
}
return $response;
}
protected function getCommandListAttachment(Collection $handlers): Attachment
{
$attachmentFields = $handlers
->map(function (SignatureHandler $handler) {
return AttachmentField::create($handler->getFullCommand(), $handler->getDescription());
})
->all();
return Attachment::create()
->setColor('warning')
->setTitle('Czy miałeś na myśli:')
->setFields($attachmentFields);
}
}

View File

@@ -5,70 +5,52 @@ declare(strict_types=1);
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
namespace Toby\Domain\Slack\Handlers;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
use Spatie\SlashCommand\Attachment;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Spatie\SlashCommand\Handlers\SignatureHandler;
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
use Toby\Domain\Enums\VacationType;
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
use Toby\Domain\VacationTypeConfigRetriever;
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
use Toby\Domain\DailySummaryRetriever;
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
use Toby\Domain\Slack\SignatureHandler;
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\Vacation;
class DailySummary extends SignatureHandler
{
protected $signature = "toby dzisiaj";
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
protected $description = "Podsumowanie";
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
protected $description = "Codzienne podsumowanie";
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
public function handle(Request $request): Response
{
$configRetriever = app(VacationTypeConfigRetriever::class);
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$dailySummaryRetriever = app()->make(DailySummaryRetriever::class);
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$now = Carbon::today();
/** @var Collection $absences */
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$absences = Vacation::query()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->with(["user", "vacationRequest"])
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->whereDate("date", $now)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->approved()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => $configRetriever->isVacation($type)))
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->get()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$absences = $dailySummaryRetriever->getAbsences($now)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->map(fn(Vacation $vacation) => $vacation->user->profile->full_name);
/** @var Collection $remoteDays */
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$remoteDays = Vacation::query()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->with(["user", "vacationRequest"])
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->whereDate("date", $now)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->approved()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => !$configRetriever->isVacation($type)))
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->get()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->map(fn(Vacation $vacation) => $vacation->user->profile->full_name);
$birthdays = User::query()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->whereRelation("profile", "birthday", $now)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->get()
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
$birthdays = $dailySummaryRetriever->getBirthdays($now)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->map(fn(User $user) => $user->profile->full_name);
$absencesAttachment = Attachment::create()
->setTitle("Nieobecności :palm_tree:")
->setColor('#eab308')
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->setColor("#eab308")
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->setText($absences->isNotEmpty() ? $absences->implode("\n") : "Wszyscy dzisiaj pracują :muscle:");
$remoteAttachment = Attachment::create()
->setTitle("Praca zdalna :house_with_garden:")
->setColor('#d946ef')
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->setColor("#d946ef")
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->setText($remoteDays->isNotEmpty() ? $remoteDays->implode("\n") : "Wszyscy dzisiaj są w biurze :boom:");
$birthdayAttachment = Attachment::create()
->setTitle("Urodziny :birthday:")
->setColor('#3C5F97')
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->setColor("#3C5F97")
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->setText($birthdays->isNotEmpty() ? $birthdays->implode("\n") : "Dzisiaj nikt nie ma urodzin :cry:");
return $this->respondToSlack("Podsumowanie dla dnia {$now->toDisplayString()}")
->withAttachment($absencesAttachment)
->withAttachment($remoteAttachment)
->withAttachment($birthdayAttachment)
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->displayResponseToEveryoneOnChannel();
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
->withAttachment($birthdayAttachment);
krzysztofrewak commented 2022-04-26 10:13:22 +02:00 (Migrated from github.com)
Review
        $absences = $dailySummaryRetriever->getAbsences($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $remoteDays = $dailySummaryRetriever->getRemoteDays($now)
            ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name);

        $birthdays = $dailySummaryRetriever->getBirthdays($now)
            ->map(fn(User $user): string => $user->profile->full_name);
```suggestion $absences = $dailySummaryRetriever->getAbsences($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $remoteDays = $dailySummaryRetriever->getRemoteDays($now) ->map(fn(Vacation $vacation): string => $vacation->user->profile->full_name); $birthdays = $dailySummaryRetriever->getBirthdays($now) ->map(fn(User $user): string => $user->profile->full_name); ```
krzysztofrewak commented 2022-04-26 10:14:04 +02:00 (Migrated from github.com)
Review

What if we would have five more activities? Maybe this could be encapsulated somehow?

What if we would have five more activities? Maybe this could be encapsulated somehow?
}
}

View File

@@ -4,46 +4,69 @@ declare(strict_types=1);
namespace Toby\Domain\Slack\Handlers;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Toby\Domain\Notifications\KeyHasBeenGivenNotification;
use Toby\Domain\Slack\SignatureHandler;
use Toby\Domain\Slack\SlackUserExistsRule;
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
use Toby\Domain\Slack\UserNotFoundException;
use Toby\Eloquent\Models\Key;
use Toby\Eloquent\Models\User;
class GiveKeysTo extends SignatureHandler
{
protected $signature = "toby klucze:dla {użytkownik}";
use FindsUserBySlackId;
protected $description = "Daj klucze wskazanemu użytkownikowi";
protected $signature = "toby klucze:dla {user}";
protected $description = "Przekaż klucze wskazanemu użytkownikowi";
/**
* @throws UserNotFoundException
* @throws ValidationException
*/
public function handle(Request $request): Response
{
$to = $this->getArgument('użytkownik');
["user" => $from] = $this->validate();
$id = Str::between($to, "@", "|");
$authUser = $this->findUserBySlackId($request->userId);
$user = $this->findUserBySlackId($id);
$authUser = $this->findUserBySlackIdOrFail($request->userId);
$user = $this->findUserBySlackId($from);
/** @var Key $key */
$key = $authUser->keys()->first();
if (!$key) {
throw ValidationException::withMessages(["key" => "Nie masz żadnego klucza do przekazania"]);
}
if ($user->is($authUser)) {
throw ValidationException::withMessages([
"key" => "Nie możesz przekazać sobie kluczy :dzban:",
]);
}
$key->user()->associate($user);
$key->save();
return $this->respondToSlack("<@{$authUser->profile->slack_id}> daje klucz nr {$key->id} użytkownikowi <@{$user->profile->slack_id}>")
->displayResponseToEveryoneOnChannel();
$key->notify(new KeyHasBeenGivenNotification($authUser, $user));
return $this->respondToSlack(
":white_check_mark: Klucz nr {$key->id} został przekazany użytkownikowi <@{$user->profile->slack_id}>",
);
}
protected function findUserBySlackId(string $slackId): User
protected function getRules(): array
{
/** @var User $user */
$user = User::query()
->whereRelation("profile", "slack_id", $slackId)
->first();
return [
"user" => ["required", new SlackUserExistsRule()],
];
}
return $user;
protected function getMessages(): array
{
return [
"user.required" => "Musisz podać użytkownika, któremu chcesz przekazać klucze",
];
}
}

View File

@@ -4,42 +4,31 @@ declare(strict_types=1);
namespace Toby\Domain\Slack\Handlers;
use Illuminate\Support\Collection;
use Spatie\SlashCommand\Attachment;
use Spatie\SlashCommand\AttachmentField;
use Spatie\SlashCommand\Handlers\Help as BaseHelpHandler;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Toby\Domain\Slack\SignatureHandler;
use Toby\Domain\Slack\Traits\ListsHandlers;
class Help extends BaseHelpHandler
class Help extends SignatureHandler
{
use ListsHandlers;
protected $signature = "toby pomoc";
protected $description = "Wyświetl wszystkie dostępne komendy tobiego";
protected $description = "Wyświetl wszystkie dostępne komendy";
public function handle(Request $request): Response
{
$handlers = $this->findAvailableHandlers();
return $this->displayListOfAllCommands($handlers);
}
$attachmentFields = $this->mapHandlersToAttachments($handlers);
protected function displayListOfAllCommands(Collection $handlers): Response
{
$attachmentFields = $handlers
->sort(function (SignatureHandler $handlerA, SignatureHandler $handlerB) {
return strcmp($handlerA->getFullCommand(), $handlerB->getFullCommand());
})
->map(function (SignatureHandler $handler) {
return AttachmentField::create("/{$handler->getSignature()}", $handler->getDescription());
})
->all();
return $this->respondToSlack('Dostępne komendy')
return $this->respondToSlack("Dostępne komendy:")
->withAttachment(
Attachment::create()
->setColor('good')
->setFields($attachmentFields)
->setColor("good")
->useMarkdown()
->setFields($attachmentFields),
);
}
}

View File

@@ -7,22 +7,31 @@ namespace Toby\Domain\Slack\Handlers;
use Illuminate\Support\Carbon;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Toby\Domain\Actions\VacationRequest\CreateAction;
use Toby\Domain\Enums\VacationType;
use Toby\Domain\Slack\SignatureHandler;
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\YearPeriod;
class HomeOffice extends SignatureHandler
{
protected $signature = "toby zdalnie {kiedy?}";
protected $description = "Pracuj zdalnie wybranego dnia (domyślnie dzisiaj)";
use FindsUserBySlackId;
protected $signature = "toby zdalnie";
protected $description = "Pracuj dzisiaj zdalnie";
public function handle(Request $request): Response
{
$date = $this->getDateFromArgument($this->getArgument('kiedy') ?? "dzisiaj");
$user = $this->findUserBySlackId($request->userId);
$this->createRemoteday($user, Carbon::today());
return $this->respondToSlack(":white_check_mark: Pracujesz dzisiaj zdalnie");
}
protected function createRemoteday(User $user, Carbon $date): void
{
$yearPeriod = YearPeriod::findByYear($date->year);
app(CreateAction::class)->execute([
@@ -33,27 +42,5 @@ class HomeOffice extends SignatureHandler
"year_period_id" => $yearPeriod->id,
"flow_skipped" => false,
], $user);
return $this->respondToSlack("Praca zdalna dnia {$date->toDisplayString()} została utworzona pomyślnie.")
->displayResponseToEveryoneOnChannel();
}
protected function getDateFromArgument(string $argument): Carbon
{
return match ($argument) {
"dzisiaj" => Carbon::today(),
"jutro" => Carbon::tomorrow(),
default => Carbon::create($argument),
};
}
protected function findUserBySlackId(string $slackId): User
{
/** @var User $user */
$user = User::query()
->whereRelation("profile", "slack_id", $slackId)
->first();
return $user;
}
}

View File

@@ -7,13 +7,12 @@ namespace Toby\Domain\Slack\Handlers;
use Spatie\SlashCommand\Attachment;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Toby\Domain\Slack\SignatureHandler;
use Toby\Eloquent\Models\Key;
class KeyList extends SignatureHandler
{
protected $signature = "toby klucze";
protected $description = "Lista wszystkich kluczy";
public function handle(Request $request): Response
@@ -23,11 +22,11 @@ class KeyList extends SignatureHandler
->get()
->map(fn(Key $key) => "Klucz nr {$key->id} - <@{$key->user->profile->slack_id}>");
return $this->respondToSlack("Lista kluczy")
return $this->respondToSlack("Lista kluczy :key:")
->withAttachment(
Attachment::create()
->setColor('#3C5F97')
->setText($keys->implode("\n"))
->setColor("#3C5F97")
->setText($keys->isNotEmpty() ? $keys->implode("\n") : "Nie ma żadnych kluczy w tobym"),
);
}
}

View File

@@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Slack\Handlers;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Spatie\SlashCommand\Handlers\SignatureHandler;
class SaySomething extends SignatureHandler
{
protected $signature = "toby powiedz {zdanie}";
protected $description = "Powiedz zdanie";
public function handle(Request $request): Response
{
$sentence = $this->getArgument("zdanie");
return $this->respondToSlack($sentence)
->displayResponseToEveryoneOnChannel();
}
}

View File

@@ -4,46 +4,68 @@ declare(strict_types=1);
namespace Toby\Domain\Slack\Handlers;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
use Spatie\SlashCommand\Request;
use Spatie\SlashCommand\Response;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Toby\Domain\Notifications\KeyHasBeenTakenNotification;
use Toby\Domain\Slack\SignatureHandler;
use Toby\Domain\Slack\SlackUserExistsRule;
use Toby\Domain\Slack\Traits\FindsUserBySlackId;
use Toby\Domain\Slack\UserNotFoundException;
use Toby\Eloquent\Models\Key;
use Toby\Eloquent\Models\User;
class TakeKeysFrom extends SignatureHandler
{
protected $signature = "toby klucze:od {użytkownik}";
use FindsUserBySlackId;
protected $signature = "toby klucze:od {user}";
protected $description = "Zabierz klucze wskazanemu użytkownikowi";
/**
* @throws UserNotFoundException|ValidationException
*/
public function handle(Request $request): Response
{
$from = $this->getArgument("użytkownik");
["user" => $from] = $this->validate();
$id = Str::between($from, "@", "|");
$authUser = $this->findUserBySlackId($request->userId);
$user = $this->findUserBySlackId($id);
$authUser = $this->findUserBySlackIdOrFail($request->userId);
$user = $this->findUserBySlackId($from);
/** @var Key $key */
$key = $user->keys()->first();
if (!$key) {
throw ValidationException::withMessages([
"key" => "Użytkownik <@{$user->profile->slack_id}> nie ma żadnych kluczy",
]);
}
if ($key->user()->is($authUser)) {
throw ValidationException::withMessages([
"key" => "Nie możesz zabrać sobie kluczy :dzban:",
]);
}
$key->user()->associate($authUser);
$key->save();
return $this->respondToSlack("<@{$authUser->profile->slack_id}> zabiera klucz nr {$key->id} użytkownikowi <@{$user->profile->slack_id}>")
->displayResponseToEveryoneOnChannel();
$key->notify(new KeyHasBeenTakenNotification($authUser, $user));
return $this->respondToSlack(":white_check_mark: Klucz nr {$key->id} został zabrany użytkownikowi <@{$user->profile->slack_id}>");
}
protected function findUserBySlackId(string $slackId): User
protected function getRules(): array
{
/** @var User $user */
$user = User::query()
->whereRelation("profile", "slack_id", $slackId)
->first();
return [
"user" => ["required", new SlackUserExistsRule()],
];
}
return $user;
protected function getMessages(): array
{
return [
"user.required" => "Musisz podać użytkownika, któremu chcesz zabrać klucze",
];
}
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Slack;
use Illuminate\Support\Facades\Validator;
use Spatie\SlashCommand\Handlers\SignatureHandler as BaseSignatureHandler;
abstract class SignatureHandler extends BaseSignatureHandler
{
public function validate()
{
return Validator::validate($this->getArguments(), $this->getRules(), $this->getMessages());
}
protected function getRules(): array
{
return [];
}
protected function getMessages(): array
{
return [];
}
}

View File

@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Toby\Domain\Slack\Channels;
namespace Toby\Domain\Slack;
use Illuminate\Http\Client\Response;
use Illuminate\Notifications\Notification;
@@ -14,12 +14,12 @@ class SlackApiChannel
{
$baseUrl = config("services.slack.url");
$url = "{$baseUrl}/chat.postMessage";
$channel = $notifiable->routeNotificationFor('slack', $notification);
$channel = $notifiable->routeNotificationFor("slack", $notification);
return Http::withToken(config("services.slack.client_token"))
->post($url, [
"channel" => $channel,
"text" => $notification->toSlack(),
"text" => $notification->toSlack($notifiable),
]);
}
}

View File

@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Slack;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Str;
use Toby\Eloquent\Models\Profile;
class SlackUserExistsRule implements Rule
{
public function passes($attribute, $value): bool
{
$slackId = Str::between($value, "<@", "|");
return Profile::query()->where("slack_id", $slackId)->exists();
}
public function message(): string
{
return "Użytkownik :input nie istnieje w tobym";
}
}

View File

@@ -0,0 +1,43 @@
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
<?php
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
declare(strict_types=1);
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
namespace Toby\Domain\Slack\Traits;
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
use Illuminate\Support\Str;
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
use Toby\Domain\Slack\UserNotFoundException;
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
use Toby\Eloquent\Models\User;
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
trait FindsUserBySlackId
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
{
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
protected function findUserBySlackId(string $slackId): ?User
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
{
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
$id = $this->prepareSlackIdFromString($slackId);
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
/** @var User $user */
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
$user = User::query()
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
->whereRelation("profile", "slack_id", $id)
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
->first();
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
return $user;
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
}
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
/**
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
* @throws UserNotFoundException
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
*/
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
protected function findUserBySlackIdOrFail(string $slackId): ?User
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
{
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
$user = $this->findUserBySlackId($slackId);
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
if (!$user) {
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
throw new UserNotFoundException("Użytkownik {$slackId} nie istnieje w tobym");
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
}
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
return $user;
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
}
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
protected function prepareSlackIdFromString(string $slackId): string
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
{
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
return Str::between($slackId, "<@", "|");
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
}
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `
}
krzysztofrewak commented 2022-04-26 10:16:44 +02:00 (Migrated from github.com)
Review
Is it required here? https://github.com/laravel/framework/blob/9.x/src/Illuminate/Collections/Collection.php#L387
Baakoma commented 2022-04-26 10:58:05 +02:00 (Migrated from github.com)
Review

Yes.
Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned

Yes. `Return value is expected to be 'null|\Toby\Eloquent\Models\User', '\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object' returned `

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Slack\Traits;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Spatie\SlashCommand\AttachmentField;
use Spatie\SlashCommand\Handlers\SignatureHandler;
use Spatie\SlashCommand\Handlers\SignatureParts;
use Spatie\SlashCommand\HandlesSlashCommand;
trait ListsHandlers
{
protected function findAvailableHandlers(): Collection
{
return collect(config("laravel-slack-slash-command.handlers"))
->map(fn(string $handlerClassName) => new $handlerClassName($this->request))
->filter(fn(HandlesSlashCommand $handler) => $handler instanceof SignatureHandler)
->filter(function (SignatureHandler $handler) {
$signatureParts = new SignatureParts($handler->getSignature());
return Str::is($signatureParts->getSlashCommandName(), $this->request->command);
});
}
protected function mapHandlersToAttachments(Collection $handlers): array
{
return $handlers
->sort(
fn(SignatureHandler $handlerA, SignatureHandler $handlerB) => strcmp(
$handlerA->getFullCommand(),
$handlerB->getFullCommand(),
),
)
->map(
fn(SignatureHandler $handler) => AttachmentField::create(
$handler->getDescription(),
"`/{$handler->getSignature()}`",
),
)
->all();
}
}

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Toby\Domain\Slack;
use Spatie\SlashCommand\Exceptions\SlackSlashCommandException;
class UserNotFoundException extends SlackSlashCommandException
{
}

View File

@@ -8,6 +8,7 @@ use Database\Factories\KeyFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Notifications\Notifiable;
/**
* @property int $id
@@ -16,6 +17,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Key extends Model
{
use HasFactory;
use Notifiable;
protected $guarded = [];
@@ -24,6 +26,11 @@ class Key extends Model
return $this->belongsTo(User::class);
}
public function routeNotificationForSlack(): string
{
return config("services.slack.default_channel");
}
protected static function newFactory(): KeyFactory
{
return KeyFactory::new();

View File

@@ -7,11 +7,9 @@ namespace Toby\Infrastructure\Console\Commands;
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
use Carbon\CarbonInterface;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
use Illuminate\Support\Facades\Http;
use Spatie\SlashCommand\Attachment;
use Toby\Domain\Enums\VacationType;
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
use Toby\Domain\VacationTypeConfigRetriever;
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
use Toby\Domain\DailySummaryRetriever;
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
use Toby\Eloquent\Models\Holiday;
use Toby\Eloquent\Models\User;
use Toby\Eloquent\Models\Vacation;
@@ -21,7 +19,7 @@ class SendDailySummaryToSlack extends Command
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
protected $signature = "toby:slack:daily-summary {--f|force}";
protected $description = "Sent daily summary to slack";
public function handle(VacationTypeConfigRetriever $configRetriever): void
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
public function handle(DailySummaryRetriever $dailySummaryRetriever): void
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
{
$now = Carbon::today();
@@ -29,42 +27,28 @@ class SendDailySummaryToSlack extends Command
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
return;
}
/** @var Collection $absences */
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
$absences = Vacation::query()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->with(["user", "vacationRequest"])
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->whereDate("date", $now)
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->approved()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => $configRetriever->isVacation($type)))
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->get()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
$absences = $dailySummaryRetriever->getAbsences($now)
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->map(fn(Vacation $vacation) => $vacation->user->profile->full_name);
/** @var Collection $remoteDays */
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
$remoteDays = Vacation::query()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->with(["user", "vacationRequest"])
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->whereDate("date", $now)
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->approved()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => !$configRetriever->isVacation($type)))
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->get()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
$remoteDays = $dailySummaryRetriever->getRemoteDays($now)
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->map(fn(Vacation $vacation) => $vacation->user->profile->full_name);
$birthdays = User::query()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->whereRelation("profile", "birthday", $now)
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->get()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
$birthdays = $dailySummaryRetriever->getBirthdays($now)
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->map(fn(User $user) => $user->profile->full_name);
$absencesAttachment = Attachment::create()
->setTitle("Nieobecności :palm_tree:")
->setColor('#eab308')
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->setColor("#eab308")
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->setText($absences->isNotEmpty() ? $absences->implode("\n") : "Wszyscy dzisiaj pracują :muscle:");
$remoteAttachment = Attachment::create()
->setTitle("Praca zdalna :house_with_garden:")
->setColor('#d946ef')
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->setColor("#d946ef")
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->setText($remoteDays->isNotEmpty() ? $remoteDays->implode("\n") : "Wszyscy dzisiaj są w biurze :boom:");
$birthdayAttachment = Attachment::create()
->setTitle("Urodziny :birthday:")
->setColor('#3C5F97')
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->setColor("#3C5F97")
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->setText($birthdays->isNotEmpty() ? $birthdays->implode("\n") : "Dzisiaj nikt nie ma urodzin :cry:");
$baseUrl = config("services.slack.url");
@@ -74,8 +58,8 @@ class SendDailySummaryToSlack extends Command
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
->post($url, [
"channel" => config("services.slack.default_channel"),
"text" => "Podsumowanie dla dnia {$now->toDisplayString()}",
'attachments' => collect([$absencesAttachment, $remoteAttachment, $birthdayAttachment])->map(
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
fn(Attachment $attachment) => $attachment->toArray()
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
"attachments" => collect([$absencesAttachment, $remoteAttachment, $birthdayAttachment])->map(
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
fn(Attachment $attachment) => $attachment->toArray(),
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
)->toArray(),
]);
}
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:03 +02:00 (Migrated from github.com)
Review

These attachments are almost the same as somewhere above. There should be some abstraction for that.

These attachments are almost the same as somewhere above. There should be some abstraction for that.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.
krzysztofrewak commented 2022-04-26 10:18:38 +02:00 (Migrated from github.com)
Review

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

I think I would prefer to use camelCased model attributes. It's not for this PR, but please think about it.

View File

@@ -7,12 +7,11 @@ namespace Toby\Infrastructure\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Inertia\Response;
use Toby\Domain\Enums\VacationType;
use Toby\Domain\DailySummaryRetriever;
use Toby\Domain\UserVacationStatsRetriever;
use Toby\Domain\VacationRequestStatesRetriever;
use Toby\Domain\VacationTypeConfigRetriever;
use Toby\Eloquent\Helpers\YearPeriodRetriever;
use Toby\Eloquent\Models\Vacation;
use Toby\Eloquent\Models\VacationRequest;
use Toby\Infrastructure\Http\Resources\HolidayResource;
use Toby\Infrastructure\Http\Resources\VacationRequestResource;
@@ -25,24 +24,14 @@ class DashboardController extends Controller
YearPeriodRetriever $yearPeriodRetriever,
UserVacationStatsRetriever $vacationStatsRetriever,
VacationTypeConfigRetriever $configRetriever,
DailySummaryRetriever $dailySummaryRetriever,
): Response {
$user = $request->user();
$now = Carbon::now();
$yearPeriod = $yearPeriodRetriever->selected();
$absences = Vacation::query()
->with(["user", "vacationRequest"])
->whereDate("date", $now)
->approved()
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => $configRetriever->isVacation($type)))
->get();
$remoteDays = Vacation::query()
->with(["user", "vacationRequest"])
->whereDate("date", $now)
->approved()
->whereTypes(VacationType::all()->filter(fn(VacationType $type) => !$configRetriever->isVacation($type)))
->get();
$absences = $dailySummaryRetriever->getAbsences($now);
$remoteDays = $dailySummaryRetriever->getRemoteDays($now);
if ($user->can("listAll", VacationRequest::class)) {
$vacationRequests = $yearPeriod->vacationRequests()

View File

@@ -8,6 +8,8 @@ use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\Request;
use Inertia\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Toby\Domain\Notifications\KeyHasBeenGivenNotification;
use Toby\Domain\Notifications\KeyHasBeenTakenNotification;
use Toby\Eloquent\Models\Key;
use Toby\Eloquent\Models\User;
use Toby\Infrastructure\Http\Requests\GiveKeyRequest;
@@ -60,6 +62,8 @@ class KeysController extends Controller
$key->save();
$key->notify(new KeyHasBeenTakenNotification($request->user(), $previousUser));
return redirect()
->back()
->with("success", __("Key no :number has been taken from :user.", [
@@ -81,6 +85,8 @@ class KeysController extends Controller
$key->save();
$key->notify(new KeyHasBeenGivenNotification($request->user(), $recipient));
return redirect()
->back()
->with("success", __("Key no :number has been given to :user.", [

View File

@@ -62,7 +62,8 @@
"extra": {
"laravel": {
"dont-discover": [
"laravel/telescope"
"laravel/telescope",
"spatie/laravel-slack-slash-command"
]
}
},

View File

@@ -8,21 +8,18 @@ use Toby\Domain\Slack\Handlers\GiveKeysTo;
use Toby\Domain\Slack\Handlers\Help;
use Toby\Domain\Slack\Handlers\HomeOffice;
use Toby\Domain\Slack\Handlers\KeyList;
use Toby\Domain\Slack\Handlers\SaySomething;
use Toby\Domain\Slack\Handlers\TakeKeysFrom;
return [
'url' => 'api/slack',
'signing_secret' => env('SLACK_SIGNING_SECRET'),
'verify_with_signing' => true,
'handlers' => [
"signing_secret" => env("SLACK_SIGNING_SECRET"),
"verify_with_signing" => true,
"handlers" => [
TakeKeysFrom::class,
GiveKeysTo::class,
KeyList::class,
HomeOffice::class,
DailySummary::class,
SaySomething::class,
Help::class,
CatchAll::class
CatchAll::class,
],
];

View File

@@ -23,11 +23,11 @@
"cancelled": "anulowany",
"rejected": "odrzucony",
"approved": "zatwierdzony",
"You have pending vacation request in this range.": "Masz oczekujący wniosek urlopowy w tym zakresie dat.",
"You have approved vacation request in this range.": "Masz zaakceptowany wniosek urlopowy w tym zakresie dat.",
"You have pending vacation request in this range.": "Masz oczekujący wniosek w tym zakresie dat.",
"You have approved vacation request in this range.": "Masz zaakceptowany wniosek w tym zakresie dat.",
"Vacation limit has been exceeded.": "Limit urlopu został przekroczony.",
"Vacation needs minimum one day.": "Urlop musi być co najmniej na jeden dzień.",
"The vacation request cannot be created at the turn of the year.": "Wniosek urlopowy nie może zostać złożony na przełomie roku.",
"The vacation request cannot be created at the turn of the year.": "Wniosek nie może zostać złożony na przełomie roku.",
"User has been created.": "Użytkownik został utworzony.",
"User has been updated.": "Użytkownik został zaktualizowany.",
"User has been deleted.": "Użytkownik został usunięty.",
@@ -37,11 +37,11 @@
"Holiday has been deleted.": "Dzień wolny został usunięty.",
"Selected year period has been changed.": "Wybrany rok został zmieniony.",
"Vacation limits have been updated.": "Limity urlopów zostały zaktualizowane.",
"Vacation request has been created.": "Wniosek urlopowy został utworzony.",
"Vacation request has been accepted.": "Wniosek urlopowy został zaakceptowany.",
"Vacation request has been approved.": "Wniosek urlopowy został zatwierdzony.",
"Vacation request has been rejected.": "Wniosek urlopowy został odrzucony.",
"Vacation request has been cancelled.": "Wniosek urlopowy został anulowany.",
"Vacation request has been created.": "Wniosek został utworzony.",
"Vacation request has been accepted.": "Wniosek został zaakceptowany.",
"Vacation request has been approved.": "Wniosek został zatwierdzony.",
"Vacation request has been rejected.": "Wniosek został odrzucony.",
"Vacation request has been cancelled.": "Wniosek został anulowany.",
"Sum:": "Suma:",
"Date": "Data",
"Day of week": "Dzień tygodnia",
@@ -71,5 +71,7 @@
"Key no :number has been created.": "Klucz nr :number został utworzony.",
"Key no :number has been deleted.": "Klucz nr :number został usunięty.",
"Key no :number has been taken from :user.": "Klucz nr :number został zabrany użytkownikowi :user.",
"Key no :number has been given to :user.": "Klucz nr :number został przekazany użytkownikowi :user."
"Key no :number has been given to :user.": "Klucz nr :number został przekazany użytkownikowi :user.",
":sender gives key no :key to :recipient": ":sender przekazuje klucz nr :key :recipient",
":recipient takes key no :key from :sender": ":recipient zabiera klucz nr :key :sender"
}

View File

@@ -3,11 +3,14 @@
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
use Toby\Domain\Slack\Controller as SlackController;
use Toby\Infrastructure\Http\Controllers\Api\CalculateUserUnavailableDaysController;
use Toby\Infrastructure\Http\Controllers\Api\CalculateUserVacationStatsController;
use Toby\Infrastructure\Http\Controllers\Api\CalculateVacationDaysController;
use Toby\Infrastructure\Http\Controllers\Api\GetAvailableVacationTypesController;
Route::post("slack", [SlackController::class, "getResponse"]);
Route::middleware("auth:sanctum")->group(function (): void {
Route::post("vacation/calculate-days", CalculateVacationDaysController::class);
Route::post("vacation/calculate-stats", CalculateUserVacationStatsController::class);

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Tests\Feature;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Notification;
use Inertia\Testing\AssertableInertia as Assert;
use Tests\FeatureTestCase;
use Toby\Eloquent\Models\Key;
@@ -14,6 +15,13 @@ class KeyTest extends FeatureTestCase
{
use DatabaseMigrations;
protected function setUp(): void
{
parent::setUp();
Notification::fake();
}
public function testUserCanSeeKeyList(): void
{
Key::factory()->count(10)->create();