@@ -15,8 +15,8 @@ import {
15
15
} from '@rocket.chat/rest-typings' ;
16
16
import { escapeRegExp } from '@rocket.chat/string-helpers' ;
17
17
import { Match , check } from 'meteor/check' ;
18
- import { Meteor } from 'meteor/meteor' ;
19
18
19
+ import { eraseRoom } from '../../../../server/lib/eraseRoom' ;
20
20
import { canAccessRoomAsync } from '../../../authorization/server' ;
21
21
import { hasPermissionAsync , hasAtLeastOnePermissionAsync } from '../../../authorization/server/functions/hasPermission' ;
22
22
import { removeUserFromRoom } from '../../../lib/server/functions/removeUserFromRoom' ;
@@ -136,7 +136,7 @@ API.v1.addRoute(
136
136
137
137
if ( rooms . length ) {
138
138
for await ( const room of rooms ) {
139
- await Meteor . callAsync ( ' eraseRoom' , room ) ;
139
+ await eraseRoom ( room , this . userId ) ;
140
140
}
141
141
}
142
142
@@ -652,15 +652,15 @@ API.v1.addRoute(
652
652
// If we got a list of rooms to delete along with the team, remove them first
653
653
if ( rooms . length ) {
654
654
for await ( const room of rooms ) {
655
- await Meteor . callAsync ( ' eraseRoom' , room ) ;
655
+ await eraseRoom ( room , this . userId ) ;
656
656
}
657
657
}
658
658
659
659
// Move every other room back to the workspace
660
660
await Team . unsetTeamIdOfRooms ( this . userId , team . _id ) ;
661
661
662
662
// Remove the team's main room
663
- await Meteor . callAsync ( ' eraseRoom' , team . roomId ) ;
663
+ await eraseRoom ( team . roomId , this . userId ) ;
664
664
665
665
// Delete all team memberships
666
666
await Team . removeAllMembersFromTeam ( team . _id ) ;
0 commit comments