api(server): log activity when server description is changed
This commit is contained in:
parent
634c9353e3
commit
039ad4abf0
2 changed files with 14 additions and 6 deletions
|
@ -34,14 +34,22 @@ class SettingsController extends ClientApiController
|
|||
*/
|
||||
public function rename(RenameServerRequest $request, Server $server): JsonResponse
|
||||
{
|
||||
$name = $request->input('name');
|
||||
$description = $request->input('description') ?? '';
|
||||
$this->repository->update($server->id, [
|
||||
'name' => $request->input('name'),
|
||||
'description' => $request->input('description') ?? '',
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
]);
|
||||
|
||||
if ($server->name !== $request->input('name')) {
|
||||
if ($server->name !== $name) {
|
||||
Activity::event('server:settings.rename')
|
||||
->property(['old' => $server->name, 'new' => $request->input('name')])
|
||||
->property(['old' => $server->name, 'new' => $name])
|
||||
->log();
|
||||
}
|
||||
|
||||
if ($server->description !== $description) {
|
||||
Activity::event('server:settings.description')
|
||||
->property(['old' => $server->description, 'new' => $description])
|
||||
->log();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class ActivityLogService
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets a custom property on the activty log instance.
|
||||
* Sets a custom property on the activity log instance.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
|
@ -115,7 +115,7 @@ class ActivityLogService
|
|||
}
|
||||
|
||||
/**
|
||||
* Attachs the instance request metadata to the activity log event.
|
||||
* Attaches the instance request metadata to the activity log event.
|
||||
*/
|
||||
public function withRequestMetadata(): self
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue