Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Services\Moderation\Rules;
use App\Contracts\Moderation\ModerationRuleInterface;
use App\Enums\ModerationContentType;
use App\Models\ArtworkComment;
class DuplicateCommentRule implements ModerationRuleInterface
{
public function analyze(string $content, string $normalized, array $context = []): array
{
if (($context['content_type'] ?? null) !== ModerationContentType::ArtworkComment->value) {
return [];
}
$contentId = (int) ($context['content_id'] ?? 0);
if ($contentId <= 0 || $normalized === '') {
return [];
}
$duplicates = ArtworkComment::query()
->where('id', '!=', $contentId)
->whereNull('deleted_at')
->whereRaw('LOWER(TRIM(COALESCE(raw_content, content))) = ?', [$normalized])
->count();
if ($duplicates < 1) {
return [];
}
return [[
'rule' => 'duplicate_comment',
'score' => app('config')->get('content_moderation.weights.duplicate_comment', 35),
'reason' => 'Matches ' . $duplicates . ' existing comment(s) exactly',
'links' => [],
'domains' => [],
'keywords' => [],
]];
}
}