File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -90,12 +90,14 @@ export default Factory.extend<MirageRegistrationProvider & RegistrationProviderT
9090 } ) ,
9191 currentUserIsModerator : trait < RegistrationProvider > ( {
9292 afterCreate ( provider , server ) {
93- const { currentUserId, currentUser } = server . schema . roots . first ( ) ;
94- const moderator = server . create ( 'moderator' , { id : currentUserId , user : currentUser ! } ) ;
95- provider . update ( {
96- moderators : [ moderator ] ,
97- permissions : [ ReviewPermissions . ViewSubmissions ] ,
98- } ) ;
93+ if ( server . schema . roots . first ( ) ) {
94+ const { currentUserId, currentUser } = server . schema . roots . first ( ) ;
95+ const moderator = server . create ( 'moderator' , { id : currentUserId , user : currentUser ! } ) ;
96+ provider . update ( {
97+ moderators : [ moderator ] ,
98+ permissions : [ ReviewPermissions . ViewSubmissions ] ,
99+ } ) ;
100+ }
99101 } ,
100102 } ) ,
101103} ) ;
You can’t perform that action at this time.
0 commit comments