Don't use idstring in messages when it's not necessary

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König
2023-01-20 15:03:14 +01:00
parent acac90f79d
commit 4473955291
6 changed files with 72 additions and 32 deletions

View File

@@ -338,7 +338,7 @@ function delMsg(ids) {
utils.disableAll();
var idstring = ids.join(", ");
utils.showAlert("info", "", "Deleting message with ID: " + idstring, "...");
utils.showAlert("info", "", "Deleting message(s)...");
$.ajax({
url: "scripts/pi-hole/php/message.php",
@@ -349,19 +349,19 @@ function delMsg(ids) {
.done(function (response) {
utils.enableAll();
if (response.success) {
utils.showAlert(
"success",
"far fa-trash-alt",
"Successfully deleted messages: " + idstring,
""
);
utils.showAlert("success", "far fa-trash-alt", "Successfully deleted message(s)", "");
for (var id in ids) {
if (Object.hasOwnProperty.call(ids, id)) {
table.row(id).remove().draw(false).ajax.reload(null, false);
}
}
} else {
utils.showAlert("error", "", "Error while deleting message: " + idstring, response.message);
utils.showAlert(
"error",
"",
"Error while deleting message(s): " + idstring,
response.message
);
}
// Clear selection after deletion
@@ -373,7 +373,12 @@ function delMsg(ids) {
)
.fail(function (jqXHR, exception) {
utils.enableAll();
utils.showAlert("error", "", "Error while deleting message: " + idstring, jqXHR.responseText);
utils.showAlert(
"error",
"",
"Error while deleting message(s): " + idstring,
jqXHR.responseText
);
console.log(exception); // eslint-disable-line no-console
});
}