Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix files uploaded by other users not being able to be deleted by use…
…rs with permission
- Loading branch information
1 parent
1bae5c5
commit b618e77
Showing
4 changed files
with
13 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
/* global FileUpload */ | ||
Meteor.methods({ | ||
deleteFileMessage: function(fileID) { | ||
check(fileID, String); | ||
|
||
return Meteor.call('deleteMessage', RocketChat.models.Messages.getMessageByFileId(fileID)); | ||
const msg = RocketChat.models.Messages.getMessageByFileId(fileID); | ||
|
||
if (msg) { | ||
return Meteor.call('deleteMessage', msg); | ||
} | ||
|
||
return FileUpload.delete(fileID); | ||
} | ||
}); |