-
-
Notifications
You must be signed in to change notification settings - Fork 97
Generate rfc724_mid when creating Message #6704
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
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 PR introduces a new bug: When I send any webxdc in DC Android, it gets sent twice, i.e. the webxdc is duplicated. Edit: This bug is fixed now
Edit: BTW, would be nice to add a test in this PR
82877cf
to
c5658fb
Compare
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.
Looks good, though i couldn't understand which test reproduces the reported bug
@Hocuri built manually and tested on android |
It seems that it's not difficult to add a test that just compares the |
Hm, right now, when I test it on my Android (draft poll webxdc -> create poll -> vote -> send), the message is only sent once, but it doesn't contain the vote (i.e. the behavior is the same as before this PR). About the test, it's just good to have a regression test so that we don't introduce the same bug again in a future refactoring. |
By bug do you mean double sending messages or not setting the mid upfront? Because that is rather a feature not a bug |
a59bab7
to
351d7e6
Compare
If possible, it would be best if the test tests both that only one message is sent and that the rfc724_mid is set upfront. But I'd say it's not strictly necessary. I tested again, this PR certainly doesn't fix the bug on Android - the behavior is the same as without the PR, the |
Idk if it is only a display error because the new test successfully checks that the sending side only has one associated message in the chat. Maybe a display bug on android? |
6b97991
to
564a569
Compare
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.
Looks good, but i didn't check Android. Desktop seems to work w/o regressions (checked using the poll app)
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.
For some reason when i put this PR on top of 3efd94914 chore(release): prepare for 1.158.0
, it breaks forwarding messages in Desktop -- messages are forwarded twice. But i need to wait some time until the second message arrives.
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 did not follow closely, however, we should not merge this pr until we know the forwarding issue is clearly unrelated
and/or desktop is fixed
otherwise we upgrade to a worse bug :)
@iequidoo I can confirm that the same bug exists on DC Android. |
564a569
to
afc625f
Compare
I checked the new PR version putting it on top of 1.159.1, looks working now. Will try to dismiss @r10s's "requested change" then |
did someone actually try the PR at least on android and desktop, including doing things as stage drafts with images, files, sticker etc.? so that we do not break the workflow of sending regular messages by fixing staging webxdc :) |
I'm still fixing the problem that test webxd does show the same self-addr for all webxdcs even though they should differ because of the 724mids. While doing it I can also verify that everything else works as expected. |
create mid in default remove comments
5fa9643
to
3833322
Compare
Sadly I can't build for android and desktop does not let you open the webxdc while in drafting stage so I can not test the workflow manually. But the test verifies that selfAddr is the same for draft and sent message so for bots (which the issue is about) it should be fine. @Hocuri can you test this on android? |
I tested this PR on Android. As far as I can see, this PR doesn't change the behavior of DC Android; all drafted webxdc's still have the same selfAddr ( |
We should not close #6621 however if the bug is not fixed. |
Now, if i revert |
This tests --- a/src/chat/chat_tests.rs
+++ b/src/chat/chat_tests.rs
@@ -2020,8 +2020,10 @@ async fn test_forward_basic() -> Result<()> {
forward_msgs(&bob, &[msg.id], bob_chat.get_id()).await?;
let forwarded_msg = bob.pop_sent_msg().await;
+ let msg_bob = Message::load_from_db(&bob, forwarded_msg.sender_msg_id).await?;
assert_eq!(bob_chat.id.get_msg_cnt(&bob).await?, 2);
let msg = alice.recv_msg(&forwarded_msg).await;
+ assert_eq!(msg.rfc724_mid(), msg_bob.rfc724_mid());
assert_eq!(msg.get_text(), "Hi Bob");
assert!(msg.is_forwarded());
Ok(()) |
Set
rfc724_mid
inMessage::new()
,Message::new_text()
, andMessage::default()
instead of when sending the message. This way the rfc724 mid can be read in the draft stage which makes it more consistent for bots. Tests had to be adjusted to create multiple messages to get unique mid, otherwise core would not send the messages out.close #6621