Applied StyleCI changes

This commit is contained in:
Dan Brown
2021-09-29 23:53:11 +01:00
parent 025442fcd9
commit 505d7e604e
3 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,6 @@ use BookStack\Interfaces\Loggable;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Request;
class ActivityService class ActivityService
{ {
@ -57,6 +56,7 @@ class ActivityService
protected function newActivityForUser(string $type): Activity protected function newActivityForUser(string $type): Activity
{ {
$ip = request()->ip() ?? ''; $ip = request()->ip() ?? '';
return $this->activity->newInstance()->forceFill([ return $this->activity->newInstance()->forceFill([
'type' => strtolower($type), 'type' => strtolower($type),
'user_id' => user()->id, 'user_id' => user()->id,

View File

@ -642,7 +642,7 @@ class PermissionService
$query->whereExists(function ($permissionQuery) use (&$tableDetails, $morphClass) { $query->whereExists(function ($permissionQuery) use (&$tableDetails, $morphClass) {
/** @var Builder $permissionQuery */ /** @var Builder $permissionQuery */
$permissionQuery->select('id')->from('joint_permissions') $permissionQuery->select('id')->from('joint_permissions')
->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn']) ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])
->where('entity_type', '=', $morphClass) ->where('entity_type', '=', $morphClass)
->where('action', '=', 'view') ->where('action', '=', 'view')
->whereIn('role_id', $this->getCurrentUserRoles()) ->whereIn('role_id', $this->getCurrentUserRoles())

View File

@ -152,13 +152,13 @@ class AuditLogTest extends TestCase
'name' => 'Updated page', 'name' => 'Updated page',
'html' => '<p>Updated content</p>', 'html' => '<p>Updated content</p>',
], [ ], [
'X-Forwarded-For' => '192.123.45.1' 'X-Forwarded-For' => '192.123.45.1',
])->assertRedirect($page->refresh()->getUrl()); ])->assertRedirect($page->refresh()->getUrl());
$this->assertDatabaseHas('activities', [ $this->assertDatabaseHas('activities', [
'type' => ActivityType::PAGE_UPDATE, 'type' => ActivityType::PAGE_UPDATE,
'ip' => '192.123.45.1', 'ip' => '192.123.45.1',
'user_id' => $editor->id, 'user_id' => $editor->id,
'entity_id' => $page->id, 'entity_id' => $page->id,
]); ]);
@ -179,13 +179,13 @@ class AuditLogTest extends TestCase
'html' => '<p>Updated content</p>', 'html' => '<p>Updated content</p>',
], [ ], [
'X-Forwarded-For' => '192.123.45.1', 'X-Forwarded-For' => '192.123.45.1',
'REMOTE_ADDR' => '192.123.45.2', 'REMOTE_ADDR' => '192.123.45.2',
])->assertRedirect($page->refresh()->getUrl()); ])->assertRedirect($page->refresh()->getUrl());
$this->assertDatabaseHas('activities', [ $this->assertDatabaseHas('activities', [
'type' => ActivityType::PAGE_UPDATE, 'type' => ActivityType::PAGE_UPDATE,
'ip' => '127.0.0.1', 'ip' => '127.0.0.1',
'user_id' => $editor->id, 'user_id' => $editor->id,
'entity_id' => $page->id, 'entity_id' => $page->id,
]); ]);
} }