Skip to content
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

Merged
merged 17 commits into from
Jul 16, 2022
Merged

Per-space notification bubbles #1062

merged 17 commits into from
Jul 16, 2022

Conversation

LorenDB
Copy link
Member

@LorenDB 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

@LorenDB
Copy link
Member Author

LorenDB commented Apr 23, 2022

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.

@LorenDB
Copy link
Member Author

LorenDB commented Apr 26, 2022

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?

@deepbluev7
Copy link
Member

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?

@LorenDB
Copy link
Member Author

LorenDB commented Apr 26, 2022

Sounds reasonable to me.

@LorenDB
Copy link
Member Author

LorenDB commented Apr 28, 2022

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?

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)
Copy link
Member

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?

@deepbluev7
Copy link
Member

Looks good to me apart from the tiny thing, that the menu entry for muting a space doesn't seem to work :3

@deepbluev7
Copy link
Member

Hm, recalculating the space unread counts seems to take quite a while whenever I am switching rooms...

@@ -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()))
Copy link
Member

@deepbluev7 deepbluev7 Jun 30, 2022

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.

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_))
Copy link
Member

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.

Copy link
Member

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)

Copy link
Member Author

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...?

@LorenDB
Copy link
Member Author

LorenDB commented Jun 30, 2022

Looks good to me apart from the tiny thing, that the menu entry for muting a space doesn't seem to work :3

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.

@deepbluev7
Copy link
Member

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.

@LorenDB
Copy link
Member Author

LorenDB commented Jul 1, 2022

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.

@LorenDB
Copy link
Member Author

LorenDB commented Jul 1, 2022

See also #1090

@deepbluev7
Copy link
Member

Well, it is not really a blocker for me, the performance is though.

@deepbluev7
Copy link
Member

(Also you could try debugging using Gammaray or so)

@deepbluev7 deepbluev7 merged commit f62cb77 into master Jul 16, 2022
@LorenDB LorenDB deleted the perSpaceNotifs branch July 16, 2022 02:26
@LorenDB
Copy link
Member Author

LorenDB commented Jul 16, 2022

Thanks for fixing my code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants