From ee6b76c0c1a1a2b748ede639055b56e354c74fac Mon Sep 17 00:00:00 2001 From: toino Date: Thu, 5 Oct 2023 22:44:09 +0100 Subject: [PATCH 001/257] Remove body size limits in nginx --- etc/nginx/default.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/nginx/default.conf b/etc/nginx/default.conf index 4593f219..0c48634b 100644 --- a/etc/nginx/default.conf +++ b/etc/nginx/default.conf @@ -24,6 +24,9 @@ server { error_page 404 /index.php; + # disable any limits to avoid HTTP 413 for large image uploads + client_max_body_size 0; + location ~ \.php$ { fastcgi_pass unix:/run/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; From 0f111eb586e33b6a3cda46c914dbb13cc3e48414 Mon Sep 17 00:00:00 2001 From: toino Date: Thu, 5 Oct 2023 22:59:07 +0100 Subject: [PATCH 002/257] Add missing iconv package to production --- Dockerfile | 2 +- etc/php/php.ini | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 89a561d9..0d8ae4ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ WORKDIR /var/www/html USER root -RUN apk add --no-cache php82-pdo_pgsql php82-pgsql php82-pecl-redis +RUN apk add --no-cache php82-pdo_pgsql php82-pgsql php82-pecl-redis php82-iconv USER nobody diff --git a/etc/php/php.ini b/etc/php/php.ini index e2c76e67..1789baa5 100644 --- a/etc/php/php.ini +++ b/etc/php/php.ini @@ -3,3 +3,4 @@ extension=pdo_pgsql extension=pgsql extension=redis +extension=iconv From dbca66e4ccf75ec762bbbece1257ecb41394790e Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Fri, 6 Oct 2023 12:25:07 +0100 Subject: [PATCH 003/257] Fixed linkedin regex --- app/Actions/Fortify/UpdateUserProfileInformation.php | 3 +-- app/Http/Controllers/UserCRUDController.php | 2 +- version | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 43075181..72d50476 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -38,8 +38,7 @@ public function update(User $user, array $input): void 'social_media.facebook' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/facebook.com\/\w+$/', 'social_media.github' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/github.com\/\w+$/', 'social_media.instagram' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/instagram.com\/\w+$/', - 'social_media.linkedin' => ['bail', 'sometimes', 'nullable', Rule::excludeIf(fn () => $user->isCompany()), 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/in/\w+$/'], - 'social_media.linkedin' => ['bail', 'sometimes', 'nullable', Rule::excludeIf(fn () => ! $user->isCompany()), 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/company/\w+$/'], + 'social_media.linkedin' => ['sometimes', 'nullable', 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/(in|company)/\w+$/'], 'social_media.twitter' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/twitter.com\/\w+$/', 'social_media.website' => 'sometimes|nullable|string|url:https', ])->validateWithBag('updateProfileInformation'); diff --git a/app/Http/Controllers/UserCRUDController.php b/app/Http/Controllers/UserCRUDController.php index 9902e327..6841752d 100644 --- a/app/Http/Controllers/UserCRUDController.php +++ b/app/Http/Controllers/UserCRUDController.php @@ -27,7 +27,7 @@ class UserCRUDController extends CRUDController 'social_media.facebook' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/facebook.com\/\w+$/', 'social_media.github' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/github.com\/\w+$/', 'social_media.instagram' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/instagram.com\/\w+$/', - 'social_media.linkedin' => ['sometimes', 'nullable', 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/(in|company)/\w+$/'], + 'social_media.linkedin' => ['sometimes', 'nullable', 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/(in|company)\/\w+$/'], 'social_media.twitter' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/twitter.com\/\w+$/', 'social_media.website' => 'sometimes|nullable|string|url:https', 'photo' => 'nullable|mimes:jpg,jpeg,png|max:1024', diff --git a/version b/version index b0f3d96f..66c4c226 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.0.8 +1.0.9 From 5d45b1180050208bbd6cc49b1360c63bded3a68c Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Fri, 6 Oct 2023 13:43:12 +0100 Subject: [PATCH 004/257] Fixed Edit User Profile --- app/Actions/Fortify/UpdateUserProfileInformation.php | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 72d50476..63b50892 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -38,7 +38,7 @@ public function update(User $user, array $input): void 'social_media.facebook' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/facebook.com\/\w+$/', 'social_media.github' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/github.com\/\w+$/', 'social_media.instagram' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/instagram.com\/\w+$/', - 'social_media.linkedin' => ['sometimes', 'nullable', 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/(in|company)/\w+$/'], + 'social_media.linkedin' => ['sometimes', 'nullable', 'string', 'url:https', 'regex:/^https:\/\/linkedin.com\/(in|company)\/\w+$/'], 'social_media.twitter' => 'sometimes|nullable|string|url:https|regex:/^https:\/\/twitter.com\/\w+$/', 'social_media.website' => 'sometimes|nullable|string|url:https', ])->validateWithBag('updateProfileInformation'); diff --git a/version b/version index 66c4c226..7ee7020b 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.0.9 +1.0.10 From 32182e6ea1dfe7c91fb65c96300524eacab0e823 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Fri, 6 Oct 2023 19:05:27 +0100 Subject: [PATCH 005/257] Fixed wrong validation --- resources/js/Components/Program/ProgramDayPanel.vue | 2 +- version | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/Components/Program/ProgramDayPanel.vue b/resources/js/Components/Program/ProgramDayPanel.vue index d6b547a6..64da3997 100644 --- a/resources/js/Components/Program/ProgramDayPanel.vue +++ b/resources/js/Components/Program/ProgramDayPanel.vue @@ -19,7 +19,7 @@ const noInfo = computed( () => day.workshops?.length == 0 && day.talks?.length == 0 && - day.talks?.length == 0, + day.stands?.length == 0, ); const toggle = ({ target }: MouseEvent) => { diff --git a/version b/version index 7ee7020b..59e9e604 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.0.10 +1.0.11 From 705df7c6ede8c8584f0000be929def0e37bc8404 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sat, 7 Oct 2023 11:28:36 +0100 Subject: [PATCH 006/257] Made it so competitions section does not appear on mobile if there are no competitions --- resources/js/Components/HamburgerMenu.vue | 5 ++++- resources/js/Components/Navbar.vue | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/resources/js/Components/HamburgerMenu.vue b/resources/js/Components/HamburgerMenu.vue index ccb3c774..ac9d1c7e 100644 --- a/resources/js/Components/HamburgerMenu.vue +++ b/resources/js/Components/HamburgerMenu.vue @@ -86,7 +86,10 @@ onUnmounted(() => { -
+

Competições

diff --git a/resources/js/Components/Navbar.vue b/resources/js/Components/Navbar.vue index 0dcb433b..5dfe7023 100644 --- a/resources/js/Components/Navbar.vue +++ b/resources/js/Components/Navbar.vue @@ -27,10 +27,6 @@ const homeSections: Routes = { }; const pageRoutes: Routes = { - // aboutus: { - // label: "Sobre nós", - // }, - // speakers: { label: "Speakers" }, program: { label: "Programa", _query: { @@ -39,8 +35,6 @@ const pageRoutes: Routes = { }, shop: { label: "Loja" }, team: { label: "Equipa" }, - // sponsors: { label: "Patrocínios" }, - // contacts: { label: "Contactos" }, }; const editionRoutes = [2022, 2021, 2020, 2019, 2018]; From dbd52be26362923b220c66d2431b808a14806013 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sat, 7 Oct 2023 11:20:30 +0100 Subject: [PATCH 007/257] Fixed events not loading users on Admin edit page --- app/Http/Controllers/CRUDController.php | 13 ++++++++++++- app/Http/Controllers/EventCRUDController.php | 7 +++++++ app/Http/Controllers/ProgramController.php | 13 ++++++++++++- app/Models/EventDay.php | 17 ----------------- resources/js/Components/CRUD/Header.vue | 2 +- resources/js/Pages/Program.vue | 9 +++------ version | 2 +- 7 files changed, 36 insertions(+), 27 deletions(-) diff --git a/app/Http/Controllers/CRUDController.php b/app/Http/Controllers/CRUDController.php index 659f2445..8f2627b4 100644 --- a/app/Http/Controllers/CRUDController.php +++ b/app/Http/Controllers/CRUDController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; use Inertia\Inertia; @@ -68,6 +69,16 @@ protected function with(): array return []; } + /** + * The associated relations to load when loading the model. + * + * @return array + */ + protected function load(): array + { + return []; + } + public function index(Request $request) { $sort_by = $request->query('sort_by', 'id'); @@ -138,7 +149,7 @@ public function edit($id) $with = $this->with(); return Inertia::render("CRUD/$this->view/Edit", [ - 'item' => $item, + 'item' => $item->load($this->load()), 'with' => $with, ]); } diff --git a/app/Http/Controllers/EventCRUDController.php b/app/Http/Controllers/EventCRUDController.php index b35f0842..6e262ad3 100644 --- a/app/Http/Controllers/EventCRUDController.php +++ b/app/Http/Controllers/EventCRUDController.php @@ -37,6 +37,7 @@ protected function created(array $new): ?array unset($new['users']); DB::beginTransaction(); + /** @var Event $event */ $event = Event::create($new); $event->users()->sync($users); @@ -50,11 +51,17 @@ protected function updated($old, array $new): ?array $users = $new['users']; unset($new['users']); + /** @var Event $old */ $old->users()->sync($users); return $new; } + protected function load(): array + { + return ['users']; + } + protected function with(): array { return [ diff --git a/app/Http/Controllers/ProgramController.php b/app/Http/Controllers/ProgramController.php index d519be73..21b08d03 100644 --- a/app/Http/Controllers/ProgramController.php +++ b/app/Http/Controllers/ProgramController.php @@ -45,10 +45,21 @@ public function show(Request $request) $validated = $validator->validated(); $queryDay = isset($validated['day']) ? $validated['day'] : ProgramController::DEFAULT_PROGRAM_DAY; + /** @var \App\Models\EventDay|null $eventDay */ $eventDay = $edition->event_days()->orderBy('date', 'ASC')->skip($queryDay - 1)->first(); return Inertia::render('Program', [ - 'eventDay' => fn () => $eventDay, + 'eventDay' => fn () => $eventDay?->load([ + 'stands' => [ + 'sponsor' => [ + 'company' => [ + 'user', + ], + ], + ], + 'talks', + 'workshops', + ]), 'queryDay' => fn () => intval($queryDay), 'totalDays' => fn () => intval($totalDays), ]); diff --git a/app/Models/EventDay.php b/app/Models/EventDay.php index 2f7cb5ab..ab6601ec 100644 --- a/app/Models/EventDay.php +++ b/app/Models/EventDay.php @@ -17,23 +17,6 @@ class EventDay extends Model 'edition_id', ]; - protected $with = [ - 'stands' => [ - 'sponsor' => [ - 'company' => [ - 'user', - ], - ], - ], - 'events' => [ - 'users' => [ - 'usertype', - ], - ], - 'talks', - 'workshops', - ]; - protected $casts = [ 'date' => 'datetime', ]; diff --git a/resources/js/Components/CRUD/Header.vue b/resources/js/Components/CRUD/Header.vue index efaf6b42..f1e0a507 100644 --- a/resources/js/Components/CRUD/Header.vue +++ b/resources/js/Components/CRUD/Header.vue @@ -62,7 +62,7 @@ const filter = computed(() => { if (!props.filterBy) return []; const router = route(); - console.log(router.params); + return Object.entries(props.filterValues).map(([value, label]) => { const oldValue = page.props.filterBy?.[props.filterBy] ?? []; const selected = oldValue.includes(value); diff --git a/resources/js/Pages/Program.vue b/resources/js/Pages/Program.vue index 39251292..ed7128b8 100644 --- a/resources/js/Pages/Program.vue +++ b/resources/js/Pages/Program.vue @@ -6,7 +6,7 @@ import route from "ziggy-js"; import { Link } from "@inertiajs/vue3"; interface Props { - eventDay: EventDay; + eventDay?: EventDay; queryDay: number; totalDays: number; } @@ -17,7 +17,7 @@ const { eventDay, queryDay, totalDays } = defineProps(); {{ - new Intl.DateTimeFormat("pt-PT", { - month: "long", - day: "2-digit", - }).format(new Date(eventDay.date)) + $d(new Date(eventDay.date), "long") }}
diff --git a/version b/version index 59e9e604..bb83058e 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.0.11 +1.0.12 From 401d54a33713fbc1d0baa5cb61783815ed0b9c44 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sat, 7 Oct 2023 17:23:34 +0100 Subject: [PATCH 008/257] Changed load function to protected attribute --- app/Http/Controllers/CRUDController.php | 11 +++-------- app/Http/Controllers/EventCRUDController.php | 5 +---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/CRUDController.php b/app/Http/Controllers/CRUDController.php index 8f2627b4..55cf2a03 100644 --- a/app/Http/Controllers/CRUDController.php +++ b/app/Http/Controllers/CRUDController.php @@ -70,14 +70,9 @@ protected function with(): array } /** - * The associated relations to load when loading the model. - * - * @return array + * The associated relations to load on the model when rendering the edit view. */ - protected function load(): array - { - return []; - } + protected $load = []; public function index(Request $request) { @@ -149,7 +144,7 @@ public function edit($id) $with = $this->with(); return Inertia::render("CRUD/$this->view/Edit", [ - 'item' => $item->load($this->load()), + 'item' => $item->load($this->load), 'with' => $with, ]); } diff --git a/app/Http/Controllers/EventCRUDController.php b/app/Http/Controllers/EventCRUDController.php index 6e262ad3..4a14bffe 100644 --- a/app/Http/Controllers/EventCRUDController.php +++ b/app/Http/Controllers/EventCRUDController.php @@ -57,10 +57,7 @@ protected function updated($old, array $new): ?array return $new; } - protected function load(): array - { - return ['users']; - } + protected $load = ['users']; protected function with(): array { From 18ab3c3cc61f8e9118c5bfe2d5f2aa9e960f086d Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sat, 7 Oct 2023 18:51:18 +0100 Subject: [PATCH 009/257] Made it so speaker items have fixed dimensions --- resources/js/Components/Home/SpeakerSlide.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/Components/Home/SpeakerSlide.vue b/resources/js/Components/Home/SpeakerSlide.vue index 353140fb..fa0c1900 100644 --- a/resources/js/Components/Home/SpeakerSlide.vue +++ b/resources/js/Components/Home/SpeakerSlide.vue @@ -17,10 +17,10 @@ const speakerName = (name: string) => {
-

+

{{ speakerName(speaker.name) }}

From 58478f200ff38a79f75df3357d511b17d6f45f00 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sun, 8 Oct 2023 00:18:16 +0100 Subject: [PATCH 010/257] Fixed activity/talk count --- app/Http/Controllers/HomeController.php | 8 ++++++-- app/Models/Event.php | 15 +++++++++++++++ app/Models/EventDay.php | 8 ++------ resources/js/Components/Home/SpeakerSlide.vue | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 0e14ab03..73b3462f 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -22,8 +22,12 @@ public function show(Request $request) $speakers = $edition->speakers()->get(); $days = $edition->event_days()->orderBy('date', 'ASC')->get(); - $activity_count = $edition->workshops()->count(); - $talk_count = $edition->talks()->count(); + // TODO: see if this can be done with the old methods + // $talk_count = $edition->talks()->count(); + // $activity_count = $edition->workshops()->count(); + $talk_count = $edition->events()->talk()->count(); + $activity_count = $edition->events()->workshop()->count(); + $stand_count = $edition->stands()->count(); $can_enroll = Gate::allows('enroll', $edition); diff --git a/app/Models/Event.php b/app/Models/Event.php index e68b9dfd..77b5cbeb 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -47,4 +48,18 @@ public function type(): BelongsTo { return $this->belongsTo(EventType::class, 'event_type_id'); } + + public function scopeTalk(Builder $query): void + { + $query->whereHas('type', function ($query) { + $query->where('name', 'talk'); + }); + } + + public function scopeWorkshop(Builder $query): void + { + $query->whereHas('type', function ($query) { + $query->where('name', 'workshop'); + }); + } } diff --git a/app/Models/EventDay.php b/app/Models/EventDay.php index ab6601ec..b59dd00d 100644 --- a/app/Models/EventDay.php +++ b/app/Models/EventDay.php @@ -28,16 +28,12 @@ public function edition(): BelongsTo public function talks(): HasMany { - return $this->events()->whereHas('type', function ($query) { - $query->where('name', 'talk'); - }); + return $this->events()->talk(); } public function workshops(): HasMany { - return $this->events()->whereHas('type', function ($query) { - $query->where('name', 'workshop'); - }); + return $this->events()->workshop(); } public function events(): HasMany diff --git a/resources/js/Components/Home/SpeakerSlide.vue b/resources/js/Components/Home/SpeakerSlide.vue index fa0c1900..e5b7a453 100644 --- a/resources/js/Components/Home/SpeakerSlide.vue +++ b/resources/js/Components/Home/SpeakerSlide.vue @@ -17,7 +17,7 @@ const speakerName = (name: string) => {

From 713c36a2da0a3cb1ac56a894844bb520ae31edd3 Mon Sep 17 00:00:00 2001 From: Nuno Pereira Date: Sun, 8 Oct 2023 10:37:32 +0100 Subject: [PATCH 011/257] Made it so user profile dropdown appears on top of mobiile content dropdown --- resources/js/Components/HamburgerMenu.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/Components/HamburgerMenu.vue b/resources/js/Components/HamburgerMenu.vue index ac9d1c7e..777e11d4 100644 --- a/resources/js/Components/HamburgerMenu.vue +++ b/resources/js/Components/HamburgerMenu.vue @@ -67,7 +67,7 @@ onUnmounted(() => {