mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-02-11 03:26:27 +00:00
* Remove explicit auth params (ref #3725) Only take auth via header or cookie. This requires a new version of lemmy-js-client for api tests to pass. * rework api_crud * remove remaining auth params, move logic to session middleware * fmt, fix test * update js client * remove auth param from api tests * Pass auth as header * add ! * url vars, setHeader * cleanup * fmt * update * Updating for new lemmy-js-client. --------- Co-authored-by: Dessalines <tyhou13@gmx.com> Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
25 lines
774 B
Rust
25 lines
774 B
Rust
use activitypub_federation::config::Data;
|
|
use actix_web::web::Json;
|
|
use lemmy_api_common::{
|
|
context::LemmyContext,
|
|
custom_emoji::{DeleteCustomEmoji, DeleteCustomEmojiResponse},
|
|
utils::is_admin,
|
|
};
|
|
use lemmy_db_schema::source::custom_emoji::CustomEmoji;
|
|
use lemmy_db_views::structs::LocalUserView;
|
|
use lemmy_utils::error::LemmyError;
|
|
|
|
#[tracing::instrument(skip(context))]
|
|
pub async fn delete_custom_emoji(
|
|
data: Json<DeleteCustomEmoji>,
|
|
context: Data<LemmyContext>,
|
|
local_user_view: LocalUserView,
|
|
) -> Result<Json<DeleteCustomEmojiResponse>, LemmyError> {
|
|
// Make sure user is an admin
|
|
is_admin(&local_user_view)?;
|
|
CustomEmoji::delete(&mut context.pool(), data.id).await?;
|
|
Ok(Json(DeleteCustomEmojiResponse {
|
|
id: data.id,
|
|
success: true,
|
|
}))
|
|
}
|