|
65 | 65 | .message-attachments id="message-#{message.id}-attachments" |
66 | 66 | h4 Attachments: |
67 | 67 | - message.attachments.each do |attachment| |
68 | | - - if attachment.patch? |
| 68 | + - if attachment.patch? || attachment.text? |
69 | 69 | details.attachment |
70 | 70 | summary.attachment-info |
71 | 71 | span.attachment-summary-row |
72 | 72 | span.filename = attachment.file_name |
73 | 73 | span.content-type = attachment.content_type if attachment.content_type |
74 | 74 | = link_to "Download", attachment_path(attachment), class: "attachment-download", download: attachment.file_name, data: { turbo: false } |
75 | | - - stats = attachment.diff_line_stats |
76 | | - - if stats[:added].positive? || stats[:removed].positive? |
77 | | - span.patchset-stats aria-label="Patch line changes" title="Lines added and removed by this patch" |
78 | | - span.patchset-added +#{stats[:added]} |
79 | | - span.patchset-removed -#{stats[:removed]} |
| 75 | + - if attachment.patch? |
| 76 | + - stats = attachment.diff_line_stats |
| 77 | + - if stats[:added].positive? || stats[:removed].positive? |
| 78 | + span.patchset-stats aria-label="Patch line changes" title="Lines added and removed by this patch" |
| 79 | + span.patchset-added +#{stats[:added]} |
| 80 | + span.patchset-removed -#{stats[:removed]} |
80 | 81 | pre.attachment-content |
81 | | - code.language-diff data-controller="diff-highlight" |
82 | | - = attachment.decoded_body_utf8 |
83 | | - - elsif attachment.text? |
84 | | - details.attachment |
85 | | - summary.attachment-info |
86 | | - span.attachment-summary-row |
87 | | - span.filename = attachment.file_name |
88 | | - span.content-type = attachment.content_type if attachment.content_type |
89 | | - = link_to "Download", attachment_path(attachment), class: "attachment-download", download: attachment.file_name, data: { turbo: false } |
90 | | - pre.attachment-content |
91 | | - code |
92 | | - = attachment.decoded_body_utf8 |
| 82 | + - if attachment.patch? |
| 83 | + code.language-diff data-controller="diff-highlight" |
| 84 | + = attachment.decoded_body_utf8 |
| 85 | + - else |
| 86 | + code |
| 87 | + = attachment.decoded_body_utf8 |
93 | 88 | - else |
94 | 89 | .attachment |
95 | 90 | .attachment-info |
|
0 commit comments