1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from typing import Any , Dict , List , Optional , Set , Union , cast
15+ from typing import Any , Dict , List , Optional , Union , cast
1616
1717import frozendict
1818
@@ -147,8 +147,6 @@ def _get_evaluator(
147147 self ,
148148 content : JsonMapping ,
149149 * ,
150- has_mentions : bool = False ,
151- user_mentions : Optional [Set [str ]] = None ,
152150 related_events : Optional [JsonDict ] = None ,
153151 ) -> PushRuleEvaluator :
154152 event = FrozenEvent (
@@ -167,8 +165,7 @@ def _get_evaluator(
167165 power_levels : Dict [str , Union [int , Dict [str , int ]]] = {}
168166 return PushRuleEvaluator (
169167 _flatten_dict (event ),
170- has_mentions ,
171- user_mentions or set (),
168+ False ,
172169 room_member_count ,
173170 sender_power_level ,
174171 cast (Dict [str , int ], power_levels .get ("notifications" , {})),
@@ -204,32 +201,6 @@ def test_display_name(self) -> None:
204201 # A display name with spaces should work fine.
205202 self .assertTrue (evaluator .matches (condition , "@user:test" , "foo bar" ))
206203
207- def test_user_mentions (self ) -> None :
208- """Check for user mentions."""
209- condition = {"kind" : "org.matrix.msc3952.is_user_mention" }
210-
211- # No mentions shouldn't match.
212- evaluator = self ._get_evaluator ({}, has_mentions = True )
213- self .assertFalse (evaluator .matches (condition , "@user:test" , None ))
214-
215- # An empty set shouldn't match
216- evaluator = self ._get_evaluator ({}, has_mentions = True , user_mentions = set ())
217- self .assertFalse (evaluator .matches (condition , "@user:test" , None ))
218-
219- # The Matrix ID appearing anywhere in the mentions list should match
220- evaluator = self ._get_evaluator (
221- {}, has_mentions = True , user_mentions = {"@user:test" }
222- )
223- self .assertTrue (evaluator .matches (condition , "@user:test" , None ))
224-
225- evaluator = self ._get_evaluator (
226- {}, has_mentions = True , user_mentions = {"@another:test" , "@user:test" }
227- )
228- self .assertTrue (evaluator .matches (condition , "@user:test" , None ))
229-
230- # Note that invalid data is tested at tests.push.test_bulk_push_rule_evaluator.TestBulkPushRuleEvaluator.test_mentions
231- # since the BulkPushRuleEvaluator is what handles data sanitisation.
232-
233204 def _assert_matches (
234205 self , condition : JsonDict , content : JsonMapping , msg : Optional [str ] = None
235206 ) -> None :
0 commit comments