@ -166,7 +166,7 @@ define('forum/topic/postTools', [
var timestamp = parseInt ( getData ( btn , 'data-timestamp' ) , 10 ) ;
var postDeleteDuration = parseInt ( ajaxify . data . postDeleteDuration , 10 ) ;
if ( checkDuration ( postDeleteDuration , timestamp , 'post-delete-duration-expired' ) ) {
togglePostDelete ( $ ( this ) , tid );
togglePostDelete ( $ ( this ) );
}
} ) ;
@ -203,11 +203,11 @@ define('forum/topic/postTools', [
}
postContainer . on ( 'click' , '[component="post/restore"]' , function ( ) {
togglePostDelete ( $ ( this ) , tid );
togglePostDelete ( $ ( this ) );
} ) ;
postContainer . on ( 'click' , '[component="post/purge"]' , function ( ) {
purgePost ( $ ( this ) , tid );
purgePost ( $ ( this ) );
} ) ;
postContainer . on ( 'click' , '[component="post/move"]' , function ( ) {
@ -371,19 +371,19 @@ define('forum/topic/postTools', [
return slug ;
}
function togglePostDelete ( button , tid ) {
function togglePostDelete ( button ) {
var pid = getData ( button , 'data-pid' ) ;
var postEl = components . get ( 'post' , 'pid' , pid ) ;
var action = ! postEl . hasClass ( 'deleted' ) ? 'delete' : 'restore' ;
postAction ( action , pid , tid );
postAction ( action , pid );
}
function purgePost ( button , tid ) {
postAction ( 'purge' , getData ( button , 'data-pid' ) , tid );
function purgePost ( button ) {
postAction ( 'purge' , getData ( button , 'data-pid' ) );
}
function postAction ( action , pid , tid ) {
function postAction ( action , pid ) {
translator . translate ( '[[topic:post_' + action + '_confirm]]' , function ( msg ) {
bootbox . confirm ( msg , function ( confirm ) {
if ( ! confirm ) {
@ -392,7 +392,6 @@ define('forum/topic/postTools', [
socket . emit ( 'posts.' + action , {
pid : pid ,
tid : tid ,
} , function ( err ) {
if ( err ) {
app . alertError ( err . message ) ;