fix: edit history 'after' showed original content, not edited content
getRecentEdits SELECT ... m.content AS new_content returned the message's ORIGINAL content (never updated on edit) instead of the post-edit content. messages.content stores the original body; the current/last-edited body lives in messages.edited_content. So before===after in the Message Edits diff. Fix: COALESCE(m.edited_content, m.content) AS new_content so 'After' shows the edited text and diffs against the captured before-content are meaningful.
This commit is contained in:
@@ -503,7 +503,7 @@ export class MessagesRepository {
|
|||||||
m.channel_id,
|
m.channel_id,
|
||||||
COALESCE(NULLIF((m.metadata::jsonb -> 'channel' ->> 'channelName'), ''), m.channel_id) AS channel_name,
|
COALESCE(NULLIF((m.metadata::jsonb -> 'channel' ->> 'channelName'), ''), m.channel_id) AS channel_name,
|
||||||
m.username,
|
m.username,
|
||||||
m.content AS new_content
|
COALESCE(m.edited_content, m.content) AS new_content
|
||||||
FROM message_edits e
|
FROM message_edits e
|
||||||
JOIN messages m ON m.id = e.message_id
|
JOIN messages m ON m.id = e.message_id
|
||||||
${channelId ? sql`WHERE m.channel_id = ${channelId}` : sql``}
|
${channelId ? sql`WHERE m.channel_id = ${channelId}` : sql``}
|
||||||
|
|||||||
Reference in New Issue
Block a user