File tree Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -765,27 +765,19 @@ impl ChatId {
765
765
) ;
766
766
767
767
let chat = Chat :: load_from_db ( context, self ) . await ?;
768
- context
769
- . sql
770
- . execute (
771
- "DELETE FROM msgs_mdns WHERE msg_id IN (SELECT id FROM msgs WHERE chat_id=?);" ,
772
- ( self , ) ,
773
- )
774
- . await ?;
775
-
776
- context
777
- . sql
778
- . execute ( "DELETE FROM msgs WHERE chat_id=?;" , ( self , ) )
779
- . await ?;
780
768
781
769
context
782
770
. sql
783
- . execute ( "DELETE FROM chats_contacts WHERE chat_id=?;" , ( self , ) )
784
- . await ?;
785
-
786
- context
787
- . sql
788
- . execute ( "DELETE FROM chats WHERE id=?;" , ( self , ) )
771
+ . transaction ( |transaction| {
772
+ transaction. execute (
773
+ "DELETE FROM msgs_mdns WHERE msg_id IN (SELECT id FROM msgs WHERE chat_id=?)" ,
774
+ ( self , ) ,
775
+ ) ?;
776
+ transaction. execute ( "DELETE FROM msgs WHERE chat_id=?" , ( self , ) ) ?;
777
+ transaction. execute ( "DELETE FROM chats_contacts WHERE chat_id=?" , ( self , ) ) ?;
778
+ transaction. execute ( "DELETE FROM chats WHERE id=?" , ( self , ) ) ?;
779
+ Ok ( ( ) )
780
+ } )
789
781
. await ?;
790
782
791
783
context. emit_msgs_changed_without_ids ( ) ;
You can’t perform that action at this time.
0 commit comments