diff --git a/app/Http/Controllers/Api/Client/ActivityLogController.php b/app/Http/Controllers/Api/Client/ActivityLogController.php index 9e1fcc63d..dbbd06c06 100644 --- a/app/Http/Controllers/Api/Client/ActivityLogController.php +++ b/app/Http/Controllers/Api/Client/ActivityLogController.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Http\Controllers\Api\Client; +use Pterodactyl\Models\ActivityLog; use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\AllowedFilter; use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest; @@ -18,6 +19,7 @@ class ActivityLogController extends ClientApiController ->with('actor') ->allowedFilters([AllowedFilter::partial('event')]) ->allowedSorts(['timestamp']) + ->whereNotIn('activity_logs.event', ActivityLog::DISABLED_EVENTS) ->paginate(min($request->query('per_page', 25), 100)) ->appends($request->query()); diff --git a/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php b/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php index adfb3ad7e..f569c4122 100644 --- a/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php +++ b/app/Http/Controllers/Api/Client/Servers/ActivityLogController.php @@ -5,6 +5,7 @@ namespace Pterodactyl\Http\Controllers\Api\Client\Servers; use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\Permission; +use Pterodactyl\Models\ActivityLog; use Spatie\QueryBuilder\QueryBuilder; use Spatie\QueryBuilder\AllowedFilter; use Illuminate\Database\Eloquent\Builder; @@ -26,6 +27,7 @@ class ActivityLogController extends ClientApiController ->with('actor') ->allowedSorts(['timestamp']) ->allowedFilters([AllowedFilter::partial('event')]) + ->whereNotIn('activity_logs.event', ActivityLog::DISABLED_EVENTS) ->when(config('activity.hide_admin_activity'), function (Builder $builder) use ($server) { // We could do this with a query and a lot of joins, but that gets pretty // painful so for now we'll execute a simpler query. diff --git a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php index 1701bb0ca..710315bdd 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileUploadController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileUploadController.php @@ -6,7 +6,6 @@ use Carbon\CarbonImmutable; use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Illuminate\Http\JsonResponse; -use Pterodactyl\Facades\Activity; use Pterodactyl\Services\Nodes\NodeJWTService; use Pterodactyl\Http\Controllers\Api\Client\ClientApiController; use Pterodactyl\Http\Requests\Api\Client\Servers\Files\UploadFileRequest; @@ -36,8 +35,6 @@ class FileUploadController extends ClientApiController */ public function __invoke(UploadFileRequest $request, Server $server) { - Activity::event('server:file.upload')->log(); - return new JsonResponse([ 'object' => 'signed_url', 'attributes' => [ diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index bfe324ad7..36987c167 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -53,6 +53,12 @@ class ActivityLog extends Model public const RESOURCE_NAME = 'activity_log'; + /** + * Tracks all of the events we no longer wish to display to users. These are either legacy + * events or just events where we never ended up using the associated data. + */ + public const DISABLED_EVENTS = ['server:file.upload']; + public $timestamps = false; protected $guarded = [ diff --git a/resources/lang/en/activity.php b/resources/lang/en/activity.php index ce567cbb9..f6d3ac288 100644 --- a/resources/lang/en/activity.php +++ b/resources/lang/en/activity.php @@ -81,6 +81,7 @@ return [ 'rename_other' => 'Renamed :count files in :directory', 'write' => 'Wrote new content to :file', 'upload' => 'Began a file upload', + 'uploaded' => 'Uploaded :file in :directory', ], 'sftp' => [ 'denied' => 'Blocked SFTP access due to permissions',