Skip to content

Commit

Permalink
fix(service): Changed out content warning to TryCatch
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeedyD authored Sep 7, 2024
1 parent 79448a9 commit ec06827
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,18 @@ public function disableTwoFactor($code, $user) {
* @param mixed $user
*/
public function updateContentWarningVisibility($data, $user) {
$user->settings->content_warning_visibility = $data;
$user->settings->save();
DB::beginTransaction();

return true;
try {
$user->settings->content_warning_visibility = $data;
$user->settings->save();

return $this->commitReturn(true);
} catch (\Exception $e) {
$this->setError('error', $e->getMessage());
}

return $this->rollbackReturn(false);
}

/**
Expand Down

0 comments on commit ec06827

Please sign in to comment.