Upload beautify

This commit is contained in:
2026-02-14 15:14:12 +01:00
parent e129618910
commit 79192345e3
249 changed files with 24436 additions and 1021 deletions

View File

@@ -40,6 +40,25 @@ class ArtworkPolicy
return false;
}
protected function isModerator(User $user): bool
{
foreach (['is_moderator', 'is_mod', 'moderator'] as $prop) {
if (isset($user->{$prop})) {
return (bool) $user->{$prop};
}
}
if (method_exists($user, 'hasRole')) {
return (bool) ($user->hasRole('moderator') || $user->hasRole('mod'));
}
if (method_exists($user, 'isModerator')) {
return (bool) $user->isModerator();
}
return false;
}
/**
* Public view: only approved + public + not-deleted artworks.
*/
@@ -64,6 +83,14 @@ class ArtworkPolicy
return $user->id === $artwork->user_id;
}
/**
* Tag edits: owner or moderator or admin (admin handled by before()).
*/
public function updateTags(User $user, Artwork $artwork): bool
{
return $user->id === $artwork->user_id || $this->isModerator($user);
}
/**
* Owner can delete their own artwork (soft delete).
*/