mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Merge remote-tracking branch 'origin/main' into origin/next
# Conflicts: # app/Livewire/Dashboard.php # app/Livewire/Dashboard/ActiveDeployments.php # resources/views/livewire/team/member.blade.php # tests/Feature/Security/PrivateKeyServerLookupTest.php
This commit is contained in:
@@ -28,11 +28,11 @@ class AvatarStorageService
|
||||
$oldS3StorageId = $user->avatar_s3_storage_id;
|
||||
$oldPath = $user->avatar_path;
|
||||
|
||||
$user->update([
|
||||
$user->fill([
|
||||
'avatar_path' => $path,
|
||||
'avatar_storage_type' => $storageType,
|
||||
'avatar_s3_storage_id' => $s3StorageId,
|
||||
]);
|
||||
])->touch();
|
||||
|
||||
if ($oldPath && ($oldStorageType !== $storageType || $oldS3StorageId !== $s3StorageId)) {
|
||||
$this->disk($oldStorageType ?? 'local', $oldS3StorageId)->delete($oldPath);
|
||||
|
||||
@@ -28,7 +28,7 @@ class TeamAvatarStorageService extends AvatarStorageService
|
||||
'avatar_path' => $path,
|
||||
'avatar_storage_type' => $storageType,
|
||||
'avatar_s3_storage_id' => $s3StorageId,
|
||||
])->save();
|
||||
])->touch();
|
||||
|
||||
if ($oldPath && ($oldStorageType !== $storageType || $oldS3StorageId !== $s3StorageId)) {
|
||||
$this->disk($oldStorageType ?? 'local', $oldS3StorageId)->delete($oldPath);
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
'name' => $server->name,
|
||||
'description' => $server->description,
|
||||
'href' => route('server.show', ['server_uuid' => $server->uuid]),
|
||||
'patchesHref' => route('server.security.patches', ['server_uuid' => $server->uuid]),
|
||||
'status' => $status,
|
||||
'statusType' => $statusType,
|
||||
'resourceCount' => $server->definedResources()->count(),
|
||||
@@ -91,6 +92,9 @@
|
||||
.some(value => String(value || '').toLowerCase().includes(query))
|
||||
);
|
||||
},
|
||||
openPatches(url) {
|
||||
window.Livewire.navigate(url);
|
||||
},
|
||||
setViewMode(mode) {
|
||||
this.viewMode = mode;
|
||||
this.$wire.saveListView('servers', mode);
|
||||
@@ -167,7 +171,10 @@
|
||||
$cardPatchBadges = array_filter($serverRow['patchBadges'], fn ($badge) => $badge['type'] !== 'success');
|
||||
@endphp
|
||||
@if ($cardPatchBadges !== [])
|
||||
<div class="relative z-10 mt-auto flex flex-wrap gap-1.5 pt-3"
|
||||
<div class="relative z-10 mt-auto flex cursor-pointer flex-wrap gap-1.5 pt-3"
|
||||
role="link" tabindex="0" aria-label="Open patches"
|
||||
@click.prevent.stop="openPatches(@js($serverRow['patchesHref']))"
|
||||
@keydown.enter.prevent.stop="openPatches(@js($serverRow['patchesHref']))"
|
||||
data-tooltip="{{ $serverRow['patchCheckedAt'] }}">
|
||||
@foreach ($cardPatchBadges as $badge)
|
||||
<x-status-badge :status="$badge['label']" :type="$badge['type']" />
|
||||
@@ -222,7 +229,10 @@
|
||||
</span>
|
||||
</div>
|
||||
@if ($showPatches)
|
||||
<div class="hidden flex-wrap gap-1 lg:flex" :data-tooltip="server.patchCheckedAt">
|
||||
<div class="hidden cursor-pointer flex-wrap gap-1 lg:flex" :data-tooltip="server.patchCheckedAt"
|
||||
role="link" tabindex="0" aria-label="Open patches"
|
||||
@click.prevent.stop="openPatches(server.patchesHref)"
|
||||
@keydown.enter.prevent.stop="openPatches(server.patchesHref)">
|
||||
<template x-for="badge in server.patchBadges" :key="badge.label">
|
||||
<x-status-badge :dynamic="true">
|
||||
<span class="relative inline-flex size-1.5 shrink-0 rounded-full"
|
||||
|
||||
@@ -47,6 +47,21 @@ it('compresses and stores an uploaded profile picture on the configured local st
|
||||
->and(Storage::disk('images')->size($user->avatar_path))->toBeLessThan(100_000);
|
||||
})->skip(! extension_loaded('gd'), 'Requires the GD extension to generate and compress the test image.');
|
||||
|
||||
it('changes the profile picture URL when an existing picture is replaced', function () {
|
||||
Storage::fake('images');
|
||||
$user = User::factory()->create();
|
||||
$this->actingAs($user);
|
||||
$upload = fn () => UploadedFile::fake()->createWithContent('avatar.jpg', file_get_contents(base_path('tests/Fixtures/project-icon.jpg')));
|
||||
|
||||
app(AvatarStorageService::class)->store($user, $upload());
|
||||
$oldUrl = profile_avatar_url($user->fresh());
|
||||
|
||||
$this->travel(1)->minutes();
|
||||
app(AvatarStorageService::class)->store($user->fresh(), $upload());
|
||||
|
||||
expect(profile_avatar_url($user->fresh()))->not->toBe($oldUrl);
|
||||
});
|
||||
|
||||
it('stores an already compressed browser JPEG without server image extensions', function () {
|
||||
Storage::fake('images');
|
||||
$user = User::factory()->create(['name' => 'Test User']);
|
||||
|
||||
@@ -29,7 +29,7 @@ beforeEach(function () {
|
||||
function giveTeamStoredAvatar(Team $team): string
|
||||
{
|
||||
$path = "team-avatars/{$team->id}/avatar.jpg";
|
||||
$team->forceFill(['avatar_path' => $path, 'avatar_storage_type' => 'local'])->save();
|
||||
$team->forceFill(['avatar_path' => $path, 'avatar_storage_type' => 'local'])->saveQuietly();
|
||||
Storage::disk('images')->put($path, 'avatar-content');
|
||||
|
||||
return $path;
|
||||
@@ -53,6 +53,22 @@ it('stores a team avatar using the instance image storage setting', function ()
|
||||
Storage::disk('images')->assertExists($this->team->avatar_path);
|
||||
});
|
||||
|
||||
it('changes the team avatar URL when an existing avatar is replaced', function () {
|
||||
Storage::fake('images');
|
||||
giveTeamStoredAvatar($this->team);
|
||||
$oldUrl = team_avatar_url($this->team->fresh());
|
||||
$upload = UploadedFile::fake()->createWithContent('team.jpg', file_get_contents(base_path('tests/Fixtures/project-icon.jpg')));
|
||||
|
||||
$this->travel(1)->minutes();
|
||||
|
||||
Livewire::test(Index::class)
|
||||
->set('avatar', $upload)
|
||||
->call('uploadAvatar')
|
||||
->assertHasNoErrors();
|
||||
|
||||
expect(team_avatar_url($this->team->fresh()))->not->toBe($oldUrl);
|
||||
});
|
||||
|
||||
it('does not let a team member change the team avatar', function () {
|
||||
Storage::fake('images');
|
||||
$path = giveTeamStoredAvatar($this->team);
|
||||
@@ -123,7 +139,7 @@ it('deletes the avatar file when the team is deleted', function () {
|
||||
it('shows team avatars in the team switcher', function () {
|
||||
$otherTeam = Team::factory()->create(['name' => 'Zeta']);
|
||||
$this->user->teams()->attach($otherTeam, ['role' => 'member']);
|
||||
$otherTeam->forceFill(['avatar_path' => "team-avatars/{$otherTeam->id}/avatar.jpg", 'avatar_storage_type' => 'local'])->save();
|
||||
$otherTeam->forceFill(['avatar_path' => "team-avatars/{$otherTeam->id}/avatar.jpg", 'avatar_storage_type' => 'local'])->saveQuietly();
|
||||
$this->user->load('teams');
|
||||
|
||||
Livewire::test(SwitchTeam::class)
|
||||
|
||||
Reference in New Issue
Block a user