Skip to content

Commit

Permalink
Regression: Files were been deleted when deleting users as last membe…
Browse files Browse the repository at this point in the history
…rs of private rooms (#17111)
  • Loading branch information
rodrigok authored Mar 31, 2020
1 parent 4a1dedc commit ca85376
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/file-upload/server/lib/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ export const FileUpload = {
},

removeFilesByRoomId(rid) {
if (typeof rid !== 'string' || rid.trim().length === 0) {
return;
}
Messages.find({
rid,
'file._id': {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/server/functions/deleteUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const deleteUser = function(userId) {

// Remove non-channel rooms with only 1 user (the one being deleted)
return roomData.t !== 'c' && roomData.subscribers === 1;
}).map(({ _id }) => _id);
}).map(({ rid }) => rid);

Rooms.find1On1ByUserId(user._id, { fields: { _id: 1 } }).forEach(({ _id }) => roomIds.push(_id));

Expand Down

0 comments on commit ca85376

Please sign in to comment.