Skip to content

Commit 21d13e8

Browse files
authored
fix: Don't change webxdc self-addr when saving and loading draft (#6854)
Fix #6621; I also tested on Android that the webxdc self-addr actually stays the same when staging a draft and then sending. Follow-up to #6704; #6704 made sure that the webxdc self-addr doesn't change when creating a message and then sending it. This PR here makes sure that the rfc724_mid (which is needed to compute the self-addr) is saved when setting a draft, so that it's loaded properly after a call to get_draft(). cc @adbenitez @r10s @Septias
1 parent 079260a commit 21d13e8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/chat.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ impl ChatId {
995995
transaction.execute(
996996
"INSERT INTO msgs (
997997
chat_id,
998+
rfc724_mid,
998999
from_id,
9991000
timestamp,
10001001
type,
@@ -1004,9 +1005,10 @@ impl ChatId {
10041005
param,
10051006
hidden,
10061007
mime_in_reply_to)
1007-
VALUES (?,?,?,?,?,?,?,?,?,?);",
1008+
VALUES (?,?,?,?,?,?,?,?,?,?,?);",
10081009
(
10091010
self,
1011+
&msg.rfc724_mid,
10101012
ContactId::SELF,
10111013
time(),
10121014
msg.viewtype,

src/webxdc/webxdc_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,6 +2210,7 @@ async fn test_self_addr_consistency() -> Result<()> {
22102210
include_bytes!("../../test-data/webxdc/minimal.xdc"),
22112211
)?;
22122212
alice_chat.set_draft(alice, Some(&mut instance)).await?;
2213+
let mut instance = alice_chat.get_draft(alice).await?.unwrap();
22132214
let self_addr = instance.get_webxdc_self_addr(alice).await?;
22142215
let sent = alice.send_msg(alice_chat, &mut instance).await;
22152216
let db_msg = Message::load_from_db(alice, sent.sender_msg_id).await?;

0 commit comments

Comments
 (0)