fix: chat accepts quotes now

This commit is contained in:
Krispire Admin
2026-08-29 11:58:20 +05:30
parent d50031cdb3
commit 18bac9a22d
6 changed files with 186 additions and 4 deletions
@@ -0,0 +1,8 @@
-- Rows of the new kind must go before the old constraint can be restored.
DELETE FROM message_attachments WHERE kind = 'quote';
ALTER TABLE message_attachments DROP CONSTRAINT IF EXISTS message_attachments_kind_check;
ALTER TABLE message_attachments
ADD CONSTRAINT message_attachments_kind_check
CHECK (kind IN ('image', 'video', 'audio', 'file', 'link', 'entity'));
+18
View File
@@ -0,0 +1,18 @@
-- A shared passage from the library, sent into a chat.
--
-- Modelled as an attachment rather than message text so it can be rendered as
-- a quote and navigated back to. It reuses the columns the link card already
-- has, since the shape is the same thing said differently:
--
-- url → the ?hl= deep link back to the exact phrase
-- title → the source reference ("Bhagavad-gītā 2.13")
-- description → the quoted passage itself
--
-- It is a distinct kind rather than a 'link' because it renders as a quote,
-- not a preview card, and because its URL is always our own — the service
-- refuses any other origin.
ALTER TABLE message_attachments DROP CONSTRAINT IF EXISTS message_attachments_kind_check;
ALTER TABLE message_attachments
ADD CONSTRAINT message_attachments_kind_check
CHECK (kind IN ('image', 'video', 'audio', 'file', 'link', 'entity', 'quote'));