fixing error message display revealed by testing remaining time display function

This commit is contained in:
El RIDO 2017-11-14 06:52:12 +01:00
parent 86ecdb1155
commit 73bc685178
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
4 changed files with 46 additions and 4 deletions

View File

@ -1365,7 +1365,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
];
Alert.showRemaining([expirationLabel, expiration[0]]);
$remainingTime.removeClass('foryoureyesonly')
$remainingTime.removeClass('foryoureyesonly');
} else {
// never expires
return;
@ -3982,7 +3982,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
Uploader.setUnencryptedData('deletetoken', deleteToken);
Uploader.setFailure(function () {
Controller.showError(I18n._('Could not delete the paste, it was not stored in burn after reading mode.'));
Alert.showError(I18n._('Could not delete the paste, it was not stored in burn after reading mode.'));
})
Uploader.run();
}

View File

@ -1198,5 +1198,47 @@ describe('PasteStatus', function () {
}
);
});
describe('showRemainingTime', function () {
this.timeout(30000);
before(function () {
cleanup();
});
jsc.property(
'shows burn after reading message or remaining time',
'bool',
'nat',
jsc.nearray(jsc.elements(a2zString)),
jsc.nearray(jsc.elements(a2zString)),
jsc.array(jsc.elements(queryString)),
'string',
function (
burnafterreading, remaining_time,
schema, address, query, fragment
) {
var clean = jsdom('', {
url: schema.join('') + '://' + address.join('') +
'/?' + queryString + '#' + fragment
});
$('body').html('<div id="remainingtime" class="hidden"></div>');
$.PrivateBin.PasteStatus.init();
$.PrivateBin.PasteStatus.showRemainingTime({
'burnafterreading': burnafterreading,
'remaining_time': remaining_time,
'expire_date': ((new Date()).getTime() / 1000) + remaining_time
});
if (burnafterreading) {
var result = $('#remainingtime').hasClass('foryoureyesonly') &&
!$('#remainingtime').hasClass('hidden');
} else {
var result =!$('#remainingtime').hasClass('foryoureyesonly') &&
!$('#remainingtime').hasClass('hidden');
}
clean();
return result;
}
);
});
});

View File

@ -69,7 +69,7 @@ if ($MARKDOWN):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-o8cPnAUDs/kjS8bCGGJk43T9OCGpS3qaJny4xvMMXzWV4jvoXB8GKWlHeRe3mb5MagYcu1rkmcyN9mP1TqE6ng==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-cOGGzUWy00SQ6bKzceNOd9+tGo584PTWclR+J+uQE7Rux/jkJVW6yEj7sbIIoalACxC+8QngzxdEfpy8iO9CkA==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->

View File

@ -47,7 +47,7 @@ if ($MARKDOWN):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-o8cPnAUDs/kjS8bCGGJk43T9OCGpS3qaJny4xvMMXzWV4jvoXB8GKWlHeRe3mb5MagYcu1rkmcyN9mP1TqE6ng==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-cOGGzUWy00SQ6bKzceNOd9+tGo584PTWclR+J+uQE7Rux/jkJVW6yEj7sbIIoalACxC+8QngzxdEfpy8iO9CkA==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->