Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/831
This commit is contained in:
commit
a59f167771
@ -210,12 +210,20 @@ pub fn add_email_blocklist(
|
|||||||
form: LenientForm<NewBlocklistedEmail>,
|
form: LenientForm<NewBlocklistedEmail>,
|
||||||
rockets: PlumeRocket,
|
rockets: PlumeRocket,
|
||||||
) -> Result<Flash<Redirect>, ErrorPage> {
|
) -> Result<Flash<Redirect>, ErrorPage> {
|
||||||
BlocklistedEmail::insert(&*rockets.conn, form.0)?;
|
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(
|
Ok(Flash::success(
|
||||||
Redirect::to(uri!(admin_email_blocklist: page = None)),
|
Redirect::to(uri!(admin_email_blocklist: page = None)),
|
||||||
i18n!(rockets.intl.catalog, "Email Blocked"),
|
i18n!(rockets.intl.catalog, "Email Blocked"),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#[get("/admin/emails?<page>")]
|
#[get("/admin/emails?<page>")]
|
||||||
pub fn admin_email_blocklist(
|
pub fn admin_email_blocklist(
|
||||||
_mod: Moderator,
|
_mod: Moderator,
|
||||||
|
Loading…
Reference in New Issue
Block a user