Fix settings save 500 by dropping Events-only preference columns.
Deploy Ladill Transfer / deploy (push) Successful in 33s
Deploy Ladill Transfer / deploy (push) Successful in 33s
Transfer qr_settings only stores notify_email and product_updates. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -75,8 +75,6 @@ class AccountController extends Controller
|
|||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'notify_email' => ['nullable', 'email', 'max:255'],
|
'notify_email' => ['nullable', 'email', 'max:255'],
|
||||||
'product_updates' => ['nullable', 'boolean'],
|
'product_updates' => ['nullable', 'boolean'],
|
||||||
'notify_registrations' => ['nullable', 'boolean'],
|
|
||||||
'notify_payouts' => ['nullable', 'boolean'],
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
QrSetting::updateOrCreate(
|
QrSetting::updateOrCreate(
|
||||||
@@ -84,8 +82,6 @@ class AccountController extends Controller
|
|||||||
[
|
[
|
||||||
'notify_email' => $data['notify_email'] ?? null,
|
'notify_email' => $data['notify_email'] ?? null,
|
||||||
'product_updates' => $request->boolean('product_updates'),
|
'product_updates' => $request->boolean('product_updates'),
|
||||||
'notify_registrations' => $request->boolean('notify_registrations'),
|
|
||||||
'notify_payouts' => $request->boolean('notify_payouts'),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Tests\Feature;
|
namespace Tests\Feature;
|
||||||
|
|
||||||
use App\Models\QrCode;
|
|
||||||
use App\Models\QrSetting;
|
use App\Models\QrSetting;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
@@ -25,19 +24,7 @@ class QrSettingsTest extends TestCase
|
|||||||
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
|
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_settings_page_renders_for_authenticated_user(): void
|
public function test_can_save_transfer_settings(): void
|
||||||
{
|
|
||||||
$this->actingAs($this->user())
|
|
||||||
->get(route('account.settings'))
|
|
||||||
->assertOk()
|
|
||||||
->assertSee('favicon.ico', false)
|
|
||||||
->assertSee('New event defaults')
|
|
||||||
->assertSee('QR code defaults')
|
|
||||||
->assertSee('New registrations')
|
|
||||||
->assertSee('Notifications');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_can_save_qr_settings(): void
|
|
||||||
{
|
{
|
||||||
$user = $this->user();
|
$user = $this->user();
|
||||||
|
|
||||||
@@ -45,26 +32,6 @@ class QrSettingsTest extends TestCase
|
|||||||
->put(route('account.settings.update'), [
|
->put(route('account.settings.update'), [
|
||||||
'notify_email' => 'alerts@example.com',
|
'notify_email' => 'alerts@example.com',
|
||||||
'product_updates' => '1',
|
'product_updates' => '1',
|
||||||
'low_balance_alerts' => '0',
|
|
||||||
'notify_registrations' => '1',
|
|
||||||
'notify_payouts' => '0',
|
|
||||||
'event_defaults' => [
|
|
||||||
'currency' => 'USD',
|
|
||||||
'mode' => 'free',
|
|
||||||
'badge_size' => '4x6',
|
|
||||||
'brand_color' => '#aabbcc',
|
|
||||||
'organizer' => 'CAPBuSS',
|
|
||||||
'registration_open' => '1',
|
|
||||||
'badge_fields' => ['Company', 'Title'],
|
|
||||||
],
|
|
||||||
'default_style' => [
|
|
||||||
'foreground' => '#112233',
|
|
||||||
'background' => '#ffffff',
|
|
||||||
'module_style' => 'dots',
|
|
||||||
'frame_style' => 'scan_me',
|
|
||||||
'frame_color' => '#445566',
|
|
||||||
'frame_text' => 'SCAN ME',
|
|
||||||
],
|
|
||||||
])
|
])
|
||||||
->assertRedirect(route('account.settings'));
|
->assertRedirect(route('account.settings'));
|
||||||
|
|
||||||
@@ -73,36 +40,5 @@ class QrSettingsTest extends TestCase
|
|||||||
$this->assertNotNull($settings);
|
$this->assertNotNull($settings);
|
||||||
$this->assertSame('alerts@example.com', $settings->notify_email);
|
$this->assertSame('alerts@example.com', $settings->notify_email);
|
||||||
$this->assertTrue($settings->product_updates);
|
$this->assertTrue($settings->product_updates);
|
||||||
$this->assertFalse($settings->low_balance_alerts);
|
|
||||||
$this->assertTrue($settings->notify_registrations);
|
|
||||||
$this->assertFalse($settings->notify_payouts);
|
|
||||||
$this->assertSame('USD', $settings->resolvedEventDefaults()['currency']);
|
|
||||||
$this->assertSame('free', $settings->resolvedEventDefaults()['mode']);
|
|
||||||
$this->assertSame('CAPBuSS', $settings->resolvedEventDefaults()['organizer']);
|
|
||||||
$this->assertSame('#112233', $settings->resolvedDefaultStyle()['foreground']);
|
|
||||||
$this->assertSame('scan_me', $settings->resolvedDefaultStyle()['frame_style']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_create_page_uses_saved_defaults(): void
|
|
||||||
{
|
|
||||||
$user = $this->user();
|
|
||||||
QrSetting::create([
|
|
||||||
'user_id' => $user->id,
|
|
||||||
'default_type' => QrCode::TYPE_EVENT,
|
|
||||||
'default_style' => ['foreground' => '#aabbcc', 'module_style' => 'dots'],
|
|
||||||
'event_defaults' => ['mode' => 'contributions', 'organizer' => 'Test Org', 'brand_color' => '#ff00aa'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
Http::fake([
|
|
||||||
config('billing.api_url').'/balance*' => Http::response(['balance_minor' => 50000]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->actingAs($user)
|
|
||||||
->get(route('events.create'))
|
|
||||||
->assertOk()
|
|
||||||
->assertSee('favicon.ico', false)
|
|
||||||
->assertSee('#aabbcc', false)
|
|
||||||
->assertSee('Test Org', false)
|
|
||||||
->assertSee('"event"', false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user