From 6a47aeda9bfe812f826e87ade7c6e7b58bc3b66f Mon Sep 17 00:00:00 2001 From: Zaliqa Date: Wed, 22 Mar 2023 18:02:49 -0400 Subject: [PATCH] [issue_tracker] Display attachments (#32) --- .../jsx/attachments/attachmentsList.js | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/issue_tracker/jsx/attachments/attachmentsList.js b/modules/issue_tracker/jsx/attachments/attachmentsList.js index f33652b573f..931ee3cc251 100644 --- a/modules/issue_tracker/jsx/attachments/attachmentsList.js +++ b/modules/issue_tracker/jsx/attachments/attachmentsList.js @@ -149,6 +149,15 @@ class AttachmentsList extends Component { ); } + /** + * Sets event target src to null + * + * @param {Object} event + */ + displayNone(event) { + event.target.src = null; + } + /** * Renders the React component. * @@ -185,6 +194,7 @@ class AttachmentsList extends Component { ); let attachmentsRows = []; + let regexImg = /image/; for (const key in this.state.attachments) { if (this.state.attachments.hasOwnProperty(key)) { const item = this.state.attachments[key]; @@ -203,7 +213,26 @@ class AttachmentsList extends Component {
File:
-
{item.file_name}
+
+ {item.file_name} + {regexImg.test(item.mime_type) ? + ( + ) : + null + } +