@@ -5089,10 +5089,8 @@ pub(crate) enum SyncAction {
5089
5089
chat_name : String ,
5090
5090
shared_secret : String ,
5091
5091
} ,
5092
- CreateInBroadcast {
5093
- chat_name : String ,
5094
- shared_secret : String ,
5095
- } ,
5092
+ /// Mark the contact with the given fingerprint as verified by self.
5093
+ MarkVerified ,
5096
5094
Rename ( String ) ,
5097
5095
/// Set chat contacts by their addresses.
5098
5096
SetContacts ( Vec < String > ) ,
@@ -5148,6 +5146,14 @@ impl Context {
5148
5146
SyncAction :: Unblock => {
5149
5147
return contact:: set_blocked ( self , Nosync , contact_id, false ) . await ;
5150
5148
}
5149
+ SyncAction :: MarkVerified => {
5150
+ return contact:: mark_contact_id_as_verified (
5151
+ self ,
5152
+ contact_id,
5153
+ ContactId :: SELF ,
5154
+ )
5155
+ . await ;
5156
+ }
5151
5157
_ => ( ) ,
5152
5158
}
5153
5159
ChatIdBlocked :: get_for_contact ( self , contact_id, Blocked :: Request )
@@ -5179,8 +5185,9 @@ impl Context {
5179
5185
SyncAction :: Accept => chat_id. accept_ex ( self , Nosync ) . await ,
5180
5186
SyncAction :: SetVisibility ( v) => chat_id. set_visibility_ex ( self , Nosync , * v) . await ,
5181
5187
SyncAction :: SetMuted ( duration) => set_muted_ex ( self , Nosync , chat_id, * duration) . await ,
5182
- SyncAction :: CreateOutBroadcast { .. } | SyncAction :: CreateInBroadcast { .. } => {
5183
- // Create action should have been handled by handle_sync_create_chat() already
5188
+ SyncAction :: CreateOutBroadcast { .. } | SyncAction :: MarkVerified => {
5189
+ // Create action should have been handled by handle_sync_create_chat() already.
5190
+ // MarkVerified action should have been handled by mark_contact_id_as_verified() already.
5184
5191
Err ( anyhow ! ( "sync_alter_chat({id:?}, {action:?}): Bad request." ) )
5185
5192
}
5186
5193
SyncAction :: Rename ( to) => rename_ex ( self , Nosync , chat_id, to) . await ,
@@ -5193,7 +5200,7 @@ impl Context {
5193
5200
}
5194
5201
5195
5202
async fn handle_sync_create_chat ( & self , action : & SyncAction , grpid : & str ) -> Result < bool > {
5196
- Ok ( match action {
5203
+ match action {
5197
5204
SyncAction :: CreateOutBroadcast {
5198
5205
chat_name,
5199
5206
shared_secret,
@@ -5206,29 +5213,10 @@ impl Context {
5206
5213
shared_secret. to_string ( ) ,
5207
5214
)
5208
5215
. await ?;
5209
- return Ok ( true ) ;
5210
- }
5211
- SyncAction :: CreateInBroadcast {
5212
- chat_name,
5213
- shared_secret,
5214
- } => {
5215
- let chat_id = ChatId :: create_multiuser_record (
5216
- self ,
5217
- Chattype :: InBroadcast ,
5218
- grpid,
5219
- chat_name,
5220
- Blocked :: Not ,
5221
- ProtectionStatus :: Unprotected ,
5222
- None ,
5223
- smeared_time ( self ) ,
5224
- )
5225
- . await ?;
5226
- save_broadcast_shared_secret ( self , chat_id, shared_secret) . await ?;
5227
-
5228
- return Ok ( true ) ;
5216
+ Ok ( true )
5229
5217
}
5230
- _ => false ,
5231
- } )
5218
+ _ => Ok ( false ) ,
5219
+ }
5232
5220
}
5233
5221
5234
5222
/// Emits the appropriate `MsgsChanged` event. Should be called if the number of unnoticed
0 commit comments