This commit is contained in:
@@ -39,6 +39,7 @@ final class ProfileSettings
|
||||
'avatar_head_shape' => "ALTER TABLE user_profiles ADD COLUMN avatar_head_shape VARCHAR(24) NOT NULL DEFAULT 'round' AFTER avatar_glasses_style",
|
||||
'avatar_hat_style' => "ALTER TABLE user_profiles ADD COLUMN avatar_hat_style VARCHAR(24) NOT NULL DEFAULT 'none' AFTER avatar_head_shape",
|
||||
'avatar_hat_color' => "ALTER TABLE user_profiles ADD COLUMN avatar_hat_color VARCHAR(24) NOT NULL DEFAULT 'navy' AFTER avatar_hat_style",
|
||||
'avatar_outfit_style' => "ALTER TABLE user_profiles ADD COLUMN avatar_outfit_style VARCHAR(24) NOT NULL DEFAULT 'tee' AFTER avatar_hat_color",
|
||||
'avatar_outfit_color' => "ALTER TABLE user_profiles ADD COLUMN avatar_outfit_color VARCHAR(24) NOT NULL DEFAULT 'slate' AFTER avatar_hat_color",
|
||||
];
|
||||
foreach ($avatarColumns as $column => $sql) {
|
||||
@@ -86,27 +87,11 @@ final class ProfileSettings
|
||||
}
|
||||
|
||||
$this->ensureSchema();
|
||||
$preset = (string)($avatarConfig['avatar_preset'] ?? '');
|
||||
if ($preset !== '') {
|
||||
$options = Avatar::presetOptions();
|
||||
$preset = array_key_exists($preset, $options) ? $preset : 'modern_01';
|
||||
$stmt = $this->pdo->prepare(
|
||||
'UPDATE user_profiles
|
||||
SET avatar_preset = :preset,
|
||||
updated_at = NOW()
|
||||
WHERE user_id = :id'
|
||||
);
|
||||
$stmt->execute([
|
||||
'preset' => $preset,
|
||||
'id' => $userId,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$avatar = Avatar::normalize($avatarConfig);
|
||||
$stmt = $this->pdo->prepare(
|
||||
'UPDATE user_profiles
|
||||
SET avatar_skin_tone = :skin,
|
||||
SET avatar_preset = :preset,
|
||||
avatar_skin_tone = :skin,
|
||||
avatar_hair_style = :hairStyle,
|
||||
avatar_hair_color = :hairColor,
|
||||
avatar_eye_color = :eyeColor,
|
||||
@@ -115,11 +100,13 @@ final class ProfileSettings
|
||||
avatar_head_shape = :headShape,
|
||||
avatar_hat_style = :hatStyle,
|
||||
avatar_hat_color = :hatColor,
|
||||
avatar_outfit_style = :outfitStyle,
|
||||
avatar_outfit_color = :outfitColor,
|
||||
updated_at = NOW()
|
||||
WHERE user_id = :id'
|
||||
);
|
||||
$stmt->execute([
|
||||
'preset' => $avatar['avatar_preset'],
|
||||
'skin' => $avatar['avatar_skin_tone'],
|
||||
'hairStyle' => $avatar['avatar_hair_style'],
|
||||
'hairColor' => $avatar['avatar_hair_color'],
|
||||
@@ -129,6 +116,7 @@ final class ProfileSettings
|
||||
'headShape' => $avatar['avatar_head_shape'],
|
||||
'hatStyle' => $avatar['avatar_hat_style'],
|
||||
'hatColor' => $avatar['avatar_hat_color'],
|
||||
'outfitStyle' => $avatar['avatar_outfit_style'],
|
||||
'outfitColor' => $avatar['avatar_outfit_color'],
|
||||
'id' => $userId,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user