Merge branch 'rocketchat-lib2' into rocketchat-lib3

pull/6672/head
Guilherme Gazzo 8 years ago
commit 6640cfd9bb
  1. 14
      packages/rocketchat-lib/server/methods/deleteMessage.js
  2. 2
      packages/rocketchat-lib/server/methods/robotMethods.js

@ -32,16 +32,16 @@ Meteor.methods({
action: 'Delete_message'
});
}
let msgTs;
let currentTsDiff;
const blockDeleteInMinutes = RocketChat.settings.get('Message_AllowDeleting_BlockDeleteInMinutes');
if ((blockDeleteInMinutes != null) && blockDeleteInMinutes !== 0) {
if (originalMessage.ts != null) {
msgTs = moment(originalMessage.ts);
if (blockDeleteInMinutes != null && blockDeleteInMinutes !== 0) {
if (originalMessage.ts == null) {
return;
}
if (msgTs != null) {
currentTsDiff = moment().diff(msgTs, 'minutes');
const msgTs = moment(originalMessage.ts);
if (msgTs == null) {
return;
}
const currentTsDiff = moment().diff(msgTs, 'minutes');
if (currentTsDiff > blockDeleteInMinutes) {
throw new Meteor.Error('error-message-deleting-blocked', 'Message deleting is blocked', {
method: 'deleteMessage'

@ -20,6 +20,6 @@ Meteor.methods({
});
}
const cursor = RocketChat.models[model][method].apply(RocketChat.models[model], args);
return cursor && cursor.fetch && cursor.fetch();
return cursor && cursor.fetch ? cursor.fetch() : cursor;
}
});

Loading…
Cancel
Save