Skip to content
Merged

dev #3487

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions app/Console/Commands/DeleteUserAccount.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace App\Console\Commands;

use App\Jobs\ProcessUserDeletion;
use App\User;
use Illuminate\Console\Command;
use Throwable;

class DeleteUserAccount extends Command
{
protected $signature = 'users:delete-account
{email : The email address of the account to delete}
{--dry-run : Show what would be deleted without deleting}
{--queue : Dispatch deletion through the queue instead of running immediately}
{--force : Skip confirmation prompt}';

protected $description = 'Delete a user account by email and reassign related event ownership to the legacy user.';

public function handle(): int
{
$email = mb_strtolower(trim((string) $this->argument('email')));

/** @var User|null $user */
$user = User::withTrashed()
->whereRaw('LOWER(email) = ?', [$email])
->first();

if (!$user) {
$this->error("No user found for email: {$email}");
return self::FAILURE;
}

$this->info("Found user #{$user->id}: {$user->firstname} {$user->lastname} <{$user->email}>");

if ($this->option('dry-run')) {
$this->line('Dry run enabled. No changes were made.');
return self::SUCCESS;
}

if (!$this->option('force')) {
$confirmed = $this->confirm(
"This will permanently delete user #{$user->id} ({$user->email}). Continue?",
false
);

if (!$confirmed) {
$this->line('Cancelled.');
return self::SUCCESS;
}
}

try {
if ($this->option('queue')) {
ProcessUserDeletion::dispatch($user->id);
$this->info("Deletion job dispatched for user #{$user->id}.");
return self::SUCCESS;
}

// Execute immediately for urgent/account-support requests.
(new ProcessUserDeletion($user->id))->handle();
$this->info("User #{$user->id} has been deleted.");

return self::SUCCESS;
} catch (Throwable $e) {
$this->error("Failed to delete user #{$user->id}: {$e->getMessage()}");
return self::FAILURE;
}
}
}
2 changes: 2 additions & 0 deletions app/HackathonsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class HackathonsPage extends Model
'dynamic_content',
'hero_title',
'hero_subtitle',
'hero_background_image_url',
'intro_title',
'intro_paragraph_1',
'intro_paragraph_2',
Expand All @@ -21,6 +22,7 @@ class HackathonsPage extends Model
'details_paragraph_3',
'details_paragraph_4',
'video_url',
'video_poster_image_url',
'extra_button_text',
'extra_button_link',
'recap_button_text',
Expand Down
6 changes: 6 additions & 0 deletions app/Nova/HackathonsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function fields(Request $request): array
Panel::make('Hero', [
Text::make('Hero title', 'hero_title')->nullable(),
Trix::make('Hero subtitle', 'hero_subtitle')->nullable(),
Text::make('Hero background image URL', 'hero_background_image_url')
->nullable()
->help('Optional. Use a relative path like /images/hackathons/hackathons_bg.png or a full URL.'),
])->collapsable()->collapsedByDefault(),

Panel::make('Intro section', [
Expand All @@ -64,6 +67,9 @@ public function fields(Request $request): array
Trix::make('Details paragraph 3', 'details_paragraph_3')->nullable(),
Trix::make('Details paragraph 4', 'details_paragraph_4')->nullable(),
Text::make('Video URL (embed)', 'video_url')->nullable(),
Text::make('Video poster image URL', 'video_poster_image_url')
->nullable()
->help('Optional. Image shown behind the play button. Use a relative path like /images/Visual%20for%20EU%20Finals%20webpage.png or a full URL.'),
Text::make('Extra button text (optional)', 'extra_button_text')->nullable(),
Text::make('Extra button link (optional)', 'extra_button_link')->nullable(),
Text::make('Recap button text', 'recap_button_text')->nullable(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
public function up(): void
{
if (Schema::hasTable('hackathons_page') && !Schema::hasColumn('hackathons_page', 'hero_background_image_url')) {
Schema::table('hackathons_page', function (Blueprint $table) {
$table->string('hero_background_image_url')->nullable()->after('hero_subtitle');
});
}

if (Schema::hasTable('hackathons_page') && !Schema::hasColumn('hackathons_page', 'video_poster_image_url')) {
Schema::table('hackathons_page', function (Blueprint $table) {
$table->string('video_poster_image_url')->nullable()->after('video_url');
});
}
}

public function down(): void
{
if (Schema::hasTable('hackathons_page') && Schema::hasColumn('hackathons_page', 'video_poster_image_url')) {
Schema::table('hackathons_page', function (Blueprint $table) {
$table->dropColumn('video_poster_image_url');
});
}

if (Schema::hasTable('hackathons_page') && Schema::hasColumn('hackathons_page', 'hero_background_image_url')) {
Schema::table('hackathons_page', function (Blueprint $table) {
$table->dropColumn('hero_background_image_url');
});
}
}
};

Binary file added public/images/Visual for EU Finals webpage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions resources/views/hackathons/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
$hasHackathonsPageTable = \Illuminate\Support\Facades\Schema::hasTable('hackathons_page');
$page = $hasHackathonsPageTable ? \App\HackathonsPage::config() : null;
$dynamic = $page && $page->dynamic_content;

$defaultHeroBackground = '/images/hackathons/hackathons_bg.png';
$heroBackground = ($dynamic && $page && $page->hero_background_image_url) ? $page->hero_background_image_url : $defaultHeroBackground;

// Note: file on disk has spaces; URL must be encoded.
$defaultVideoPoster = '/images/Visual%20for%20EU%20Finals%20webpage.png';
$videoPoster = ($dynamic && $page && $page->video_poster_image_url) ? $page->video_poster_image_url : $defaultVideoPoster;
@endphp

@section('layout.breadcrumb')
Expand Down Expand Up @@ -46,13 +53,13 @@
<img
class="absolute top-0 -left-1/4 w-[150vw] !max-w-none md:hidden"
loading="lazy"
src="/images/hackathons/hackathons_bg.png"
src="{{ $heroBackground }}"
style="clip-path: ellipse(71% 73% at 40% 20%);"
/>
<img
class="absolute top-0 right-0 h-full max-w-[calc(70vw)] object-cover hidden md:block"
loading="lazy"
src="/images/hackathons/hackathons_bg.png"
src="{{ $heroBackground }}"
style="clip-path: ellipse(70% 140% at 70% 25%);"
/>
</div>
Expand Down Expand Up @@ -105,7 +112,7 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom
<div class="relative pt-20 pb-16 codeweek-container-lg md:pt-40 md:pb-28">
<div class="flex flex-col gap-6 lg:flex-row lg:gap-20">
<div class="flex overflow-hidden relative flex-1 items-center">
<img src="{{asset('images/hackathons/hackathon.png')}}" class="object-cover h-full rounded-lg">
<img src="{{ $videoPoster }}" class="object-cover h-full rounded-lg">
<div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
@include('layout.video-player', [
'id' => 'hackathons-video',
Expand Down
Loading