mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-06-30 19:45:34 +00:00
feat(webapi): include cid
in ServerEvent::Msg
This commit is contained in:
parent
814fac1974
commit
ff7fd9e4b2
6 changed files with 18 additions and 18 deletions
|
@ -11,7 +11,7 @@ use anyhow::{bail, Context as _, Result};
|
|||
use axum::extract::ws::{close_code, CloseFrame, Message, WebSocket};
|
||||
use axum::extract::WebSocketUpgrade;
|
||||
use axum::response::Response;
|
||||
use blah_types::msg::{AuthPayload, SignedChatMsg};
|
||||
use blah_types::msg::{AuthPayload, SignedChatMsgWithId};
|
||||
use blah_types::server::{ClientEvent, ServerEvent};
|
||||
use blah_types::Signed;
|
||||
use futures_util::future::Either;
|
||||
|
@ -58,7 +58,7 @@ pub struct State {
|
|||
}
|
||||
|
||||
impl State {
|
||||
pub fn on_room_msg(&self, msg: SignedChatMsg, room_members: Vec<i64>) {
|
||||
pub fn on_room_msg(&self, msg: SignedChatMsgWithId, room_members: Vec<i64>) {
|
||||
let listeners = self.user_listeners.lock();
|
||||
let mut cnt = 0usize;
|
||||
let msg = Arc::new(ServerEvent::Msg(msg));
|
||||
|
|
|
@ -13,7 +13,7 @@ use axum_extra::extract::WithRejection as R;
|
|||
use blah_types::msg::{
|
||||
ChatPayload, CreateGroup, CreatePeerChat, CreateRoomPayload, DeleteRoomPayload,
|
||||
MemberPermission, RoomAdminOp, RoomAdminPayload, RoomAttrs, ServerPermission,
|
||||
SignedChatMsgWithId,
|
||||
SignedChatMsgWithId, WithMsgId,
|
||||
};
|
||||
use blah_types::server::{
|
||||
ErrorResponseWithChallenge, RoomList, RoomMember, RoomMemberList, RoomMetadata, RoomMsgs,
|
||||
|
@ -460,7 +460,7 @@ async fn post_room_msg(
|
|||
})?;
|
||||
|
||||
// FIXME: Optimize this to not traverses over all members.
|
||||
st.event.on_room_msg(chat, members);
|
||||
st.event.on_room_msg(WithMsgId::new(cid, chat), members);
|
||||
|
||||
Ok(Json(cid))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue