From bd3a5e128854e386df0d7599cd0c0f3bfd921a27 Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 12 Feb 2018 09:02:54 -0300 Subject: [PATCH] Handle the good, warning, danger status for post attachments (#1425) --- .../slack_attachments/slack_attachment.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/components/slack_attachments/slack_attachment.js b/app/components/slack_attachments/slack_attachment.js index 917347360..db45160ce 100644 --- a/app/components/slack_attachments/slack_attachment.js +++ b/app/components/slack_attachments/slack_attachment.js @@ -17,6 +17,12 @@ import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; import InteractiveAction from './interactive_action'; +const STATUS_COLORS = { + good: '#00c100', + warning: '#dede01', + danger: '#e40303' +}; + export default class SlackAttachment extends PureComponent { static propTypes = { attachment: PropTypes.object.isRequired, @@ -228,8 +234,12 @@ export default class SlackAttachment extends PureComponent { } let borderStyle; - if (attachment.color && attachment.color[0] === '#') { - borderStyle = {borderLeftColor: attachment.color}; + if (attachment.color) { + if (attachment.color[0] === '#') { + borderStyle = {borderLeftColor: attachment.color}; + } else if (STATUS_COLORS.hasOwnProperty(attachment.color)) { + borderStyle = {borderLeftColor: STATUS_COLORS[attachment.color]}; + } } const author = [];