Clarify that a method returns only unthreaded receipts. (#13937)

By renaming it and updating the docstring.

Additionally, refactors a method which is used only by tests.
This commit is contained in:
Patrick Cloke 2022-09-29 07:07:31 -04:00 committed by GitHub
parent 99a7e7e023
commit 568016929f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 76 deletions

View file

@ -366,14 +366,11 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
user_id: str,
) -> NotifCounts:
# Get the stream ordering of the user's latest receipt in the room.
result = self.get_last_receipt_for_user_txn(
result = self.get_last_unthreaded_receipt_for_user_txn(
txn,
user_id,
room_id,
receipt_types=(
ReceiptTypes.READ,
ReceiptTypes.READ_PRIVATE,
),
receipt_types=(ReceiptTypes.READ, ReceiptTypes.READ_PRIVATE),
)
if result:
@ -574,10 +571,7 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, StreamWorkerStore, SQLBas
receipt_types_clause, args = make_in_list_sql_clause(
self.database_engine,
"receipt_type",
(
ReceiptTypes.READ,
ReceiptTypes.READ_PRIVATE,
),
(ReceiptTypes.READ, ReceiptTypes.READ_PRIVATE),
)
sql = f"""