@@ -1673,12 +1673,12 @@ async fn add_parts(
1673
1673
}
1674
1674
}
1675
1675
1676
+ let mut chat = Chat :: load_from_db ( context, chat_id) . await ?;
1677
+
1676
1678
if mime_parser. incoming && !chat_id. is_trash ( ) {
1677
1679
// It can happen that the message is put into a chat
1678
1680
// but the From-address is not a member of this chat.
1679
1681
if !chat:: is_contact_in_chat ( context, chat_id, from_id) . await ? {
1680
- let chat = Chat :: load_from_db ( context, chat_id) . await ?;
1681
-
1682
1682
// Mark the sender as overridden.
1683
1683
// The UI will prepend `~` to the sender's name,
1684
1684
// indicating that the sender is not part of the group.
@@ -1699,7 +1699,6 @@ async fn add_parts(
1699
1699
let is_location_kml = mime_parser. location_kml . is_some ( ) ;
1700
1700
let is_mdn = !mime_parser. mdn_reports . is_empty ( ) ;
1701
1701
1702
- let mut chat = Chat :: load_from_db ( context, chat_id) . await ?;
1703
1702
let mut group_changes = match chat. typ {
1704
1703
_ if chat. id . is_special ( ) => GroupChangesInfo :: default ( ) ,
1705
1704
Chattype :: Single => GroupChangesInfo :: default ( ) ,
@@ -1864,10 +1863,7 @@ async fn add_parts(
1864
1863
None
1865
1864
} ;
1866
1865
1867
- // if a chat is protected and the message is fully downloaded, check additional properties
1868
1866
if !chat_id. is_special ( ) && is_partial_download. is_none ( ) {
1869
- let chat = Chat :: load_from_db ( context, chat_id) . await ?;
1870
-
1871
1867
// For outgoing emails in the 1:1 chat we have an exception that
1872
1868
// they are allowed to be unencrypted:
1873
1869
// 1. They can't be an attack (they are outgoing, not incoming)
@@ -1884,6 +1880,7 @@ async fn add_parts(
1884
1880
}
1885
1881
}
1886
1882
}
1883
+ drop ( chat) ; // Avoid using stale `chat` object.
1887
1884
1888
1885
let sort_timestamp = tweak_sort_timestamp (
1889
1886
context,
0 commit comments