v3: allow users to edit dump thumbnail, fixed some linter errors in the frontend
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 40s

This commit is contained in:
khannurien
2026-06-21 19:37:47 +00:00
parent cf988ae608
commit d038116de5
4 changed files with 32 additions and 13 deletions

View File

@@ -24,7 +24,7 @@ import {
// Mirrors dump-service SELECT_COLS_ALIASED — kept local to avoid circular imports // Mirrors dump-service SELECT_COLS_ALIASED — kept local to avoid circular imports
const SELECT_COLS_ALIASED = const SELECT_COLS_ALIASED =
"d.id, d.kind, d.title, d.slug, d.comment, d.user_id, d.created_at, d.updated_at, d.url, d.rich_content, " + "d.id, d.kind, d.title, d.slug, d.comment, d.user_id, d.created_at, d.updated_at, d.url, d.rich_content, " +
"d.file_name, d.file_mime, d.file_size, d.vote_count, d.is_private," + "d.file_name, d.file_mime, d.file_size, d.vote_count, d.is_private, d.custom_thumbnail_mime," +
" (SELECT COUNT(*) FROM comments WHERE dump_id = d.id AND deleted = 0) as comment_count"; " (SELECT COUNT(*) FROM comments WHERE dump_id = d.id AND deleted = 0) as comment_count";
// ── Follow / unfollow a user ────────────────────────────────────────────────── // ── Follow / unfollow a user ──────────────────────────────────────────────────

View File

@@ -29,7 +29,7 @@ import { makeSlug, UUID_RE } from "../lib/slugify.ts";
import { linkAttachments } from "./attachment-service.ts"; import { linkAttachments } from "./attachment-service.ts";
const DUMP_SELECT_COLS = const DUMP_SELECT_COLS =
"id, kind, title, slug, comment, user_id, created_at, updated_at, url, rich_content, file_name, file_mime, file_size, vote_count, is_private"; "id, kind, title, slug, comment, user_id, created_at, updated_at, url, rich_content, file_name, file_mime, file_size, vote_count, is_private, custom_thumbnail_mime";
const PLAYLIST_SELECT = `p.*, u.username as owner_username, const PLAYLIST_SELECT = `p.*, u.username as owner_username,
(SELECT COUNT(*) FROM playlist_dumps pd WHERE pd.playlist_id = p.id) as dump_count (SELECT COUNT(*) FROM playlist_dumps pd WHERE pd.playlist_id = p.id) as dump_count

View File

@@ -3753,6 +3753,23 @@ body.has-player .fab-new {
cursor: default; cursor: default;
} }
.comment-cancel-btn {
background: transparent;
border: 1.5px solid var(--color-border-subtle);
border-radius: 6px;
padding: 0.4rem 1rem;
font-family: inherit;
font-size: 0.82rem;
color: var(--color-text);
opacity: 0.6;
cursor: pointer;
transition: opacity 0.15s;
}
.comment-cancel-btn:hover {
opacity: 1;
}
.comment-node-inner--deleted { .comment-node-inner--deleted {
opacity: 0.35; opacity: 0.35;
} }

View File

@@ -276,7 +276,7 @@ function CommentNode({
</button> </button>
<button <button
type="button" type="button"
className="comment-action-btn" className="comment-cancel-btn"
onClick={() => { onClick={() => {
setEditOpen(false); setEditOpen(false);
setEditBody(""); setEditBody("");
@@ -290,14 +290,16 @@ function CommentNode({
) )
: <Markdown className="comment-body">{comment.body}</Markdown>} : <Markdown className="comment-body">{comment.body}</Markdown>}
<div className="comment-actions"> <div className="comment-actions">
<LikeButton {!editOpen && (
commentId={comment.id} <LikeButton
count={likeCounts[comment.id] ?? comment.likeCount} commentId={comment.id}
liked={myLikes.has(comment.id)} count={likeCounts[comment.id] ?? comment.likeCount}
disabled={!currentUser} liked={myLikes.has(comment.id)}
onLike={castCommentLike} disabled={!currentUser}
onUnlike={removeCommentLike} onLike={castCommentLike}
/> onUnlike={removeCommentLike}
/>
)}
{currentUser && !editOpen && ( {currentUser && !editOpen && (
<button <button
type="button" type="button"
@@ -376,7 +378,7 @@ function CommentNode({
</button> </button>
<button <button
type="button" type="button"
className="comment-action-btn" className="comment-cancel-btn"
onClick={() => { onClick={() => {
setReplyOpen(false); setReplyOpen(false);
setReplyBody(""); setReplyBody("");
@@ -514,7 +516,7 @@ export function CommentThread({
{topLevelBody.trim() && ( {topLevelBody.trim() && (
<button <button
type="button" type="button"
className="comment-action-btn" className="comment-cancel-btn"
onClick={() => { onClick={() => {
setTopLevelBody(""); setTopLevelBody("");
setTopLevelError(null); setTopLevelError(null);