mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-11 03:26:27 +00:00
5dea21d531
* Convert all Result<..., LemmyError> into LemmyResult<...> Fixes #4613 * Fixing clippy.
25 lines
709 B
Rust
25 lines
709 B
Rust
use activitypub_federation::config::Data;
|
|
use actix_web::web::Json;
|
|
use lemmy_api_common::{
|
|
context::LemmyContext,
|
|
custom_emoji::DeleteCustomEmoji,
|
|
utils::is_admin,
|
|
SuccessResponse,
|
|
};
|
|
use lemmy_db_schema::source::custom_emoji::CustomEmoji;
|
|
use lemmy_db_views::structs::LocalUserView;
|
|
use lemmy_utils::error::LemmyResult;
|
|
|
|
#[tracing::instrument(skip(context))]
|
|
pub async fn delete_custom_emoji(
|
|
data: Json<DeleteCustomEmoji>,
|
|
context: Data<LemmyContext>,
|
|
local_user_view: LocalUserView,
|
|
) -> LemmyResult<Json<SuccessResponse>> {
|
|
// Make sure user is an admin
|
|
is_admin(&local_user_view)?;
|
|
|
|
CustomEmoji::delete(&mut context.pool(), data.id).await?;
|
|
|
|
Ok(Json(SuccessResponse::default()))
|
|
}
|