rename goody into goodie

This commit is contained in:
Xu 2024-04-10 15:28:41 +02:00 committed by Igor Scheller
parent d0388e8344
commit 3fd8267f12
16 changed files with 68 additions and 37 deletions

View File

@ -89,7 +89,7 @@ return [
'privacy_email' => env('PRIVACY_EMAIL'),
// Show opt in to save some personal data after the event on user profile and registration pages
'enable_email_goody' => (bool) env('ENABLE_EMAIL_GOODY', true),
'enable_email_goodie' => (bool) env('ENABLE_EMAIL_GOODIE', true),
// Initial admin password
'setup_admin_password' => env('SETUP_ADMIN_PASSWORD'),

View File

@ -21,7 +21,7 @@ class SettingsFactory extends Factory
'theme' => $this->faker->numberBetween(1, 20),
'email_human' => $this->faker->boolean(),
'email_messages' => $this->faker->boolean(),
'email_goody' => $this->faker->boolean(),
'email_goodie' => $this->faker->boolean(),
'email_shiftinfo' => $this->faker->boolean(),
'email_news' => $this->faker->boolean(),
'mobile_show' => $this->faker->boolean(),

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Engelsystem\Migrations;
use Engelsystem\Database\Migration\Migration;
use Illuminate\Database\Schema\Blueprint;
class RenameGoodyToGoodie extends Migration
{
/**
* Run the migration
*/
public function up(): void
{
$this->schema->table('users_settings', function (Blueprint $table): void {
$table->renameColumn('email_goody', 'email_goodie');
});
}
/**
* Reverse the migration
*/
public function down(): void
{
$this->schema->table('users_settings', function (Blueprint $table): void {
$table->renameColumn('email_goodie', 'email_goody');
});
}
}

View File

@ -1635,7 +1635,7 @@ msgstr "Benachrichtige mich bei neuen privaten Nachrichten."
msgid "settings.profile.email_by_human_allowed"
msgstr "Erlaube Himmel-Engeln mich per E-Mail zu kontaktieren."
msgid "settings.profile.email_goody"
msgid "settings.profile.email_goodie"
msgstr "Um gegebenenfalls Voucher für das nächste gleichartige Event zu erhalten stimme ich zu, "
"dass mein Nick, E-Mail-Adresse und geleistete Arbeit solange gespeichert werden."

View File

@ -337,7 +337,7 @@ msgstr "Notify me on new private messages."
msgid "settings.profile.email_by_human_allowed"
msgstr "Allow heaven angels to contact me by e-mail."
msgid "settings.profile.email_goody"
msgid "settings.profile.email_goodie"
msgstr "To possibly receive vouchers for the next similar event, I consent "
"that my nick, e-mail address and worked hours will be stored until then."

View File

@ -196,16 +196,16 @@
{% if isGoodieEnabled %}
<div class="col-md-6">
{% set privacy_email = config('privacy_email') %}
{% set email_goody_label =
(isGoodieTShirt ? __('settings.profile.email_tshirt') : __('settings.profile.email_goody')) ~
{% set email_goodie_label =
(isGoodieTShirt ? __('settings.profile.email_tshirt') : __('settings.profile.email_goodie')) ~
(privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '')
%}
{{ f.checkbox(
'email_goody',
email_goody_label,
'email_goodie',
email_goodie_label,
{
'raw_label': true,
'checked': f.formData('email_goody', false),
'checked': f.formData('email_goodie', false),
},
) }}
</div>

View File

@ -135,12 +135,12 @@
}) }}
{% if goodie_enabled %}
{% set privacy_email = config('privacy_email') %}
{% set email_goody_label =
(goodie_tshirt ? __('settings.profile.email_tshirt') : __('settings.profile.email_goody')) ~
{% set email_goodie_label =
(goodie_tshirt ? __('settings.profile.email_tshirt') : __('settings.profile.email_goodie')) ~
(privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '')
%}
{{ f.checkbox('email_goody', email_goody_label, {
'checked': userdata.settings.email_goody,
{{ f.checkbox('email_goodie', email_goodie_label, {
'checked': userdata.settings.email_goodie,
'raw_label': true,
}) }}
{% endif %}

View File

@ -107,7 +107,7 @@ class Controller extends BaseController
'type' => 'gauge',
['labels' => ['type' => 'system'], 'value' => $this->stats->email('system')],
['labels' => ['type' => 'humans'], 'value' => $this->stats->email('humans')],
['labels' => ['type' => 'goody'], 'value' => $this->stats->email('goody')],
['labels' => ['type' => 'goodie'], 'value' => $this->stats->email('goodie')],
['labels' => ['type' => 'news'], 'value' => $this->stats->email('news')],
],
'users_working' => [

View File

@ -94,7 +94,7 @@ class Stats
return match ($type) {
'system' => Settings::whereEmailShiftinfo(true)->count(),
'humans' => Settings::whereEmailHuman(true)->count(),
'goody' => Settings::whereEmailGoody(true)->count(),
'goodie' => Settings::whereEmailGoodie(true)->count(),
'news' => Settings::whereEmailNews(true)->count(),
default => 0,
};

View File

@ -99,7 +99,7 @@ class RegistrationController extends BaseController
'isPasswordEnabled' => $this->userFactory->determineIsPasswordEnabled(),
'isDECTEnabled' => $this->config->get('enable_dect'),
'isShowMobileEnabled' => $this->config->get('enable_mobile_show'),
'isGoodieEnabled' => $goodieType !== GoodieType::None && config('enable_email_goody'),
'isGoodieEnabled' => $goodieType !== GoodieType::None && config('enable_email_goodie'),
'isGoodieTShirt' => $goodieType === GoodieType::Tshirt,
'isPronounEnabled' => $this->config->get('enable_pronoun'),
'isFullNameEnabled' => $this->config->get('enable_user_name'),

View File

@ -47,7 +47,7 @@ class SettingsController extends BaseController
'settings_menu' => $this->settingsMenu(),
'userdata' => $user,
'goodie_enabled' => $this->config->get('goodie_type') !== GoodieType::None->value
&& config('enable_email_goody'),
&& config('enable_email_goodie'),
'goodie_tshirt' => $this->config->get('goodie_type') === GoodieType::Tshirt->value,
'tShirtLink' => $this->config->get('tshirt_link'),
'isPronounRequired' => $requiredFields['pronoun'],
@ -106,8 +106,8 @@ class SettingsController extends BaseController
$user->settings->email_human = $data['email_human'] ?: false;
$user->settings->email_messages = $data['email_messages'] ?: false;
if ($goodie_enabled && config('enable_email_goody')) {
$user->settings->email_goody = $data['email_goody'] ?: false;
if ($goodie_enabled && config('enable_email_goodie')) {
$user->settings->email_goodie = $data['email_goodie'] ?: false;
}
if (
@ -471,7 +471,7 @@ class SettingsController extends BaseController
'email_news' => 'optional|checked',
'email_human' => 'optional|checked',
'email_messages' => 'optional|checked',
'email_goody' => 'optional|checked',
'email_goodie' => 'optional|checked',
];
if (config('enable_planned_arrival')) {
$rules['planned_arrival_date'] = 'required|date:Y-m-d';

View File

@ -86,7 +86,7 @@ class User
'email_by_human_allowed' => 'optional|checked',
'email_messages' => 'optional|checked',
'email_news' => 'optional|checked',
'email_goody' => 'optional|checked',
'email_goodie' => 'optional|checked',
// Using length here, because min/max would validate dect/mobile as numbers.
'mobile' => $this->isRequired('mobile') . '|length:0:40',
];
@ -255,7 +255,7 @@ class User
'theme' => $this->config->get('theme'),
'email_human' => $data['email_by_human_allowed'] ?? false,
'email_messages' => $data['email_messages'] ?? false,
'email_goody' => $data['email_goody'] ?? false,
'email_goodie' => $data['email_goodie'] ?? false,
'email_shiftinfo' => $data['email_shiftinfo'] ?? false,
'email_news' => $data['email_news'] ?? false,
'mobile_show' => $isShowMobileEnabled && $data['mobile_show'],

View File

@ -12,7 +12,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
* @property int $theme
* @property bool $email_human
* @property bool $email_messages
* @property bool $email_goody
* @property bool $email_goodie
* @property bool $email_shiftinfo
* @property bool $email_news
* @property bool $mobile_show
@ -21,7 +21,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
* @method static QueryBuilder|Settings[] whereTheme($value)
* @method static QueryBuilder|Settings[] whereEmailHuman($value)
* @method static QueryBuilder|Settings[] whereEmailMessages($value)
* @method static QueryBuilder|Settings[] whereEmailGoody($value)
* @method static QueryBuilder|Settings[] whereEmailGoodie($value)
* @method static QueryBuilder|Settings[] whereEmailShiftinfo($value)
* @method static QueryBuilder|Settings[] whereEmailNews($value)
* @method static QueryBuilder|Settings[] whereMobileShow($value)
@ -37,7 +37,7 @@ class Settings extends HasUserModel
protected $attributes = [ // phpcs:ignore
'email_human' => false,
'email_messages' => false,
'email_goody' => false,
'email_goodie' => false,
'email_shiftinfo' => false,
'email_news' => false,
'mobile_show' => false,
@ -54,7 +54,7 @@ class Settings extends HasUserModel
'theme',
'email_human',
'email_messages',
'email_goody',
'email_goodie',
'email_shiftinfo',
'email_news',
'mobile_show',
@ -66,7 +66,7 @@ class Settings extends HasUserModel
'theme' => 'integer',
'email_human' => 'boolean',
'email_messages' => 'boolean',
'email_goody' => 'boolean',
'email_goodie' => 'boolean',
'email_shiftinfo' => 'boolean',
'email_news' => 'boolean',
'mobile_show' => 'boolean',

View File

@ -79,7 +79,7 @@ final class RegistrationControllerTest extends ApplicationFeatureTest
FormFieldAssert::assertNotContainsInputField('pronoun', $responseHTML);
FormFieldAssert::assertNotContainsInputField('firstname', $responseHTML);
FormFieldAssert::assertNotContainsInputField('lastname', $responseHTML);
FormFieldAssert::assertNotContainsInputField('email_goody', $responseHTML);
FormFieldAssert::assertNotContainsInputField('email_goodie', $responseHTML);
FormFieldAssert::assertNotContainsSelectField('tshirt_size', $responseHTML);
FormFieldAssert::assertNotContainsInputField('planned_arrival_date', $responseHTML);
FormFieldAssert::assertNotContainsInputField('mobile_show', $responseHTML);
@ -109,7 +109,7 @@ final class RegistrationControllerTest extends ApplicationFeatureTest
FormFieldAssert::assertContainsInputField('password_confirmation', $responseHTML);
FormFieldAssert::assertContainsInputField('firstname', $responseHTML);
FormFieldAssert::assertContainsInputField('lastname', $responseHTML);
FormFieldAssert::assertContainsInputField('email_goody', $responseHTML);
FormFieldAssert::assertContainsInputField('email_goodie', $responseHTML);
FormFieldAssert::assertContainsSelectField('tshirt_size', $responseHTML);
FormFieldAssert::assertContainsInputField('planned_arrival_date', $responseHTML);
FormFieldAssert::assertContainsInputField('mobile_show', $responseHTML);

View File

@ -368,7 +368,7 @@ class StatsTest extends TestCase
$this->assertEquals(0, $stats->email('not-available-option'));
$this->assertEquals(2, $stats->email('system'));
$this->assertEquals(3, $stats->email('humans'));
$this->assertEquals(1, $stats->email('goody'));
$this->assertEquals(1, $stats->email('goodie'));
$this->assertEquals(1, $stats->email('news'));
}
@ -518,7 +518,7 @@ class StatsTest extends TestCase
{
$this->addUser();
$this->addUser([], ['shirt_size' => 'L'], ['email_human' => true, 'email_shiftinfo' => true]);
$this->addUser(['arrived' => 1], [], ['email_human' => true, 'email_goody' => true, 'email_news' => true]);
$this->addUser(['arrived' => 1], [], ['email_human' => true, 'email_goodie' => true, 'email_news' => true]);
$this->addUser(['arrived' => 1], ['pronoun' => 'unicorn'], ['language' => 'lo_RM', 'email_shiftinfo' => true]);
$this->addUser(['arrived' => 1, 'got_voucher' => 2], ['shirt_size' => 'XXL'], ['language' => 'lo_RM']);
$this->addUser(

View File

@ -56,7 +56,7 @@ class SettingsControllerTest extends ControllerTest
'email_news' => true,
'email_human' => true,
'email_messages' => true,
'email_goody' => true,
'email_goodie' => true,
'shirt_size' => 'S',
];
$this->request = $this->request->withParsedBody($body);
@ -74,7 +74,7 @@ class SettingsControllerTest extends ControllerTest
'enable_planned_arrival' => true,
'enable_dect' => true,
'enable_mobile_show' => true,
'enable_email_goody' => true,
'enable_email_goodie' => true,
'goodie_type' => GoodieType::Tshirt->value,
]);
@ -135,7 +135,7 @@ class SettingsControllerTest extends ControllerTest
$this->assertEquals($body['email_news'], $this->user->settings->email_news);
$this->assertEquals($body['email_human'], $this->user->settings->email_human);
$this->assertEquals($body['email_messages'], $this->user->settings->email_messages);
$this->assertEquals($body['email_goody'], $this->user->settings->email_goody);
$this->assertEquals($body['email_goodie'], $this->user->settings->email_goodie);
$this->assertEquals($body['shirt_size'], $this->user->personalData->shirt_size);
}
@ -221,12 +221,12 @@ class SettingsControllerTest extends ControllerTest
/**
* @covers \Engelsystem\Controllers\SettingsController::saveProfile
*/
public function testSaveProfileIgnoresEmailGoodyIfDisabled(): void
public function testSaveProfileIgnoresEmailGoodieIfDisabled(): void
{
$this->setUpProfileTest();
$this->config->set('goodie_type', GoodieType::None->value);
$this->controller->saveProfile($this->request);
$this->assertFalse($this->user->settings->email_goody);
$this->assertFalse($this->user->settings->email_goodie);
}
/**
@ -1124,7 +1124,7 @@ class SettingsControllerTest extends ControllerTest
->has(Settings::factory([
'theme' => 1,
'language' => 'en_US',
'email_goody' => false,
'email_goodie' => false,
'mobile_show' => false,
]))
->has(License::factory())