diff --git a/CHANGELOG.md b/CHANGELOG.md index 56c758fd..ad21e86a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # PrivateBin version history ## 1.7.3 (not yet released) +* FIXED: Selected expiration not being applied, when using bootstrap template (#1309) ## 1.7.2 (2024-05-05) * ADDED: Allow use of `shortenviayourls` in query parameters (#1267) diff --git a/js/privatebin.js b/js/privatebin.js index 0f9096d9..dbe74e7c 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -4371,7 +4371,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { */ me.getExpiration = function() { - return Model.getExpirationDefault() || pasteExpiration; + return pasteExpiration; }; /** @@ -4554,6 +4554,10 @@ jQuery.PrivateBin = (function($, RawDeflate) { // bootstrap template drop downs $('ul.dropdown-menu li a', $('#expiration').parent()).click(updateExpiration); $('ul.dropdown-menu li a', $('#formatter').parent()).click(updateFormat); + // bootstrap5 & page drop downs + $('#pasteExpiration').on('change', function() { + pasteExpiration = Model.getExpirationDefault(); + }); $('#pasteFormatter').on('change', function() { PasteViewer.setFormat(Model.getFormatDefault()); }); @@ -4565,7 +4569,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { // get default values from template or fall back to set value burnAfterReadingDefault = me.getBurnAfterReading(); openDiscussionDefault = me.getOpenDiscussion(); - pasteExpiration = Model.getExpirationDefault() || pasteExpiration; + pasteExpiration = Model.getExpirationDefault(); createButtonsDisplayed = false; viewButtonsDisplayed = false; diff --git a/js/test/TopNav.js b/js/test/TopNav.js index 2743bf60..d5571888 100644 --- a/js/test/TopNav.js +++ b/js/test/TopNav.js @@ -456,8 +456,14 @@ describe('TopNav', function () { it( 'returns the currently selected expiration date', function () { + $('body').html( + '' + ); $.PrivateBin.TopNav.init(); - assert.ok($.PrivateBin.TopNav.getExpiration() === null); + assert.ok($.PrivateBin.TopNav.getExpiration() === '1day'); + cleanup(); } ); }); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 4c5ee23a..e9adc435 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; ?> - + diff --git a/tpl/bootstrap5.php b/tpl/bootstrap5.php index dee10744..84ac6aa9 100644 --- a/tpl/bootstrap5.php +++ b/tpl/bootstrap5.php @@ -57,7 +57,7 @@ endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index 88953d3f..82805f83 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -51,7 +51,7 @@ endif; ?> - +