Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

force hard refresh after submit

jackmaessenjackmaessen ✭✭✭
edited January 2015 in Vanilla 2.0 - 2.8

I still had problems loading geshi syntax highlighting, mark V plugin ( @hgtonight made this) and signatures after submitting and editing a comment. They all needed a hard refresh. So i was looking for a way to force this refresh.

In the file: applications/vanilla/js/discussion.js there is this function:

// Hijack comment form button clicks.
   var draftSaving = 0;
$('.CommentButton, a.PreviewButton, a.DraftButton').livequery('click', function() {
// rest of code

I seperated the CommentButton from it and created the same function with at the end a window.location.reload();

/* submit buttons need a hard refresh */
    $('.CommentButton').livequery('click', function() {
// rest of the code and at the end
complete: function(XMLHttpRequest, textStatus) {
            // Remove any spinners, and re-enable buttons.
            $(':submit', frm).removeClass('InProgress');
            $('.DraftButton', frm).removeClass('InProgress');
            $(frm).find(':submit').removeAttr("disabled");
            if (draft)
               draftSaving--;
               window.location.reload(); /* force the refresh*/

         }
      });

I know this is not a proper way to do it because i edited one of the core files. Maybe someone knows a way to get the same result with a more proper way?

Comments

Sign In or Register to comment.