element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.14k stars 1.98k forks source link

Audible notifications sometimes happens without highlighting room and adding item to Notifications sidebar #16866

Open MurzNN opened 3 years ago

MurzNN commented 3 years ago

Description

I have enabled the Enable audible notifications for this session and sometimes (fairly often) I receive the audible notification from Element, but none of rooms becomes highlighted (red-colored), also in current and in "Notifications" sidebar there are no new entries too... And there is no highlighted message in currently selected room too, and no notification in system notifications.

So I'm very disoriented about what is happens, and who triggers this audible event.

Can anybody describe how to figure-out which room and event can cause this notification, to improve this bug report?

MurzNN commented 3 years ago

Also seems there is divergence with naming in Settings: the "Audible notifications" in switcher with "Noisy" in grid between switchers: image Maybe rename that column to "Audible"?

MurzNN commented 3 years ago

Seems this happens with group chat rooms, managed by mautrix-telegram, that bridges Telegram Channel type of room, when it receives edit of new post. Those rooms have "Use default" notification mode, and even switching to "Mentions & Keywords" isn't help.

Here is event contents:

{
  "type": "m.room.message",
  "sender": "@_telegram_bot:ru-matrix.org",
  "content": {
    "msgtype": "m.text",
    "body": "* Serpstat и Netpeak Software ищут Middle SEO-специалиста \n\nОбязанности будут включать:\n\n1. Разработку стратегии SEO-продвижения.\n2. Проведение технического и контентного аудита сайта и постановка ТЗ с рекомендациями.\n3. Настройка аналитики отслеживания позиций, органического трафика и продаж.\n4. Сбор и расширение семантики, оптимизация сайта под семантику.\n5. Наращивание ссылочной массы и задачи для внутренней перелинковки.\n\nГео: Украина, Россия (Google, Yandex), США\n\nА еще: если по вашей рекомендации мы найдем специалиста и он завершит испытательный срок, то  вы получите бесплатный доступ в Serpstat на 6 месяцев 😎\n\n🚀Подробнее о вакансии: https://career.netpeak.ua/vacancy/middle-in-house-seo-specialist/\n\n#вакансия",
    "external_url": "https://t.me/devakatalk/2906",
    "m.relates_to": {
      "rel_type": "m.replace",
      "event_id": "$nSxTrAJ6A_lohQMbMwmcL5bMWq1s5jMZUpwb6jYXXXX"
    },
    "format": "org.matrix.custom.html",
    "formatted_body": "* <strong>Serpstat и Netpeak Software ищут Middle SEO-специалиста <br/><br/></strong>Обязанности будут включать:<br/><br/>1. Разработку стратегии SEO-продвижения.<br/>2. Проведение технического и контентного аудита сайта и постановка ТЗ с рекомендациями.<br/>3. Настройка аналитики отслеживания позиций, органического трафика и продаж.<br/>4. Сбор и расширение семантики, оптимизация сайта под семантику.<br/>5. Наращивание ссылочной массы и задачи для внутренней перелинковки.<br/><br/>Гео: Украина, Россия (Google, Yandex), США<br/><br/>А еще: если по вашей рекомендации мы найдем специалиста и он завершит испытательный срок, то  вы получите бесплатный доступ в Serpstat на 6 месяцев 😎<br/><br/>🚀Подробнее о вакансии: <a href='https://career.netpeak.ua/vacancy/middle-in-house-seo-specialist/'>https://career.netpeak.ua/vacancy/middle-in-house-seo-specialist/</a><br/><br/><font color='blue'>#вакансия</font>",
    "m.new_content": {
      "msgtype": "m.text",
      "body": "Serpstat и Netpeak Software ищут Middle SEO-специалиста \n\nОбязанности будут включать:\n\n1. Разработку стратегии SEO-продвижения.\n2. Проведение технического и контентного аудита сайта и постановка ТЗ с рекомендациями.\n3. Настройка аналитики отслеживания позиций, органического трафика и продаж.\n4. Сбор и расширение семантики, оптимизация сайта под семантику.\n5. Наращивание ссылочной массы и задачи для внутренней перелинковки.\n\nГео: Украина, Россия (Google, Yandex), США\n\nА еще: если по вашей рекомендации мы найдем специалиста и он завершит испытательный срок, то  вы получите бесплатный доступ в Serpstat на 6 месяцев 😎\n\n🚀Подробнее о вакансии: https://career.netpeak.ua/vacancy/middle-in-house-seo-specialist/\n\n#вакансия",
      "external_url": "https://t.me/devakatalk/2906",
      "format": "org.matrix.custom.html",
      "formatted_body": "<strong>Serpstat и Netpeak Software ищут Middle SEO-специалиста <br/><br/></strong>Обязанности будут включать:<br/><br/>1. Разработку стратегии SEO-продвижения.<br/>2. Проведение технического и контентного аудита сайта и постановка ТЗ с рекомендациями.<br/>3. Настройка аналитики отслеживания позиций, органического трафика и продаж.<br/>4. Сбор и расширение семантики, оптимизация сайта под семантику.<br/>5. Наращивание ссылочной массы и задачи для внутренней перелинковки.<br/><br/>Гео: Украина, Россия (Google, Yandex), США<br/><br/>А еще: если по вашей рекомендации мы найдем специалиста и он завершит испытательный срок, то  вы получите бесплатный доступ в Serpstat на 6 месяцев 😎<br/><br/>🚀Подробнее о вакансии: <a href='https://career.netpeak.ua/vacancy/middle-in-house-seo-specialist/'>https://career.netpeak.ua/vacancy/middle-in-house-seo-specialist/</a><br/><br/><font color='blue'>#вакансия</font>"
    }
  },
  "origin_server_ts": 1617797017479,
  "unsigned": {
    "age": 67102106
  },
  "event_id": "$31locNLCcBAQJ16BtwJ-qQ7LJU8qlNBx1fseIX7XXXX",
  "room_id": "!wBrHOtOYXsQBjaXXXX:ru-matrix.org"
}
t3chguy commented 3 years ago

The notifications right panel is driven by the server. If the notification was encrypted then it is known to be missing https://github.com/vector-im/element-web/issues/6874, if it wasn't then its a server bug for not returning it in the /notifications API.

From your description above though it seems your push rules are broken, set to set_tweak=sound without notify being set creating audible notifications but without triggering a red highlight or populating the /notifications API

MurzNN commented 3 years ago

@t3chguy, thanks for suggestion, but the problematic rooms are not encrypted.

I have found contents of m.push_rules in "Explore Account Data" devtools, and it have many very confusing items, so I delete it (replace to empty {}), reload Element and toggle some values to force push new "default" data, will lookup if this helps.

Also maybe Element already provide some GUI way for "Reset to default" all push rules?

t3chguy commented 3 years ago

The defaults are up to the server, and there's no way to query them, so not possible for Element to have such a GUI.

MurzNN commented 3 years ago

Still can't solve this problem, and it's very annoying to receive an audible notification for each new message or edit of previous message in Telegram channel room. This isn't happen with other Telegram bridged rooms, only with Telegram channels!

So seems the source of problem is how Mautrix-Telegram creates the bridged rooms for Telegram channels? What room property can depend on this?

MurzNN commented 3 years ago

For example, I figured-out the id of room, that cause about 200+ audio notifications in last hour, because they are doing a lot of edits of last message. Here is screenshot from timeline: image And for each edit event I receive audible notification, without highlighting that room and even without text notification!

But I even didn't see the id of that room in my m.push_rules json!

This room is not marked as direct, and it have "Use default" notification rules. Temporary switching to "Mentions & Keywords" removes the audible notifications, but it removes the counter of new messages too, so this is not a good solution in long term. But even for short term it's hard to find the spammy room (because of missing highlighting with red color) to do this, and not forgot to undo this after spam span is finished :)

@t3chguy can you please recommend me more ways to do something for investigate and solve this annoying problem?

MurzNN commented 3 years ago

So problematic room id isn't present in any value of my m.push_rules fields. Here is full content of my m.push_rules with removed exact room ids:


{
    "global": {
        "underride": [
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.call.invite"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "sound",
                        "value": "ring"
                    },
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".m.rule.call",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "room_member_count",
                        "is": "2"
                    },
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.message"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "sound",
                        "value": "default"
                    },
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".m.rule.room_one_to_one",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "room_member_count",
                        "is": "2"
                    },
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.encrypted"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "sound",
                        "value": "default"
                    },
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".m.rule.encrypted_room_one_to_one",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.message"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".m.rule.message",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.encrypted"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".m.rule.encrypted",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "im.vector.modular.widgets"
                    },
                    {
                        "kind": "event_match",
                        "key": "content.type",
                        "pattern": "jitsi"
                    },
                    {
                        "kind": "event_match",
                        "key": "state_key",
                        "pattern": "*"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".im.vector.jitsi",
                "default": true,
                "enabled": true
            }
        ],
        "sender": [],
        "room": [
            {
                "actions": [
                    "dont_notify"
                ],
                "rule_id": "!room1:ru-matrix.org",
                "default": false,
                "enabled": true
            },
            {
                "actions": [
                    "dont_notify"
                ],
                "rule_id": "!room2:matrix.org",
                "default": false,
                "enabled": true
            },
// More 30+ muted rooms
            {
                "actions": [
                    "dont_notify"
                ],
                "rule_id": "!roomN:matrix.org",
                "default": false,
                "enabled": true
            }
        ],
        "content": [
            {
                "actions": [
                    "notify",
                    {
                        "set_tweak": "sound",
                        "value": "default"
                    },
                    {
                        "set_tweak": "highlight"
                    }
                ],
                "pattern": "murz",
                "rule_id": ".m.rule.contains_user_name",
                "default": true,
                "enabled": true
            }
        ],
        "override": [
            {
                "conditions": [],
                "actions": [
                    "dont_notify"
                ],
                "rule_id": ".m.rule.master",
                "default": true,
                "enabled": false
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "room_id",
                        "pattern": "!room1:matrix.org"
                    }
                ],
                "actions": [
                    "dont_notify"
                ],
                "rule_id": "!room1:matrix.org",
                "default": false,
                "enabled": true
            },
// About 10 other rooms
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "room_id",
                        "pattern": "!roomN:ru-matrix.org"
                    }
                ],
                "actions": [
                    "dont_notify"
                ],
                "rule_id": "!roomN:ru-matrix.org",
                "default": false,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "content.msgtype",
                        "pattern": "m.notice"
                    }
                ],
                "actions": [
                    "dont_notify"
                ],
                "rule_id": ".m.rule.suppress_notices",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.member"
                    },
                    {
                        "kind": "event_match",
                        "key": "content.membership",
                        "pattern": "invite"
                    },
                    {
                        "kind": "event_match",
                        "key": "state_key",
                        "pattern": "@murz:ru-matrix.org"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "sound",
                        "value": "default"
                    },
                    {
                        "set_tweak": "highlight",
                        "value": false
                    }
                ],
                "rule_id": ".m.rule.invite_for_me",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.member"
                    }
                ],
                "actions": [
                    "dont_notify"
                ],
                "rule_id": ".m.rule.member_event",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "contains_display_name"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "sound",
                        "value": "default"
                    },
                    {
                        "set_tweak": "highlight"
                    }
                ],
                "rule_id": ".m.rule.contains_display_name",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "content.body",
                        "pattern": "@room"
                    },
                    {
                        "kind": "sender_notification_permission",
                        "key": "room"
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "highlight",
                        "value": true
                    }
                ],
                "rule_id": ".m.rule.roomnotif",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.room.tombstone"
                    },
                    {
                        "kind": "event_match",
                        "key": "state_key",
                        "pattern": ""
                    }
                ],
                "actions": [
                    "notify",
                    {
                        "set_tweak": "highlight",
                        "value": true
                    }
                ],
                "rule_id": ".m.rule.tombstone",
                "default": true,
                "enabled": true
            },
            {
                "conditions": [
                    {
                        "kind": "event_match",
                        "key": "type",
                        "pattern": "m.reaction"
                    }
                ],
                "actions": [
                    "dont_notify"
                ],
                "rule_id": ".m.rule.reaction",
                "default": true,
                "enabled": true
            }
        ]
    },
    "device": {}
}
davidegirardi commented 11 months ago

We have a room where we recently enabled encryption. There's a webhook there posting in clear-text. That room has notification enabled for all messages in the room settings. When the webhook posts, I hear a ping but I don't see a notification counter.

I'm running Element Nightly version: 2023112101 Crypto version: Olm 3.2.15. Mobile clients, for example Element X Android, do trigger a notification.

These are my global notification settings: image

And these are the settings for the room itself: image

Finally, this is the output of the notifications debug tool: image