Add vector rules with the appropriate kind, otherwise the room_message rule takes precedence over content / display name rules etc and prevents bings.

This commit is contained in:
David Baker 2016-01-22 14:12:29 +00:00
parent 0752c3a6d5
commit e11ae99a9f
1 changed files with 7 additions and 1 deletions

View File

@ -49,6 +49,7 @@ var VectorPushRulesDefinitions = {
// Messages containing user's display name // Messages containing user's display name
// (skip contains_user_name which is too geeky) // (skip contains_user_name which is too geeky)
"im.vector.rule.contains_display_name": { "im.vector.rule.contains_display_name": {
kind: "underride",
hsDefaultRuleId: ".m.rule.contains_display_name", hsDefaultRuleId: ".m.rule.contains_display_name",
description: "Messages containing my name", description: "Messages containing my name",
conditions: [{ conditions: [{
@ -78,6 +79,7 @@ var VectorPushRulesDefinitions = {
// Messages just sent to the user in a 1:1 room // Messages just sent to the user in a 1:1 room
"im.vector.rule.room_one_to_one": { "im.vector.rule.room_one_to_one": {
kind: "underride",
hsDefaultRuleId: ".m.rule.room_one_to_one", hsDefaultRuleId: ".m.rule.room_one_to_one",
description: "Messages in one-to-one chats", description: "Messages in one-to-one chats",
conditions: [{ conditions: [{
@ -110,6 +112,7 @@ var VectorPushRulesDefinitions = {
// 1:1 room messages are catched by the .m.rule.room_one_to_one rule if any defined // 1:1 room messages are catched by the .m.rule.room_one_to_one rule if any defined
// By opposition, all other room messages are from group chat rooms. // By opposition, all other room messages are from group chat rooms.
"im.vector.rule.room_message": { "im.vector.rule.room_message": {
kind: "underride",
description: "Messages in group chats", description: "Messages in group chats",
conditions: [{ conditions: [{
"pattern": "m.room.message", "pattern": "m.room.message",
@ -141,6 +144,7 @@ var VectorPushRulesDefinitions = {
// Invitation for the user // Invitation for the user
"im.vector.rule.invite_for_me": { "im.vector.rule.invite_for_me": {
kind: "underride",
hsDefaultRuleId: ".m.rule.invite_for_me", hsDefaultRuleId: ".m.rule.invite_for_me",
description: "When I'm invited to a room", description: "When I'm invited to a room",
conditions: [ conditions: [
@ -209,6 +213,7 @@ var VectorPushRulesDefinitions = {
// Incoming call // Incoming call
"im.vector.rule.call": { "im.vector.rule.call": {
kind: "underride",
hsDefaultRuleId: ".m.rule.call", hsDefaultRuleId: ".m.rule.call",
description: "Call invitation", description: "Call invitation",
conditions: [{ conditions: [{
@ -237,6 +242,7 @@ var VectorPushRulesDefinitions = {
// Notifications from bots // Notifications from bots
"im.vector.rule.notices": { "im.vector.rule.notices": {
kind: "override",
hsDefaultRuleId: ".m.rule.suppress_notices", hsDefaultRuleId: ".m.rule.suppress_notices",
description: "Messages sent by bot", description: "Messages sent by bot",
conditions: [{ conditions: [{
@ -656,7 +662,7 @@ module.exports = React.createClass({
actions: ruleDefinition.vectorStateToActions[vectorState] actions: ruleDefinition.vectorStateToActions[vectorState]
} }
return MatrixClientPeg.get().addPushRule('global', "override", vectorRuleId, body); return MatrixClientPeg.get().addPushRule('global', ruleDefinition.kind, vectorRuleId, body);
}, },
_refreshFromServer: function() { _refreshFromServer: function() {