-
-
Notifications
You must be signed in to change notification settings - Fork 115
feat: receive pre-messages and adapt download on demand #7431
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: pre-messages
Are you sure you want to change the base?
Conversation
2b900c3 to
305498d
Compare
b94964a to
ce97ba3
Compare
cd716c5 to
4c14566
Compare
4c14566 to
ca6bf65
Compare
In the first iteration, it's not necessary to emit an event, or add any new API. (not sure how the event landed in the "steps" at #7367, but it already is in the "Future Possibilities") |
|
|
||
| chat::mark_old_messages_as_noticed(context, received_msgs).await?; | ||
|
|
||
| // TODO: is there correct place for this? |
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.
address to do comment
| .context("delete_expired_imap_messages")?; | ||
|
|
||
| //------- | ||
| // TODO: verify that this is the correct position for this call |
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.
- address todo comment
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.
Guarding against lost pre-messages is optional, so, wouldn't actually be required for this first iteration of pre-messages. It's there now, but if this requires any further thought, we should just leave away.
From a logical standpoint, I would put it to the end of fetch_move_delete(), but it should be fine here, too (without me deeply thinking into this).
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.
I think I put it here so it does only run on normal fetch and not on background fetch, because those post messages could be huge.
EDIT: I will think about it again, I'm a bit confused again.
Progress of the testsOverview about the recycled(♻️) and dropped(🗑️) tests of the tests that I removed in #7373
All the recycled tests were already recycled/re-made except for some which are still to do:
Furthermore there need to be new tests to test the downloading/scheduling changes. TODO Tests
postponed to do tests
discarded/ignored test ideasmaybe we should reconsider / discuss those?
|
778dae2 to
2a3d5a3
Compare
| "Message is a Pre-Message (post_msg_exists:{post_msg_exists})." | ||
| ); | ||
| post_msg_exists | ||
| // TODO find out if trashing affects multi device usage? |
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.
- address todo comment
b7fb4cb to
b6dc11a
Compare
fix python lint errors receive pre-mesages, start with changes to imap loop. refactor: move download code from `scheduler.rs` to `download.rs`, also move `get_msg_id_by_rfc724_mid` to `MsgId::get_by_rfc724_mid` `MAX_FETCH_MSG_SIZE` is no longer unused Parse if it is a pre-message or full-message start with receiving logic get rid of `MsgId::get_by_rfc724_mid` because it was a duplicate of `message::rfc724_mid_exists` docs: add hint to `MimeMessage::from_bytes` stating that it has side-effects. receiving full message send and receive `attachment_size` and set viewtype to text in pre_message metadata as struct in pre-message in header. And fill params that we can already fill from the metadata. Also add a new api to check what viewtype the message will have once downloaded. api: jsonrpc: add `full_message_view_type` to `Message` and `MessageInfo` make PreMsgMetadata.to_header_value not consume self/PreMsgMetadata add api to merge params on download full message: merge new params into old params and remove full-message metadata params move tests to `src/tests/pre_messages.rs` dynamically allocate test attachment bytes fix detection of pre-messages. (it looked for the ChatFullMessageId header in the unencrypted headers before) fix setting dl state to avaiable on pre-messages fix: save pre message with rfc724_mid of full message als disable replacement for full messages add some receiving tests and update test todo for premessage metadata test: process full message before pre-message test receive normal message some serialization tests for PreMsgMetadata remove outdated todo comment test that pre-message contains message text PreMsgMetadata: test_build_from_file_msg and test_build_from_file_msg test: test_receive_pre_message_image Test receiving the full message after receiving an edit after receiving the pre-message test_reaction_on_pre_message test_full_download_after_trashed test_webxdc_update_for_not_downloaded_instance simplify fake webxdc generation in test_webxdc_update_for_not_downloaded_instance test_markseen_pre_msg test_pre_msg_can_start_chat and test_full_msg_can_start_chat test_download_later_keeps_message_order test_chatlist_event_on_full_msg_download fix download not working log splitting into pre-message add pre-message info to text when loading from db. this can be disabled with config key `hide_pre_message_metadata_text` if ui wants to display it in a prettier way. update `download_limit` documentation more logging: log size of pre and post messages rename full message to Post-Message split up the pre-message tests into multiple files dedup test code by extracting code to create test messages into util methods remove post_message_view_type from api, now it is only used internally for tests remove `hide_pre_message_metadata_text` config option, as there currently is no way to get the full message viewtype anymore Update src/download.rs resolve comment use `parse_message_id` instead of removing `<>`parenthesis it manually fix available_post_msgs gets no entries handle forwarding and add a test for it. convert comment to log warning event on unexpected download failure add doc comment to `simple_imap_loop` more logging handle saving pre-message to self messages and test.
b6dc11a to
bfc58e9
Compare
Immediately fully download all messages that do not have the `Chat-Is-Post-Message` header. This way, we simplify the logic for when which messages are downloaded, there are no differences at all anymore between 'background_fetch' and 'normal fetch'. Also, we prevent message reordering when reveiving a message from a legacy client. Messages larger than 1MB without `Chat-Is-Post-Message` should be rare, so, we do not expect this to really worsen things.
This PR implements receiving of pre-message, download of post-messages and the new logic for deciding what to fetch when from IMAP.
This is part of #7367
progress:
rfc724_midinstead ofmsg_id(added db migration for it)available_post_msgsscheduler.rstodownload.rsavailable_post_msgsgets no entriesuseremoved the config optionHidePreMessageMetadataTextin tests or remove the note that it is used in tests from it's docscode quality / nitpicking
tcm.section("...");instead of comments in testsspecific aspects that should become reality:
Chat-Edit(grep for "ChatEdit" in receive_imf.rs).Chat-Is-Post-Messageheader.background_fetch: If a large message withoutpostponedChat-Is-Post-Messageheader. is received, the UI should be notified via an event.Later (not in this pr, not now)
API Changes:
Message.get_filebytes- if message is not downloaded pre message, and metadata is available, then it returns the size that the file has after download, so ui can use this to show download size