feat: artwork page carousels, recommendations, avatars & fixes
- Infinite loop carousels for Similar Artworks & Trending rails
- Mouse wheel horizontal scrolling on both carousels
- Author avatar shown on hover in RailCard (similar + trending)
- Removed "View" badge from RailCard hover overlay
- Added `id` to Meilisearch filterable attributes
- Auto-prepend Scout prefix in meilisearch:configure-index command
- Added author name + avatar to Similar Artworks API response
- Added avatar_url to ArtworkListResource author object
- Added direct /art/{id}/{slug} URL to ArtworkListResource
- Fixed race condition: Similar Artworks no longer briefly shows trending items
- Fixed user_profiles eager load (user_id primary key, not id)
- Bumped /api/art/{id}/similar rate limit to 300/min
- Removed decorative heart icons from tag pills
- Moved ReactionBar under artwork description
This commit is contained in:
11
scripts/check_col_charset.php
Normal file
11
scripts/check_col_charset.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
|
||||
$rows = \Illuminate\Support\Facades\DB::select("SHOW FULL COLUMNS FROM artwork_comments");
|
||||
foreach ($rows as $r) {
|
||||
if (in_array($r->Field, ['content', 'raw_content', 'rendered_content'])) {
|
||||
echo $r->Field . ' => type=' . $r->Type . ' collation=' . ($r->Collation ?? 'NULL') . PHP_EOL;
|
||||
}
|
||||
}
|
||||
33
scripts/check_reply_tree.php
Normal file
33
scripts/check_reply_tree.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
|
||||
$rows = App\Models\ArtworkComment::where('artwork_id', 10)
|
||||
->whereNotNull('parent_id')
|
||||
->select('id', 'parent_id', 'content')
|
||||
->orderByDesc('id')
|
||||
->limit(15)
|
||||
->get();
|
||||
|
||||
foreach ($rows as $r) {
|
||||
echo "id={$r->id} parent_id={$r->parent_id} content=" . mb_substr($r->content, 0, 40) . PHP_EOL;
|
||||
}
|
||||
|
||||
echo "\n--- Tree test (recursive eager-load) ---\n";
|
||||
$top = App\Models\ArtworkComment::with(['approvedReplies'])
|
||||
->where('id', 175742)
|
||||
->get();
|
||||
|
||||
function printTree($comments, $indent = 0) {
|
||||
foreach ($comments as $c) {
|
||||
$prefix = str_repeat(' ', $indent);
|
||||
$replies = $c->relationLoaded('approvedReplies') ? $c->approvedReplies : collect();
|
||||
echo "{$prefix}[{$c->id}] " . mb_substr($c->content, 0, 40) . " ({$replies->count()} replies)\n";
|
||||
if ($replies->count()) {
|
||||
printTree($replies, $indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printTree($top);
|
||||
38
scripts/rerender_comments.php
Normal file
38
scripts/rerender_comments.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
|
||||
use App\Models\ArtworkComment;
|
||||
use App\Services\ContentSanitizer;
|
||||
|
||||
// Test on a single comment first
|
||||
$c = ArtworkComment::find(175742);
|
||||
if (!$c) { echo "Comment not found\n"; exit(1); }
|
||||
|
||||
echo "raw_content: " . $c->raw_content . PHP_EOL;
|
||||
echo "old rendered: " . $c->rendered_content . PHP_EOL;
|
||||
|
||||
$new = ContentSanitizer::render($c->raw_content);
|
||||
echo "new rendered: " . $new . PHP_EOL;
|
||||
|
||||
// Now re-render all
|
||||
$count = 0;
|
||||
$errors = 0;
|
||||
ArtworkComment::whereNotNull('raw_content')
|
||||
->where('raw_content', '!=', '')
|
||||
->chunk(100, function ($comments) use (&$count, &$errors) {
|
||||
foreach ($comments as $c) {
|
||||
try {
|
||||
$c->rendered_content = ContentSanitizer::render($c->raw_content);
|
||||
$c->timestamps = false;
|
||||
$c->saveQuietly();
|
||||
$count++;
|
||||
} catch (\Throwable $e) {
|
||||
$errors++;
|
||||
echo "Error on comment #{$c->id}: " . $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
echo "Re-rendered {$count} comments ({$errors} errors)." . PHP_EOL;
|
||||
Reference in New Issue
Block a user