@@ -137,7 +137,7 @@ impl RepoHandle {
137
137
pub fn new_document ( & self ) -> DocHandle {
138
138
let document_id = DocumentId :: random ( ) ;
139
139
let document = new_document ( ) ;
140
- let doc_info = self . new_document_info ( document, DocState :: LocallyCreatedNotEdited ) ;
140
+ let doc_info = self . new_document_info ( document, DocState :: Sync ( vec ! [ ] ) ) ;
141
141
let handle = DocHandle :: new (
142
142
self . repo_sender . clone ( ) ,
143
143
document_id. clone ( ) ,
@@ -316,11 +316,6 @@ pub(crate) enum DocState {
316
316
resolver : RepoFutureResolver < Result < Option < DocHandle > , RepoError > > ,
317
317
storage_fut : BoxFuture < ' static , Result < Option < Vec < u8 > > , StorageError > > ,
318
318
} ,
319
- /// A document that has been locally created,
320
- /// and not edited yet,
321
- /// should not be synced
322
- /// until it has been locally edited.
323
- LocallyCreatedNotEdited ,
324
319
/// The doc is syncing(can be edited locally),
325
320
/// and polling pending storage save operations.
326
321
Sync ( Vec < BoxFuture < ' static , Result < ( ) , StorageError > > > ) ,
@@ -341,7 +336,6 @@ impl fmt::Debug for DocState {
341
336
f. write_str ( & input)
342
337
}
343
338
DocState :: LoadPending { .. } => f. write_str ( "DocState::LoadPending" ) ,
344
- DocState :: LocallyCreatedNotEdited => f. write_str ( "DocState::LocallyCreatedNotEdited" ) ,
345
339
DocState :: Sync ( _) => f. write_str ( "DocState::Sync" ) ,
346
340
DocState :: PendingRemoval ( _) => f. write_str ( "DocState::PendingRemoval" ) ,
347
341
DocState :: Error => f. write_str ( "DocState::Error" ) ,
@@ -655,10 +649,7 @@ impl DocumentInfo {
655
649
656
650
fn start_pending_removal ( & mut self ) {
657
651
self . state = match & mut self . state {
658
- DocState :: LocallyCreatedNotEdited
659
- | DocState :: Error
660
- | DocState :: LoadPending { .. }
661
- | DocState :: Bootstrap { .. } => {
652
+ DocState :: Error | DocState :: LoadPending { .. } | DocState :: Bootstrap { .. } => {
662
653
assert_eq ! ( self . changes_since_last_compact, 0 ) ;
663
654
DocState :: PendingRemoval ( vec ! [ ] )
664
655
}
@@ -1387,10 +1378,6 @@ impl Repo {
1387
1378
if info. note_changes ( ) {
1388
1379
self . documents_with_changes . push ( doc_id. clone ( ) ) ;
1389
1380
}
1390
- let is_first_edit = matches ! ( info. state, DocState :: LocallyCreatedNotEdited ) ;
1391
- if is_first_edit {
1392
- info. state = DocState :: Sync ( vec ! [ ] ) ;
1393
- }
1394
1381
for ( to_repo_id, message) in info. generate_sync_messages ( ) . into_iter ( ) {
1395
1382
let outgoing = NetworkMessage :: Sync {
1396
1383
from_repo_id : local_repo_id. clone ( ) ,
@@ -1404,18 +1391,16 @@ impl Repo {
1404
1391
. push_back ( outgoing) ;
1405
1392
self . sinks_to_poll . insert ( to_repo_id) ;
1406
1393
}
1407
- if is_first_edit {
1408
- // Send a sync message to all other repos we are connected with and with
1409
- // whom we should share this document
1410
- Self :: enqueue_share_decisions (
1411
- self . remote_repos . keys ( ) ,
1412
- & mut self . pending_share_decisions ,
1413
- & mut self . share_decisions_to_poll ,
1414
- self . share_policy . as_ref ( ) ,
1415
- doc_id. clone ( ) ,
1416
- ShareType :: Announce ,
1417
- ) ;
1418
- }
1394
+ // Send a sync message to all other repos we are connected with and with
1395
+ // whom we should share this document
1396
+ Self :: enqueue_share_decisions (
1397
+ self . remote_repos . keys ( ) ,
1398
+ & mut self . pending_share_decisions ,
1399
+ & mut self . share_decisions_to_poll ,
1400
+ self . share_policy . as_ref ( ) ,
1401
+ doc_id. clone ( ) ,
1402
+ ShareType :: Announce ,
1403
+ ) ;
1419
1404
}
1420
1405
}
1421
1406
RepoEvent :: DocClosed ( doc_id) => {
0 commit comments