swapping to delete all button if all mail is queued to claim

removing delete button if all mail is queued to delete
only marking to claim/delete if not already marked
This commit is contained in:
Miodec 2022-10-02 23:22:37 +02:00
parent d33413bf23
commit 0738c2d8ea

View file

@ -352,7 +352,7 @@ function updateClaimDeleteAllButton(): void {
if (accountAlerts.length > 0) {
let rewardsCount = 0;
for (const ie of accountAlerts) {
if (ie.read === false) {
if (ie.read === false && !mailToMarkRead.includes(ie.id)) {
rewardsCount += ie.rewards.length;
}
}
@ -363,17 +363,24 @@ function updateClaimDeleteAllButton(): void {
deleteAllButton.removeClass("hidden");
}
}
if (mailToDelete.length === accountAlerts.length) {
deleteAllButton.addClass("hidden");
}
}
$("#alertsPopup .accountAlerts").on("click", ".claimAll", () => {
for (const ie of accountAlerts) {
markReadAlert(ie.id);
if (ie.read === false && !mailToMarkRead.includes(ie.id)) {
markReadAlert(ie.id);
}
}
});
$("#alertsPopup .accountAlerts").on("click", ".deleteAll", () => {
for (const ie of accountAlerts) {
deleteAlert(ie.id);
if (!mailToDelete.includes(ie.id)) {
deleteAlert(ie.id);
}
}
});