Unsubscribe link in emails sent

This commit is contained in:
Alphonse Paix
2025-09-22 01:25:36 +02:00
parent 829f3e4e4f
commit 98611f18e3
13 changed files with 431 additions and 211 deletions

View File

@@ -1,4 +1,8 @@
use crate::{routes::AppError, startup::AppState, templates::UnsubscribeTemplate};
use crate::{
routes::AppError,
startup::AppState,
templates::{NotFoundTemplate, UnsubscribeTemplate},
};
use anyhow::Context;
use askama::Template;
use axum::{
@@ -29,7 +33,11 @@ pub async fn unsubscribe(
.context("Could not update subscriptions table.")?;
if result.rows_affected() == 0 {
Ok(StatusCode::NOT_FOUND.into_response())
Ok((
StatusCode::NOT_FOUND,
Html(NotFoundTemplate.render().unwrap()),
)
.into_response())
} else {
Ok(Html(UnsubscribeTemplate.render().unwrap()).into_response())
}