diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js index 98b6ef1470..fa2a72e617 100644 --- a/public/src/client/topic/postTools.js +++ b/public/src/client/topic/postTools.js @@ -168,33 +168,33 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator postContainer.on('click', '[component="post/edit"]', function() { var btn = $(this); - + var timestamp = parseInt(getData(btn, 'data-timestamp'), 10); var postEditDuration = parseInt(ajaxify.data.postEditDuration, 10); - if (postEditDuration && Date.now() - timestamp > postEditDuration * 1000) { - var numDays = Math.floor(postEditDuration / 86400); + if (!ajaxify.data.privileges.isAdminOrMod && postEditDuration && Date.now() - timestamp > postEditDuration * 1000) { + var numDays = Math.floor(postEditDuration / 86400); var numHours = Math.floor((postEditDuration % 86400) / 3600); var numMinutes = Math.floor(((postEditDuration % 86400) % 3600) / 60); var numSeconds = ((postEditDuration % 86400) % 3600) % 60; var msg = '[[error:post-edit-duration-expired, ' + postEditDuration + ']]'; if (numDays) { if (numHours) { - msg = '[[error:post-edit-duration-expired-days-hours, ' + numDays + ', ' + numHours + ']]'; + msg = '[[error:post-edit-duration-expired-days-hours, ' + numDays + ', ' + numHours + ']]'; } else { msg = '[[error:post-edit-duration-expired-days, ' + numDays + ']]'; - } + } } else if (numHours) { if (numMinutes) { - msg = '[[error:post-edit-duration-expired-hours-minutes, ' + numHours + ', ' + numMinutes + ']]'; + msg = '[[error:post-edit-duration-expired-hours-minutes, ' + numHours + ', ' + numMinutes + ']]'; } else { msg = '[[error:post-edit-duration-expired-hours, ' + numHours + ']]'; - } + } } else if (numMinutes) { if (numSeconds) { - msg = '[[error:post-edit-duration-expired-minutes-seconds, ' + numMinutes + ', ' + numSeconds + ']]'; + msg = '[[error:post-edit-duration-expired-minutes-seconds, ' + numMinutes + ', ' + numSeconds + ']]'; } else { msg = '[[error:post-edit-duration-expired-minutes, ' + numMinutes + ']]'; - } + } } return app.alertError(msg); }