-
-
Notifications
You must be signed in to change notification settings - Fork 118
api(rust, jsonrpc): add get_message_read_receipt_count method
#7732
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
base: main
Are you sure you want to change the base?
Conversation
for new api to existing read-receipts test
get_msg_read_receipt_count methodget_message_read_receipt_count method
| pub async fn get_msg_read_receipt_count(context: &Context, msg_id: MsgId) -> Result<usize> { | ||
| context | ||
| .sql | ||
| .count("SELECT COUNT(*) FROM msgs_mdns WHERE msg_id=?", (msg_id,)) |
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.
There are no constraints on the msgs_mdns table, so multiple MDNs from the same contact are possible, e.g. sent from multiple devices. Probably we want to count unique contacts here
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.
isn't that checked on adding the record? i cannot remember having seen multiple read-receipt from ine contact, knowing they have multiple devices
if so, we probably want to fix it on incoming MDNs, not here
ftr, we only recently added more detailed constraints, most columns do not have them, even if they could
| assert read_receipts[0].contact_id == alice_contact_bob.id | ||
|
|
||
| read_receipt_cnt = read_msg.get_read_receipt_count() | ||
| assert read_receipt_cnt == 1 |
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.
We also need to check that it's 0 initially
|
|
||
| /// Returns count of read receipts on message. | ||
| /// | ||
| /// This view count is meant as a feedback measure for the channel owner only. |
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 view count is meant as a feedback measure for the channel owner only. | |
| /// This view count is meant as a feedback measure for the message sender only. |
It should be UIs' decision where to use this function, it actually works not only for channels
closes #7728