Skip to content
Snippets Groups Projects
Commit 79c44ef4 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #2351 from greezybacon/issue/2343


lock: Fix missing shutdown on navigation

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents f3244b5b ef42e386
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@
// attempt to fetch one (lazily)
$(':input', this.$element).on('keyup, change', this.acquire.bind(this));
$(':submit', this.$element).click(this.ensureLocked.bind(this));
$(document).on('pjax:start', this.shutdown.bind(this));
// If lock already held, assume full time of lock remains, but warn
// user about pending expiration
......@@ -118,14 +119,18 @@
data: 'delete',
async: false,
cache: false,
always: $.proxy(this.destroy, this)
complete: this.destroy.bind(this)
});
},
destroy: function() {
shutdown: function() {
clearTimeout(this.warning);
clearTimeout(this.retryTimer);
$(window).off('.exclusive');
$(document).off('.exclusive');
},
destroy: function() {
this.shutdown();
delete this.lockId;
$(this.options.lockInput, this.$element).val('');
},
......@@ -141,8 +146,8 @@
}
if (!this.lockId) {
// Set up release on away navigation
$(window).off('.exclusive');
$(window).on('pjax:click.exclusive', $.proxy(this.release, this));
$(document).off('.exclusive');
$(document).on('pjax:click.exclusive', $.proxy(this.release, this));
}
this.lockId = lock.id;
......
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