Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Send unread notification counts #456

Merged
merged 38 commits into from
Jan 8, 2016
Merged

Send unread notification counts #456

merged 38 commits into from
Jan 8, 2016

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Dec 22, 2015

  • Store each event that has push actions for a user & profile_tag in a table
  • Pull out of that table at sync time to give the number of unread notifications

dbkr added 18 commits December 10, 2015 16:26
…pdu, otherwise it will be triggered whenever we backfill too.
…ion required: much as it would be nice to be able to tell between the event not having been processed and there being no notification for it, this isn't worth filling up the table with ['dont_notify'] I think. Consequently treat the empty actions array as dont_notify and filter dont_notify out of the result.
…object on sync (only actually corrrect in a full sync: hardcoded to 0 in incremental syncs).
… incremental syncs too, where necessary, and fix silly bugs like only select the event actions for that user...
… by one, but does far fewer db queries to fetch the rules
@@ -0,0 +1,98 @@
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket Ltd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright year should be 2015

@dbkr
Copy link
Member Author

dbkr commented Jan 4, 2016

ptal

@dbkr
Copy link
Member Author

dbkr commented Jan 4, 2016

Another thought: should I be running the event through _filter_events_for_client? If so, what would be an efficient way to do this given this function seems to do a db hit to fetch the state?

@NegativeMjark
Copy link
Contributor

I tried running sytest using postgres and got an error:

File "/src/github/matrix-org/synapse/synapse/storage/event_push_actions.py", line 83, in _get_unread_event_push_actions_by_room

ProgrammingError: operator does not exist: bigint == integer
LINE 1: ...cal_ordering > 6       OR (e.topological_ordering == 6 AND e...

@NegativeMjark
Copy link
Contributor

We probably do want to run the event through _filter_events_for_client. If we already have a copy of the state then we should probably use that rather than requesting a new copy for each user in the room.

@dbkr
Copy link
Member Author

dbkr commented Jan 6, 2016

ptal. This, I believe, correctly runs _filter... (and also processes redactions correctly). The former means more db queries since we need to fetch state and whether users are guests. These are ripe for optimisation but unsure whether doing so up front would be premature.

@NegativeMjark
Copy link
Contributor

LGTM other than the potential fun for guest users since they can't set read receipts.

@dbkr
Copy link
Member Author

dbkr commented Jan 7, 2016

Good point. With this code, guest users will just never be able to clear their notifications I think. If we plan to continue not allowing guest users to send read receipts, I'll have to work around this somehow.

@dbkr
Copy link
Member Author

dbkr commented Jan 7, 2016

Conclusion is that we need to see read receipts from guests anyway, so no need for us to work around this. However this means we're probably blocked behind guest RRs being enabled.

@NegativeMjark
Copy link
Contributor

I'm happy for this to land, since the guest access is orthogonal. It's not like the clients have to read the notification count fields.

@dbkr
Copy link
Member Author

dbkr commented Jan 8, 2016

This is a very good point.

dbkr added a commit that referenced this pull request Jan 8, 2016
@dbkr dbkr merged commit c232780 into develop Jan 8, 2016
@richvdh richvdh deleted the store_event_actions branch December 1, 2016 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants