From 57ba816919fdc4d82393875cdfebe7e1844e2749 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 29 Jun 2015 16:24:02 +0100 Subject: [PATCH] Highlight messages using new push rules support in js sdk --- skins/base/css/molecules/MessageTile.css | 4 ++++ skins/base/views/molecules/MessageTile.js | 3 ++- src/controllers/molecules/MessageTile.js | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/skins/base/css/molecules/MessageTile.css b/skins/base/css/molecules/MessageTile.css index 3e484079..09a995e6 100644 --- a/skins/base/css/molecules/MessageTile.css +++ b/skins/base/css/molecules/MessageTile.css @@ -24,3 +24,7 @@ limitations under the License. .mx_MessageTile.not_sent { color: #f11; } + +.mx_MessageTile.highlight { + color: #00f; +} diff --git a/skins/base/views/molecules/MessageTile.js b/skins/base/views/molecules/MessageTile.js index 80bbc5fd..95f4a9ac 100644 --- a/skins/base/views/molecules/MessageTile.js +++ b/skins/base/views/molecules/MessageTile.js @@ -49,7 +49,8 @@ module.exports = React.createClass({ var classes = classNames({ mx_MessageTile: true, sending: this.props.mxEvent.status == 'sending', - not_sent: this.props.mxEvent.status == 'not_sent' + not_sent: this.props.mxEvent.status == 'not_sent', + highlight: this.shouldHighlight() }); return (
diff --git a/src/controllers/molecules/MessageTile.js b/src/controllers/molecules/MessageTile.js index 8aa688b2..ef56daa2 100644 --- a/src/controllers/molecules/MessageTile.js +++ b/src/controllers/molecules/MessageTile.js @@ -16,6 +16,13 @@ limitations under the License. 'use strict'; +var MatrixClientPeg = require("../../MatrixClientPeg"); + module.exports = { + shouldHighlight: function() { + var actions = this.props.mxEvent.getPushActions(MatrixClientPeg.get()); + if (!actions || !actions.tweaks) { return false; } + return actions.tweaks.highlight; + } };