synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Make event_match work on booleans and integers

Open Johennes opened this issue 3 years ago • 4 comments

Currently event_match push rule conditions are evaluated against a flattened version of the event dict that drops all non-string values. This change converts booleans and integers into their string representation so that they can be matched as well.

Fixes: #13465 Signed-off-by: Johannes Marbach [email protected]

Pull Request Checklist

  • [x] Pull request is based on the develop branch
  • [x] Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • [x] Pull request includes a sign off
  • [x] Code style is correct (run the linters)

Johennes avatar Aug 05 '22 07:08 Johennes

I think this is essentially a duplicate of #12181, which was rejected as needing an MSC, which was written as MSC3758.

clokep avatar Aug 05 '22 11:08 clokep

Ugh, thanks @clokep, I didn't realize there was another PR for this already. 🤦‍♂️

Johennes avatar Aug 05 '22 11:08 Johennes

Ugh, thanks @clokep, I didn't realize there was another PR for this already. 🤦‍♂️

No problem, it took me a while to find but I was 99% sure there was one! They're not fully overlapping (and yours has tests!) though so could be good to combine them.

clokep avatar Aug 05 '22 11:08 clokep

I wrote up MSC3862 describing the variant in this PR, too. This is not necessarily better than MSC3758 but I think having both options laid out side by side helps decide the way forward.

Johennes avatar Aug 05 '22 18:08 Johennes

Closing this since https://github.com/matrix-org/matrix-spec-proposals/pull/3862 has been abandoned.

Johennes avatar Feb 06 '23 19:02 Johennes