Skip to content
Snippets Groups Projects
Unverified Commit f7513fae authored by matthias4217's avatar matthias4217 Committed by GitHub
Browse files

[FIX] Not showing edit message button when blocking edit after N minutes (#25724)


Co-authored-by: default avatarDiego Sampaio <chinello@gmail.com>
parent 6c0864fa
No related branches found
No related tags found
No related merge requests found
......@@ -50,13 +50,13 @@ Meteor.methods({
let currentTsDiff;
let msgTs;
if (Match.test(originalMessage.ts, Number)) {
if (originalMessage.ts instanceof Date || Match.test(originalMessage.ts, Number)) {
msgTs = moment(originalMessage.ts);
}
if (msgTs) {
currentTsDiff = moment().diff(msgTs, 'minutes');
}
if (currentTsDiff > blockEditInMinutes) {
if (currentTsDiff >= blockEditInMinutes) {
throw new Meteor.Error('error-message-editing-blocked', 'Message editing is blocked', {
method: 'updateMessage',
});
......
......@@ -171,7 +171,7 @@ Meteor.startup(async function () {
if (msgTs != null) {
currentTsDiff = moment().diff(msgTs, 'minutes');
}
return !!currentTsDiff && currentTsDiff < blockEditInMinutes;
return (!!currentTsDiff || currentTsDiff === 0) && currentTsDiff < blockEditInMinutes;
}
return true;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment