Skip to content

Commit

Permalink
Fix Invalid text representation error on PostgreSQL when saving mailb…
Browse files Browse the repository at this point in the history
…ox permissions - closes freescout-help-desk#3315
  • Loading branch information
freescout-help-desk authored and totake0224 committed Sep 4, 2023
1 parent 5efbaf1 commit c30b50b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/CustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function permissionsSave($id, Request $request)
$user = User::findOrFail($id);
$this->authorize('update', $user);

$user->mailboxes()->sync($request->mailboxes);
$user->mailboxes()->sync($request->mailboxes ?: []);

\Session::flash('flash_success', __('Permissions saved successfully'));

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/MailboxesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function createSave(Request $request)

$mailbox->save();

$mailbox->users()->sync($request->users);
$mailbox->users()->sync($request->users ?: []);
$mailbox->syncPersonalFolders($request->users);

\Session::flash('flash_success_floating', __('Mailbox created successfully'));
Expand Down Expand Up @@ -269,7 +269,7 @@ public function permissionsSave($id, Request $request)

$user = auth()->user();

$mailbox->users()->sync(\Eventy::filter('mailbox.permission_users', $request->users, $id));
$mailbox->users()->sync(\Eventy::filter('mailbox.permission_users', $request->users, $id) ?: []);
$mailbox->syncPersonalFolders($request->users);

// Save admins settings.
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function createSave(Request $request)
$user = \Eventy::filter('user.create_save', $user, $request);
$user->save();

$user->mailboxes()->sync($request->mailboxes);
$user->mailboxes()->sync($request->mailboxes ?: []);
$user->syncPersonalFolders($request->mailboxes);

// Send invite
Expand Down Expand Up @@ -286,7 +286,7 @@ public function permissionsSave($id, Request $request)

$user = User::findOrFail($id);

$user->mailboxes()->sync($request->mailboxes);
$user->mailboxes()->sync($request->mailboxes ?: []);
$user->syncPersonalFolders($request->mailboxes);

// Save permissions.
Expand Down

0 comments on commit c30b50b

Please sign in to comment.