From 232159c0ad40831d1a0e77f9989852d4933039ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85strand?= Date: Wed, 17 Dec 2025 21:10:07 +0100 Subject: [PATCH] Add attached patches to message view Also let the user expand/collapse them by clicking. --- app/assets/stylesheets/components/messages.css | 7 ++++++- app/views/topics/_message.html.slim | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/components/messages.css b/app/assets/stylesheets/components/messages.css index 479f543..68843b3 100644 --- a/app/assets/stylesheets/components/messages.css +++ b/app/assets/stylesheets/components/messages.css @@ -224,11 +224,15 @@ .attachment-info { display: flex; - gap: var(--spacing-3); align-items: center; font-size: var(--font-size-sm); } +summary.attachment-info { + cursor: pointer; + display: list-item; +} + .filename { font-weight: var(--font-weight-medium); color: var(--color-text-primary); @@ -236,6 +240,7 @@ .content-type { color: var(--color-text-muted); + margin-left: var(--spacing-3); } .import-metadata { diff --git a/app/views/topics/_message.html.slim b/app/views/topics/_message.html.slim index 7a8c7c3..9f0bc9b 100644 --- a/app/views/topics/_message.html.slim +++ b/app/views/topics/_message.html.slim @@ -41,10 +41,19 @@ .message-attachments h4 Attachments: - message.attachments.each do |attachment| - .attachment - .attachment-info - span.filename = attachment.file_name - span.content-type = attachment.content_type if attachment.content_type + - if attachment.patch? + details class="attachment" + summary class="attachment-info" + span.filename = attachment.file_name + span.content-type = attachment.content_type if attachment.content_type + pre class="attachment-content" + code class="language-diff" + = attachment.decoded_body + - else + .attachment + .attachment-info + span.filename = attachment.file_name + span.content-type = attachment.content_type if attachment.content_type - if message.import_log.present? .import-metadata