Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

fix(Channel): removed guild_id arg #61

Merged
merged 4 commits into from
Nov 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ferrischat_webserver/src/channels/delete_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ use ferrischat_common::ws::WsOutboundEvent;
use actix_web::{HttpRequest, HttpResponse, Responder};
use ferrischat_common::types::{Channel, InternalServerErrorJson, NotFoundJson};

/// DELETE /api/v0/guilds/{guild_id/channels/{channel_id}
/// DELETE /api/v0/channels/{channel_id}
pub async fn delete_channel(req: HttpRequest, _: crate::Authorization) -> impl Responder {
let db = get_db_or_fail!();
let channel_id = get_item_id!(req, "channel_id");
let guild_id = get_item_id!(req, "guild_id");
let bigint_channel_id = u128_to_bigdecimal!(channel_id);

let resp = sqlx::query!(
Expand Down Expand Up @@ -43,7 +42,12 @@ pub async fn delete_channel(req: HttpRequest, _: crate::Authorization) -> impl R
channel: channel_obj.clone(),
};

if let Err(e) = fire_event(format!("channel_{}_{}", channel_id, guild_id), &event).await {
if let Err(e) = fire_event(
format!("channel_{}_{}", channel_id, channel_obj.guild_id),
&event,
)
.await
{
let reason = match e {
WsEventError::MissingRedis => "Redis pool missing".to_string(),
WsEventError::RedisError(e) => format!("Redis returned an error: {}", e),
Expand Down