diff --git a/js/privatebin.js b/js/privatebin.js
index 9beb3d99..c18bdfea 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -3508,6 +3508,8 @@ jQuery.PrivateBin = (function($, RawDeflate) {
let createButtonsDisplayed = false,
viewButtonsDisplayed = false,
+ burnAfterReadingDefault = false,
+ openDiscussionDefault = false,
$attach,
$burnAfterReading,
$burnAfterReadingOption,
@@ -4152,11 +4154,10 @@ jQuery.PrivateBin = (function($, RawDeflate) {
me.resetInput = function()
{
clearAttachmentInput();
-
- $openDiscussion.prop('checked', false);
- $burnAfterReading.prop('checked', false);
- $openDiscussionOption.removeClass('buttondisabled');
- $burnAfterReadingOption.removeClass('buttondisabled');
+ $burnAfterReading.prop('checked', burnAfterReadingDefault);
+ $openDiscussion.prop('checked', openDiscussionDefault);
+ if (openDiscussionDefault) $openDiscussionOption.removeClass('buttondisabled');
+ if (burnAfterReadingDefault) $burnAfterReadingOption.removeClass('buttondisabled');
// TODO: reset expiration time
};
@@ -4356,7 +4357,9 @@ jQuery.PrivateBin = (function($, RawDeflate) {
changeBurnAfterReading();
changeOpenDiscussion();
- // get default value from template or fall back to set value
+ // get default values from template or fall back to set value
+ burnAfterReadingDefault = me.getBurnAfterReading();
+ openDiscussionDefault = me.getOpenDiscussion();
pasteExpiration = Model.getExpirationDefault() || pasteExpiration;
createButtonsDisplayed = false;
diff --git a/js/test/TopNav.js b/js/test/TopNav.js
index 314d5ce6..29639643 100644
--- a/js/test/TopNav.js
+++ b/js/test/TopNav.js
@@ -363,7 +363,7 @@ describe('TopNav', function () {
);
it(
- 'reset inputs to defaults (options on)',
+ 'reset inputs to defaults (burnafterreading on)',
function () {
var results = [];
$('body').html(
@@ -380,10 +380,9 @@ describe('TopNav', function () {
$.PrivateBin.TopNav.getBurnAfterReading()
);
results.push(
- $.PrivateBin.TopNav.getOpenDiscussion()
+ !$.PrivateBin.TopNav.getOpenDiscussion()
);
$('#burnafterreading').removeAttr('checked');
- $('#opendiscussion').removeAttr('checked');
results.push(
!$.PrivateBin.TopNav.getBurnAfterReading()
);
@@ -394,6 +393,46 @@ describe('TopNav', function () {
results.push(
$.PrivateBin.TopNav.getBurnAfterReading()
);
+ results.push(
+ !$.PrivateBin.TopNav.getOpenDiscussion()
+ );
+ cleanup();
+ assert.ok(results.every(element => element));
+ }
+ );
+
+ it(
+ 'reset inputs to defaults (opendiscussion on)',
+ function () {
+ var results = [];
+ $('body').html(
+ ''
+ );
+ $.PrivateBin.TopNav.init();
+ results.push(
+ !$.PrivateBin.TopNav.getBurnAfterReading()
+ );
+ results.push(
+ $.PrivateBin.TopNav.getOpenDiscussion()
+ );
+ $('#opendiscussion').removeAttr('checked');
+ $('#burnafterreading').prop('checked', true);
+ results.push(
+ $.PrivateBin.TopNav.getBurnAfterReading()
+ );
+ results.push(
+ !$.PrivateBin.TopNav.getOpenDiscussion()
+ );
+ $.PrivateBin.TopNav.resetInput();
+ results.push(
+ !$.PrivateBin.TopNav.getBurnAfterReading()
+ );
results.push(
$.PrivateBin.TopNav.getOpenDiscussion()
);
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index 7fed83fc..81bc3554 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -72,7 +72,7 @@ endif;
?>
-
+
diff --git a/tpl/page.php b/tpl/page.php
index 8361a538..c139f9c0 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -50,7 +50,7 @@ endif;
?>
-
+