element-hq / element-x-ios

Next generation Matrix client for iOS built with SwiftUI on top of matrix-rust-sdk.
https://element.io/labs/element-x
GNU Affero General Public License v3.0
420 stars 99 forks source link

Notifications at mentions in encrypted rooms #2411

Closed anym001 closed 8 months ago

anym001 commented 9 months ago

Steps to reproduce

Settings -> Notifications -> Groupchats -> Mentions and key words (Your home server does not support this option in encrypted rooms. You may not be notified in some rooms.)

Outcome

What did you expect?

It would be great if you could also be notified of mentions in encrypted rooms.

What happened instead?

No notifications for mentions in encrypted rooms.

Your phone model

iPhone 14 Pro

Operating system version

iOS 17.3

Application version

1.5.4 (88)

Homeserver

matrix.minenet.at

Will you send logs?

No

Velin92 commented 8 months ago

A homeserver needs to implement the following MSC which is experimental: https://github.com/matrix-org/matrix-spec-proposals/pull/4028

Matrix.org is working on implementing it on their server in the future, but if you have a server of your own you might need to update it or use a development version to support this.

Closing the issue since this is not something we can do anything from the app side.

ich777 commented 8 months ago

but if you have a server of your own you might need to update it or use a development version to support this.

...in response to that what needs to be updated or better speaking which development version needs to be used, this answer is a bit vague to me and the linked PR is blocked for merging

Velin92 commented 8 months ago

but if you have a server of your own you might need to update it or use a development version to support this.

...in response to that what needs to be updated or better speaking which development version needs to be used, this answer is a bit vague to me and the linked PR is blocked for merging

If your server is using Synapse, it should have already been implemented in it (but I am not sure if a stable release with the implementation is already available, or if you might need to use a development/unstable version), you can get more info directly on Synapse

ich777 commented 8 months ago

@Velin92 sorry but I've now found conflicting information on how to enable experimental features, some say you have to create a file called synapse.config.experimental with the contents from below and some say that you just have to put the contents from below into your homeserver.yaml

experimental:
  msc4028_push_encrypted_events: true

As far as I can tell synapse v1.100.0 should have that built in but I seem to can't get it to work with either methods since /_matrix/clients/versions always returns: {"errcode":"M_UNRECOGNIZED","error":"Unrecognized request"}

Velin92 commented 8 months ago

@Velin92 sorry but I've now found conflicting information on how to enable experimental features, some say you have to create a file called synapse.config.experimental with the contents from below and some say that you just have to put the contents from below into your homeserver.yaml

experimental:
  msc4028_push_encrypted_events: true

As far as I can tell synapse v1.100.0 should have that built in but I seem to can't get it to work with either methods since /_matrix/clients/versions always returns: {"errcode":"M_UNRECOGNIZED","error":"Unrecognized request"}

Sorry but I don't know how I can help you since this repo is dedicated to Element-X-iOS, could you try asking or opening an issue on the synapse repo?

ich777 commented 8 months ago

Sorry but I don't know how I can help you

Thanks for the response.

No worries, I now implemented everything that MSC4028 is supported on my homeserver and it even reports that it's enabled but on Element X it shows it's not supported by the homeserver, so isn't this related to Element X for iOS?

The homeserver now responds properly with: "org.matrix.msc4028":true

Velin92 commented 8 months ago

Sorry but I don't know how I can help you

Thanks for the response.

No worries, I now implemented everything that MSC4028 is supported on my homeserver and it even reports that it's enabled but on Element X it shows it's not supported by the homeserver, so isn't this related to Element X for iOS?

The homeserver now responds properly with: "org.matrix.msc4028":true

Could you try to check if this is also enabled for the push rules on your account/accounts? Since El-X checks also if the push rule for the account data has the MSC 4028 enabled globally.

ich777 commented 8 months ago

I assume you are after that:

...
      {
        "conditions": [
          {
            "kind": "event_match",
            "key": "type",
            "pattern": "m.room.encrypted"
          }
        ],
        "actions": [
          "notify"
        ],
        "rule_id": ".org.matrix.msc4028.encrypted_event",
        "default": true,
        "enabled": false
      },
...

Good to know that this is the issue, I've now changed it and it seems to be resolved, at least the app doesn't list the message anymore!
I hope that was the correct way to change it: curl -X PUT -H "Authorization: Bearer <YOURTOKEN>" -d '{"enabled":true}' http://<YOURHOMESERVER>:8008/_matrix/client/r0/pushrules/global/override/.org.matrix.msc4028.encrypted_event/enabled

ich777 commented 8 months ago

@Velin92 sorry again a question, do all users have to change that setting on their own? This would be a huge bummer since with the command from above I changed it only for me correct?

Velin92 commented 8 months ago

@Velin92 sorry again a question, do all users have to change that setting on their own? This would be a huge bummer since with the command from above I changed it only for me correct?

From what I understand the MSC should be enabled by default in the push rules even in its unstable prefix, as stated in MSC 4028 description when enabled in the server configurations

During development the new push rule shall use org.matrix.msc4028.encrypted_event instead of .m.rule.encrypted_event.

Caution: this unstable push rule will be enabled by default like the stable push rule, the server owners should wait for the clients to support a minimum this MSC before enabling the MSC server side.

So it's weird that you had to enable it manually for yourself.

Velin92 commented 8 months ago

@ich777 Okay I double checked, as of right Synapse implements the configuration as an experimental/unstable setting. But it does not support yet that when enabled, it automatically adds itself as default global push rule for all the users, there is in fact an issue open about it: https://github.com/element-hq/synapse/issues/16846

So yeah as of right now users need to change this manually to support it. But in the future it will be automatically added to the push rules of the users by default if the server has it enabled.

ich777 commented 8 months ago

So yeah as of right now users need to change this manually to support it.

Thanks for confirming.

alecdwm commented 2 months ago

For anyone who finds themselves looking for a way to enable experimental msc4028 support on their homeserver:

  1. Add this section to your homeserver.yaml and restart synapse

    experimental_features:
    msc4028_push_encrypted_events: true
  2. Check if https://github.com/element-hq/synapse/issues/16846 has been merged. If not, obtain your access token from Element Desktop -> Settings -> Help & About -> Advanced and run this curl command:

    curl -H 'Authorization: Bearer <access-token>' \
    https://<homeserver-url>/_matrix/client/r0/pushrules/global/override/.org.matrix.msc4028.encrypted_event/enabled \
    -XPUT \
    -d'{"enabled":true}'

You can check that it worked by removing -XPUT -d'{"enabled":true}' and running the command again, which will return {"enabled":true}.

You can also confirm that the following command includes "org.matrix.msc4028":true in the response:

curl -H "Authorization: Bearer <access-token>" https://<homeserver-url>/_matrix/client/versions                                                                                           

At this point, Element X should stop showing the does not support this option in encrypted rooms warning.