1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Send user/companyuser on update preferences

This commit is contained in:
David Bomba 2023-07-05 08:01:09 +10:00
parent e1d50eff70
commit 72fd21b69d
3 changed files with 9 additions and 2 deletions

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers;
use App\Models\User;
use App\Models\CompanyUser;
use Illuminate\Http\Response;
use App\Transformers\UserTransformer;
use App\Transformers\CompanyUserTransformer;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use App\Http\Requests\CompanyUser\UpdateCompanyUserRequest;
@ -134,6 +135,7 @@ class CompanyUserController extends BaseController
public function updatePreferences(UpdateCompanyUserPreferencesRequest $request, User $user)
{
/** @var \App\Models\User $logged_in_user */
$company = auth()->user()->company();
$company_user = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->first();
@ -143,10 +145,14 @@ class CompanyUserController extends BaseController
return;
}
$this->entity_type = User::class;
$this->entity_transformer = UserTransformer::class;
$company_user->react_settings = $request->react_settings;
$company_user->save();
return $this->itemResponse($company_user->fresh());
return $this->itemResponse($user->fresh());
}

View File

@ -175,6 +175,7 @@ class UserController extends BaseController
$user->oauth_user_refresh_token = null;
$user->oauth_user_token = null;
$user->save();
UserEmailChanged::dispatch($new_user, json_decode($old_user), $logged_in_user->company());
}

View File

@ -2260,7 +2260,7 @@ $LANG = array(
'restore_recurring_expense' => 'Restore Recurring Expense',
'restored_recurring_expense' => 'Successfully restored recurring expense',
'delete_recurring_expense' => 'Delete Recurring Expense',
'deleted_recurring_expense' => 'Successfully deleted project',
'deleted_recurring_expense' => 'Successfully deleted recurring expense',
'view_recurring_expense' => 'View Recurring Expense',
'taxes_and_fees' => 'Taxes and fees',
'import_failed' => 'Import Failed',