v3: fixed roles propagation bug, fixed inconsistent file drop zone, fixed chat attachments wrongfully pruned, some visual tweaks
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
type ChatMessage,
|
||||
} from "../model/interfaces.ts";
|
||||
import { chatMessageRowToApi, db, isChatMessageRow } from "../model/db.ts";
|
||||
import { linkAttachments } from "./attachment-service.ts";
|
||||
|
||||
export const MAX_CHAT_LENGTH = 2000;
|
||||
const DEFAULT_LIMIT = 50;
|
||||
@@ -70,6 +71,9 @@ export function createChatMessage(
|
||||
db.prepare(
|
||||
`INSERT INTO chat_messages (id, user_id, body, created_at, reply_to_id) VALUES (?, ?, ?, ?, ?);`,
|
||||
).run(id, userId, trimmed, createdAt, replyTo);
|
||||
// Claim any pasted/dropped image attachments so the startup cleanup doesn't
|
||||
// purge them as orphans (mirrors dumps/comments/playlists).
|
||||
linkAttachments(trimmed, id);
|
||||
return fetchMessage(id);
|
||||
}
|
||||
|
||||
@@ -115,6 +119,8 @@ export function updateChatMessage(
|
||||
}
|
||||
db.prepare(`UPDATE chat_messages SET body = ?, updated_at = ? WHERE id = ?;`)
|
||||
.run(trimmed, new Date().toISOString(), id);
|
||||
// An edit may introduce a freshly pasted image; claim its attachment too.
|
||||
linkAttachments(trimmed, id);
|
||||
return fetchMessage(id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user