@@ -946,14 +946,11 @@ async fn add_parts(
946
946
chat_id = Some ( chat. id ) ;
947
947
chat_id_blocked = chat. blocked ;
948
948
} else if allow_creation {
949
- if let Ok ( chat) = ChatIdBlocked :: get_for_contact ( context, from_id, create_blocked)
949
+ let chat = ChatIdBlocked :: get_for_contact ( context, from_id, create_blocked)
950
950
. await
951
- . context ( "Failed to get (new) chat for contact" )
952
- . log_err ( context)
953
- {
954
- chat_id = Some ( chat. id ) ;
955
- chat_id_blocked = chat. blocked ;
956
- }
951
+ . context ( "Failed to get (new) chat for contact" ) ?;
952
+ chat_id = Some ( chat. id ) ;
953
+ chat_id_blocked = chat. blocked ;
957
954
}
958
955
959
956
if let Some ( chat_id) = chat_id {
@@ -1149,9 +1146,8 @@ async fn add_parts(
1149
1146
chat_id = Some ( id) ;
1150
1147
chat_id_blocked = blocked;
1151
1148
}
1152
- } else if let Ok ( chat) =
1153
- ChatIdBlocked :: get_for_contact ( context, to_id, Blocked :: Not ) . await
1154
- {
1149
+ } else {
1150
+ let chat = ChatIdBlocked :: get_for_contact ( context, to_id, Blocked :: Not ) . await ?;
1155
1151
chat_id = Some ( chat. id ) ;
1156
1152
chat_id_blocked = chat. blocked ;
1157
1153
}
@@ -1167,7 +1163,7 @@ async fn add_parts(
1167
1163
if chat_id_blocked != Blocked :: Not {
1168
1164
if let Some ( chat_id) = chat_id {
1169
1165
chat_id. unblock_ex ( context, Nosync ) . await ?;
1170
- chat_id_blocked = Blocked :: Not ;
1166
+ // Not assigning ` chat_id_blocked = Blocked::Not` to avoid unused_assignments warning.
1171
1167
}
1172
1168
}
1173
1169
}
@@ -1204,20 +1200,15 @@ async fn add_parts(
1204
1200
if chat_id. is_none ( ) && self_sent {
1205
1201
// from_id==to_id==ContactId::SELF - this is a self-sent messages,
1206
1202
// maybe an Autocrypt Setup Message
1207
- if let Ok ( chat) = ChatIdBlocked :: get_for_contact ( context, ContactId :: SELF , Blocked :: Not )
1203
+ let chat = ChatIdBlocked :: get_for_contact ( context, ContactId :: SELF , Blocked :: Not )
1208
1204
. await
1209
- . context ( "Failed to get (new) chat for contact" )
1210
- . log_err ( context)
1211
- {
1212
- chat_id = Some ( chat. id ) ;
1213
- chat_id_blocked = chat. blocked ;
1214
- }
1205
+ . context ( "Failed to get (new) chat for contact" ) ?;
1215
1206
1216
- if let Some ( chat_id ) = chat_id {
1217
- if Blocked :: Not != chat_id_blocked {
1218
- chat_id . unblock_ex ( context , Nosync ) . await ? ;
1219
- // Not assigning `chat_id_blocked = Blocked::Not` to avoid unused_assignments warning.
1220
- }
1207
+ chat_id = Some ( chat . id ) ;
1208
+ // Not assigning `chat_id_blocked = chat.blocked` to avoid unused_assignments warning.
1209
+
1210
+ if Blocked :: Not != chat . blocked {
1211
+ chat . id . unblock_ex ( context , Nosync ) . await ? ;
1221
1212
}
1222
1213
}
1223
1214
}
0 commit comments