@@ -29,6 +29,7 @@ import { VerseRefData } from 'realtime-server/lib/esm/scriptureforge/models/vers
2929import { of } from 'rxjs' ;
3030import { anything , mock , resetCalls , verify , when } from 'ts-mockito' ;
3131import { DialogService } from 'xforge-common/dialog.service' ;
32+ import { DocSubscription } from 'xforge-common/models/realtime-doc' ;
3233import { NoticeService } from 'xforge-common/notice.service' ;
3334import { OnlineStatusService } from 'xforge-common/online-status.service' ;
3435import { noopDestroyRef } from 'xforge-common/realtime.service' ;
@@ -420,7 +421,8 @@ describe('CheckingOverviewComponent', () => {
420421 const env = new TestEnvironment ( ) ;
421422 const questionDoc : QuestionDoc = env . realtimeService . get (
422423 QuestionDoc . COLLECTION ,
423- getQuestionDocId ( 'project01' , 'q7Id' )
424+ getQuestionDocId ( 'project01' , 'q7Id' ) ,
425+ new DocSubscription ( 'spec' )
424426 ) ;
425427 await questionDoc . submitJson0Op ( op => {
426428 op . set ( d => d . isArchived , false ) ;
@@ -973,18 +975,26 @@ class TestEnvironment {
973975 when ( mockedActivatedRoute . params ) . thenReturn ( of ( { projectId : 'project01' } ) ) ;
974976 when ( mockedQuestionDialogService . questionDialog ( anything ( ) ) ) . thenResolve ( ) ;
975977 when ( mockedDialogService . confirm ( anything ( ) , anything ( ) ) ) . thenResolve ( true ) ;
976- when ( mockedProjectService . getProfile ( anything ( ) ) ) . thenCall ( id =>
977- this . realtimeService . subscribe ( SFProjectProfileDoc . COLLECTION , id )
978+ when ( mockedProjectService . getProfile ( anything ( ) , anything ( ) ) ) . thenCall ( ( id , subscription ) =>
979+ this . realtimeService . subscribe ( SFProjectProfileDoc . COLLECTION , id , subscription )
978980 ) ;
979- when ( mockedProjectService . getUserConfig ( anything ( ) , anything ( ) ) ) . thenCall ( ( id , userId ) =>
980- this . realtimeService . subscribe ( SFProjectUserConfigDoc . COLLECTION , getSFProjectUserConfigDocId ( id , userId ) )
981+ when ( mockedProjectService . getUserConfig ( anything ( ) , anything ( ) , anything ( ) ) ) . thenCall ( ( id , userId , subscriber ) =>
982+ this . realtimeService . subscribe (
983+ SFProjectUserConfigDoc . COLLECTION ,
984+ getSFProjectUserConfigDocId ( id , userId ) ,
985+ subscriber
986+ )
981987 ) ;
982988 when ( mockedQuestionsService . queryQuestions ( 'project01' , anything ( ) , anything ( ) ) ) . thenCall ( ( ) =>
983989 this . realtimeService . subscribeQuery ( QuestionDoc . COLLECTION , { } , noopDestroyRef )
984990 ) ;
985991 when ( mockedProjectService . onlineDeleteAudioTimingData ( anything ( ) , anything ( ) , anything ( ) ) ) . thenCall (
986992 ( projectId , book , chapter ) => {
987- const projectDoc = this . realtimeService . get < SFProjectProfileDoc > ( SFProjectProfileDoc . COLLECTION , projectId ) ;
993+ const projectDoc = this . realtimeService . get < SFProjectProfileDoc > (
994+ SFProjectProfileDoc . COLLECTION ,
995+ projectId ,
996+ new DocSubscription ( 'spec' )
997+ ) ;
988998 const textIndex : number = projectDoc . data ! . texts . findIndex ( t => t . bookNum === book ) ;
989999 const chapterIndex : number = projectDoc . data ! . texts [ textIndex ] . chapters . findIndex ( c => c . number === chapter ) ;
9901000 projectDoc . submitJson0Op ( op => op . set ( p => p . texts [ textIndex ] . chapters [ chapterIndex ] . hasAudio , false ) , false ) ;
@@ -1154,7 +1164,11 @@ class TestEnvironment {
11541164 }
11551165
11561166 setSeeOtherUserResponses ( isEnabled : boolean ) : void {
1157- const projectDoc = this . realtimeService . get < SFProjectProfileDoc > ( SFProjectProfileDoc . COLLECTION , 'project01' ) ;
1167+ const projectDoc = this . realtimeService . get < SFProjectProfileDoc > (
1168+ SFProjectProfileDoc . COLLECTION ,
1169+ 'project01' ,
1170+ new DocSubscription ( 'spec' )
1171+ ) ;
11581172 projectDoc . submitJson0Op (
11591173 op => op . set < boolean > ( p => p . checkingConfig . usersSeeEachOthersResponses , isEnabled ) ,
11601174 false
@@ -1164,7 +1178,11 @@ class TestEnvironment {
11641178
11651179 setCheckingEnabled ( isEnabled : boolean ) : void {
11661180 this . ngZone . run ( ( ) => {
1167- const projectDoc = this . realtimeService . get < SFProjectProfileDoc > ( SFProjectProfileDoc . COLLECTION , 'project01' ) ;
1181+ const projectDoc = this . realtimeService . get < SFProjectProfileDoc > (
1182+ SFProjectProfileDoc . COLLECTION ,
1183+ 'project01' ,
1184+ new DocSubscription ( 'spec' )
1185+ ) ;
11681186 projectDoc . submitJson0Op ( op => op . set < boolean > ( p => p . checkingConfig . checkingEnabled , isEnabled ) , false ) ;
11691187 } ) ;
11701188 this . waitForProjectDocChanges ( ) ;
@@ -1224,7 +1242,11 @@ class TestEnvironment {
12241242 ] ,
12251243 permissions : { }
12261244 } ;
1227- const projectDoc = this . realtimeService . get < SFProjectProfileDoc > ( SFProjectProfileDoc . COLLECTION , 'project01' ) ;
1245+ const projectDoc = this . realtimeService . get < SFProjectProfileDoc > (
1246+ SFProjectProfileDoc . COLLECTION ,
1247+ 'project01' ,
1248+ new DocSubscription ( 'spec' )
1249+ ) ;
12281250 const index : number = projectDoc . data ! . texts . length - 1 ;
12291251 projectDoc . submitJson0Op ( op => op . insert ( p => p . texts , index , text ) , false ) ;
12301252 this . addQuestion ( {
0 commit comments