mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-24 11:00:34 +00:00
Fix displaying not found page when submitting a duplicated blocklist email
Signed-off-by: Serra Allgood <serra@allgood.dev>
This commit is contained in:
parent
003dcf861a
commit
43fde90387
1 changed files with 13 additions and 5 deletions
|
@ -210,11 +210,19 @@ pub fn add_email_blocklist(
|
|||
form: LenientForm<NewBlocklistedEmail>,
|
||||
rockets: PlumeRocket,
|
||||
) -> Result<Flash<Redirect>, ErrorPage> {
|
||||
BlocklistedEmail::insert(&*rockets.conn, form.0)?;
|
||||
Ok(Flash::success(
|
||||
Redirect::to(uri!(admin_email_blocklist: page = None)),
|
||||
i18n!(rockets.intl.catalog, "Email Blocked"),
|
||||
))
|
||||
let result = BlocklistedEmail::insert(&*rockets.conn, form.0);
|
||||
|
||||
if let Err(Error::Db(_)) = result {
|
||||
Ok(Flash::error(
|
||||
Redirect::to(uri!(admin_email_blocklist: page = None)),
|
||||
i18n!(rockets.intl.catalog, "Email already blocked")
|
||||
))
|
||||
} else {
|
||||
Ok(Flash::success(
|
||||
Redirect::to(uri!(admin_email_blocklist: page = None)),
|
||||
i18n!(rockets.intl.catalog, "Email Blocked"),
|
||||
))
|
||||
}
|
||||
}
|
||||
#[get("/admin/emails?<page>")]
|
||||
pub fn admin_email_blocklist(
|
||||
|
|
Loading…
Reference in a new issue