Skip to content

Commit

Permalink
fix(settings): allow users to wipe their motto values
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland committed Sep 6, 2024
1 parent a8043da commit 95bad98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Community/Data/UpdateProfileData.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public static function fromRequest(UpdateProfileRequest $request): self
$user = $request->user();

return new self(
motto: $request->motto ?? $user->Motto,
userWallActive: $request->userWallActive ?? $user->UserWallActive,
motto: $request->motto,
userWallActive: $request->userWallActive,
);
}

Expand Down
7 changes: 7 additions & 0 deletions app/Community/Requests/UpdateProfileRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ public function rules(): array
'userWallActive' => 'nullable|boolean',
];
}

protected function prepareForValidation(): void
{
$this->merge([
'motto' => $this->input('motto') ?? '', // Don't cast empty strings to null.
]);
}
}

0 comments on commit 95bad98

Please sign in to comment.