-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-space notification bubbles #1062
Conversation
LorenDB
commented
Apr 23, 2022
- Display unread notifications for spaces
- Fix typoed variable name
- Add space notifications to room list
- Add loud notifications for spaces
- Make the notification bubble its own component
- Add space notifs to room list
- make lint
- Add space notification configuration
This does not support notifications for tags and categories; I'm not sure if there is a good way to detect what rooms are under specific tags and categories and I don't know if I really want to look at that right now. |
Okey dokey, I've got tags, DMs, and the like hooked up. However, before merging, I think a review of the configuration for this would be in order. In other words, how much should the user be able to turn off and on? |
I think ideally we would always show notification counts, but be able to mute on a per space bases, which would hide the bubble (and notifications) for that specific space and all the children? |
Sounds reasonable to me. |
Done, but there are some problems with toggling the space mute (see my comment in #nheko:nheko.im). |
text: qsTr("Do not show notification counts for this space or tag.") | ||
checkable: true | ||
checked: communityContextMenu.muted | ||
onTriggered: Communities.toggleTagMute(communityContextMenu.tagId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to work?
Looks good to me apart from the tiny thing, that the menu entry for muting a space doesn't seem to work :3 |
Hm, recalculating the space unread counts seems to take quite a while whenever I am switching rooms... |
src/timeline/CommunitiesModel.cpp
Outdated
@@ -70,6 +92,17 @@ CommunitiesModel::data(const QModelIndex &index, int role) const | |||
return 0; | |||
case CommunitiesModel::Roles::Id: | |||
return ""; | |||
case CommunitiesModel::Roles::UnreadMessages: { | |||
int total{0}; | |||
for (const auto &[id, info] : cache::getRoomInfo(cache::joinedRooms())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really, really slow. Every time I click on a room, this causes 900*2=1800
database transactions and makes everything slow. There is a command to fetch all rooms at once, but I don't think you should even fetch all rooms here, we are already caching this stuff somewhere.
src/timeline/CommunitiesModel.cpp
Outdated
case CommunitiesModel::Roles::Parent: | ||
return ""; | ||
case CommunitiesModel::Roles::Depth: | ||
return 0; | ||
case CommunitiesModel::Roles::Id: | ||
return "dm"; | ||
case CommunitiesModel::Roles::UnreadMessages: { | ||
int total{0}; | ||
for (const auto &[id, info] : cache::getRoomInfo(directMessages_)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this can be fetched in one call from the db.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Or just access the rooms directly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Or just access the rooms directly)
Via...?
I think it is simply a problem with QML not querying the model when updates happen; I tested with the notification visibility being dependent on hiddenness instead of mutedness and it didn't work there. |
If you specify nothing, it considers everything changed. |
I just fixed that. I'm personally at a loss as to how to fix this because the menu's show function does pick up the change; however, QML never rerenders the notification bubbles until you restart. |
See also #1090 |
Well, it is not really a blocker for me, the performance is though. |
(Also you could try debugging using Gammaray or so) |
edd1a1b
to
7b33d14
Compare
Thanks for fixing my code! |