Add "Wipe Inbox" button

pull/16/head
ClaraCrazy 2024-09-28 02:16:58 +02:00
parent 3016f0fc34
commit b0d9014a00
2 changed files with 25 additions and 1 deletions

View File

@ -61,6 +61,25 @@ router.get(
} }
) )
router.get(
'^/:address/delete-all',
sanitizeAddress,
async (req, res, next) => {
try {
const mailProcessingService = req.app.get('mailProcessingService')
const mailSummaries = await mailProcessingService.getMailSummaries(req.params.address)
for (mail in mailSummaries) {
await mailProcessingService.deleteSpecificEmail(req.params.address, mailSummaries[mail].uid)
}
res.redirect(`/inbox/${req.params.address}`)
} catch (error) {
console.error('error while deleting email', error)
next(error)
}
}
)
router.get( router.get(
'^/:address/:uid/delete', '^/:address/:uid/delete',
sanitizeAddress, sanitizeAddress,

View File

@ -7,7 +7,12 @@
}); });
</script> </script>
<div style="float: right"><a href="/logout"> Logout</a></div> <div style="float: right; text-align: end;">
<a href="/inbox/{{ address }}/delete-all">
Wipe Inbox</a><br>
<a href="/logout">
Logout</a>
</div>
<h1>{{ address }}</h1> <h1>{{ address }}</h1>
{% for mail in mailSummaries %} {% for mail in mailSummaries %}
<a href="{{ mail.to[0] }}/{{ mail.uid }}" class="no-link-color"> <a href="{{ mail.to[0] }}/{{ mail.uid }}" class="no-link-color">