diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index c24937bc88..b92a793058 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -58,6 +58,8 @@ module.exports = React.createClass({ }; }, + keywordsDialogDiv: "", + componentWillMount: function() { this._refreshFromServer(); }, @@ -155,6 +157,19 @@ module.exports = React.createClass({ } }, + onKeywordsClicked: function(event) { + var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); + Modal.createDialog(QuestionDialog, { + title: "Keywords", + description: this.keywordsDialogDiv, + onFinished: function onFinished(should_leave) { + if (should_leave) { + // TODO + } + } + }); + }, + getRule: function(vectorRuleId) { for (var i in this.state.vectorPushRules) { var rule = this.state.vectorPushRules[i]; @@ -306,7 +321,7 @@ module.exports = React.createClass({ // it corresponds to all content push rules (stored in self.state.vectorContentRule) self.state.vectorPushRules.push({ "vectorRuleId": "keywords", - "description" : "Messages containing keywords", + "description" : (Messages containing keywords), "state": self.state.vectorContentRules.state, }); @@ -435,6 +450,32 @@ module.exports = React.createClass({ ); } + // Prepare keywords dialog here, in a render method, else React complains if + // it is done later from onKeywordsClicked + var keywords = []; + for (var i in this.state.vectorContentRules.rules) { + var rule = this.state.vectorContentRules.rules[i]; + keywords.push(rule.pattern); + } + + if (keywords.length) { + keywords = keywords.join(", "); + } + else { + keywords = ""; + } + + this.keywordsDialogDiv = ( +