Handle the good, warning, danger status for post attachments (#1425)

This commit is contained in:
enahum 2018-02-12 09:02:54 -03:00 committed by Saturnino Abril
parent 39181bd7b9
commit bd3a5e1288

View file

@ -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 = [];