Refactor messages
This commit is contained in:
parent
02145de39f
commit
29fe2f8562
@ -13,7 +13,8 @@ use database_actor::DbExecutor;
|
|||||||
#[cfg(feature = "local-storage")]
|
#[cfg(feature = "local-storage")]
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use futures::{StreamExt, TryStreamExt};
|
use futures::{StreamExt, TryStreamExt};
|
||||||
use jirs_data::{User, UserId, WsMsg};
|
use jirs_data::msg::WsMsgUser;
|
||||||
|
use jirs_data::{User, UserId};
|
||||||
use websocket_actor::server::InnerMsg::BroadcastToChannel;
|
use websocket_actor::server::InnerMsg::BroadcastToChannel;
|
||||||
use websocket_actor::server::WsServer;
|
use websocket_actor::server::WsServer;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ pub async fn upload(
|
|||||||
let user = update_user_avatar(user_id, avatar_url.clone(), db).await?;
|
let user = update_user_avatar(user_id, avatar_url.clone(), db).await?;
|
||||||
ws.send(BroadcastToChannel(
|
ws.send(BroadcastToChannel(
|
||||||
project_id,
|
project_id,
|
||||||
WsMsg::AvatarUrlChanged(user.id, avatar_url),
|
WsMsgUser::AvatarUrlChanged(user.id, avatar_url).into(),
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
.map_err(|_| HttpResponse::UnprocessableEntity().finish())?;
|
.map_err(|_| HttpResponse::UnprocessableEntity().finish())?;
|
||||||
|
@ -3,13 +3,46 @@ use database_actor::authorize_user::AuthorizeUser;
|
|||||||
use database_actor::tokens::{CreateBindToken, FindBindToken};
|
use database_actor::tokens::{CreateBindToken, FindBindToken};
|
||||||
use database_actor::users::LookupUser;
|
use database_actor::users::LookupUser;
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use jirs_data::msg::WsError;
|
use jirs_data::msg::{WsError, WsMsgSession};
|
||||||
use jirs_data::{Token, WsMsg};
|
use jirs_data::{Token, WsMsg};
|
||||||
use mail_actor::welcome::Welcome;
|
use mail_actor::welcome::Welcome;
|
||||||
|
|
||||||
use crate::server::InnerMsg;
|
use crate::server::InnerMsg;
|
||||||
use crate::{db_or_debug_and_return, db_or_debug_or_fallback, mail_or_debug_and_return, *};
|
use crate::{db_or_debug_and_return, db_or_debug_or_fallback, mail_or_debug_and_return, *};
|
||||||
|
|
||||||
|
#[async_trait::async_trait]
|
||||||
|
impl AsyncHandler<WsMsgSession> for WebSocketActor {
|
||||||
|
async fn exec(&mut self, msg: WsMsgSession) -> WsResult {
|
||||||
|
match msg {
|
||||||
|
// auth
|
||||||
|
WsMsgSession::BindTokenCheck(uuid) => {
|
||||||
|
self.exec(CheckBindToken { bind_token: uuid }).await
|
||||||
|
}
|
||||||
|
WsMsgSession::AuthenticateRequest(email, name) => {
|
||||||
|
self.exec(Authenticate { name, email }).await
|
||||||
|
}
|
||||||
|
|
||||||
|
// register
|
||||||
|
WsMsgSession::SignUpRequest(email, username) => {
|
||||||
|
self.exec(Register {
|
||||||
|
name: username,
|
||||||
|
email,
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
WsMsgSession::AuthorizeLoad(_) => Ok(None),
|
||||||
|
WsMsgSession::AuthorizeLoaded(_) => Ok(None),
|
||||||
|
WsMsgSession::AuthorizeExpired => Ok(None),
|
||||||
|
WsMsgSession::AuthenticateSuccess => Ok(None),
|
||||||
|
WsMsgSession::BindTokenBad => Ok(None),
|
||||||
|
WsMsgSession::BindTokenOk(_) => Ok(None),
|
||||||
|
WsMsgSession::SignUpSuccess => Ok(None),
|
||||||
|
WsMsgSession::SignUpPairTaken => Ok(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Authenticate {
|
pub struct Authenticate {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub email: String,
|
pub email: String,
|
||||||
@ -36,7 +69,7 @@ impl AsyncHandler<Authenticate> for WebSocketActor {
|
|||||||
}; async
|
}; async
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Ok(Some(WsMsg::AuthenticateSuccess))
|
Ok(Some(WsMsgSession::AuthenticateSuccess.into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +84,10 @@ impl WsHandler<CheckAuthToken> for WebSocketActor {
|
|||||||
AuthorizeUser {
|
AuthorizeUser {
|
||||||
access_token: msg.token,
|
access_token: msg.token,
|
||||||
},
|
},
|
||||||
Ok(Some(WsMsg::AuthorizeLoaded(Err(
|
Ok(Some(
|
||||||
"Invalid auth token".to_string()
|
WsMsgSession::AuthorizeLoaded(Err("Invalid auth token".to_string())).into()
|
||||||
)))),
|
)),
|
||||||
Ok(Some(WsMsg::AuthorizeExpired))
|
Ok(Some(WsMsgSession::AuthorizeExpired.into()))
|
||||||
);
|
);
|
||||||
|
|
||||||
let setting: jirs_data::UserSetting = db_or_debug_or_fallback!(
|
let setting: jirs_data::UserSetting = db_or_debug_or_fallback!(
|
||||||
@ -69,7 +102,9 @@ impl WsHandler<CheckAuthToken> for WebSocketActor {
|
|||||||
self.current_project = self.load_project().ok();
|
self.current_project = self.load_project().ok();
|
||||||
|
|
||||||
block_on(self.join_channel(ctx.address().recipient::<InnerMsg>()));
|
block_on(self.join_channel(ctx.address().recipient::<InnerMsg>()));
|
||||||
Ok(Some(WsMsg::AuthorizeLoaded(Ok((user, setting)))))
|
Ok(Some(
|
||||||
|
WsMsgSession::AuthorizeLoaded(Ok((user, setting))).into(),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,9 +120,9 @@ impl AsyncHandler<CheckBindToken> for WebSocketActor {
|
|||||||
FindBindToken {
|
FindBindToken {
|
||||||
token: msg.bind_token,
|
token: msg.bind_token,
|
||||||
},
|
},
|
||||||
Ok(Some(WsMsg::BindTokenBad)),
|
Ok(Some(WsMsgSession::BindTokenBad.into())),
|
||||||
Ok(None); async
|
Ok(None); async
|
||||||
);
|
);
|
||||||
Ok(Some(WsMsg::BindTokenOk(token.access_token)))
|
Ok(Some(WsMsgSession::BindTokenOk(token.access_token).into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use database_actor::invitations;
|
use database_actor::invitations;
|
||||||
use database_actor::messages::CreateMessageReceiver;
|
use database_actor::messages::CreateMessageReceiver;
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use jirs_data::msg::WsMsgInvitation;
|
use jirs_data::msg::{WsMsgInvitation, WsMsgMessage};
|
||||||
use jirs_data::{
|
use jirs_data::{
|
||||||
EmailString, InvitationId, InvitationToken, MessageType, UserRole, UsernameString, WsMsg,
|
EmailString, InvitationId, InvitationToken, MessageType, UserRole, UsernameString, WsMsg,
|
||||||
};
|
};
|
||||||
@ -112,13 +112,11 @@ impl AsyncHandler<CreateInvitation> for WebSocketActor {
|
|||||||
})) {
|
})) {
|
||||||
self.addr.do_send(InnerMsg::SendToUser(
|
self.addr.do_send(InnerMsg::SendToUser(
|
||||||
message.receiver_id,
|
message.receiver_id,
|
||||||
WsMsg::MessageUpdated(message),
|
WsMsgMessage::MessageUpdated(message).into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Some(WsMsg::Invitation(
|
Ok(Some(WsMsgInvitation::InvitationSendSuccess.into()))
|
||||||
WsMsgInvitation::InvitationSendSuccess,
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,13 +186,13 @@ impl WsHandler<AcceptInvitation> for WebSocketActor {
|
|||||||
message_id: message.id,
|
message_id: message.id,
|
||||||
},
|
},
|
||||||
|n| {
|
|n| {
|
||||||
ctx.send_msg(&WsMsg::MessageMarkedSeen(message.id, n));
|
ctx.send_msg(&WsMsgMessage::MessageMarkedSeen(message.id, n).into());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Some(WsMsg::Invitation(
|
Ok(Some(
|
||||||
WsMsgInvitation::InvitationAcceptSuccess(token.access_token),
|
WsMsgInvitation::InvitationAcceptSuccess(token.access_token).into(),
|
||||||
)))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,23 @@
|
|||||||
use database_actor::messages;
|
use database_actor::messages;
|
||||||
use jirs_data::{MessageId, WsMsg};
|
use jirs_data::msg::WsMsgMessage;
|
||||||
|
use jirs_data::MessageId;
|
||||||
|
|
||||||
use crate::{db_or_debug_and_return, AsyncHandler, WebSocketActor, WsResult};
|
use crate::{db_or_debug_and_return, AsyncHandler, WebSocketActor, WsResult};
|
||||||
|
|
||||||
|
#[async_trait::async_trait]
|
||||||
|
impl AsyncHandler<WsMsgMessage> for WebSocketActor {
|
||||||
|
async fn exec(&mut self, msg: WsMsgMessage) -> WsResult {
|
||||||
|
match msg {
|
||||||
|
// messages
|
||||||
|
WsMsgMessage::MessagesLoad => self.exec(LoadMessages).await,
|
||||||
|
WsMsgMessage::MessageMarkSeen(id) => self.exec(MarkMessageSeen { id }).await,
|
||||||
|
WsMsgMessage::MessageUpdated(_) => Ok(None),
|
||||||
|
WsMsgMessage::MessagesLoaded(_) => Ok(None),
|
||||||
|
WsMsgMessage::MessageMarkedSeen(_, _) => Ok(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct LoadMessages;
|
pub struct LoadMessages;
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
@ -10,7 +25,7 @@ impl AsyncHandler<LoadMessages> for WebSocketActor {
|
|||||||
async fn exec(&mut self, _msg: LoadMessages) -> WsResult {
|
async fn exec(&mut self, _msg: LoadMessages) -> WsResult {
|
||||||
let user_id = self.require_user()?.id;
|
let user_id = self.require_user()?.id;
|
||||||
let v = db_or_debug_and_return!(self, messages::LoadMessages { user_id }; async);
|
let v = db_or_debug_and_return!(self, messages::LoadMessages { user_id }; async);
|
||||||
Ok(Some(WsMsg::MessagesLoaded(v)))
|
Ok(Some(WsMsgMessage::MessagesLoaded(v).into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +44,6 @@ impl AsyncHandler<MarkMessageSeen> for WebSocketActor {
|
|||||||
user_id,
|
user_id,
|
||||||
}; async
|
}; async
|
||||||
);
|
);
|
||||||
Ok(Some(WsMsg::MessageMarkedSeen(msg.id, count)))
|
Ok(Some(WsMsgMessage::MessageMarkedSeen(msg.id, count).into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use jirs_data::{TextEditorMode, UserId, UserSetting, WsMsg};
|
use jirs_data::msg::WsMsgUser;
|
||||||
|
use jirs_data::{TextEditorMode, UserId, UserSetting};
|
||||||
|
|
||||||
use crate::{db_or_debug_and_return, AsyncHandler, WebSocketActor, WsResult};
|
use crate::{db_or_debug_and_return, AsyncHandler, WebSocketActor, WsResult};
|
||||||
|
|
||||||
@ -25,6 +26,6 @@ impl AsyncHandler<SetTextEditorMode> for WebSocketActor {
|
|||||||
mode: msg.mode
|
mode: msg.mode
|
||||||
}; async
|
}; async
|
||||||
);
|
);
|
||||||
Ok(Some(WsMsg::UserSettingUpdated(setting)))
|
Ok(Some(WsMsgUser::UserSettingUpdated(setting).into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,31 @@
|
|||||||
use database_actor::users::Register as DbRegister;
|
use database_actor::users::Register as DbRegister;
|
||||||
use database_actor::{self};
|
use database_actor::{self};
|
||||||
use jirs_data::msg::{WsMsgInvitation, WsMsgProject};
|
use jirs_data::msg::{WsMsgInvitation, WsMsgProject, WsMsgSession, WsMsgUser};
|
||||||
use jirs_data::{UserId, UserProject, UserRole, WsMsg};
|
use jirs_data::{UserId, UserProject, UserRole, WsMsg};
|
||||||
|
|
||||||
use crate::handlers::auth::Authenticate;
|
use crate::handlers::auth::Authenticate;
|
||||||
|
use crate::handlers::user_settings;
|
||||||
use crate::{db_or_debug_and_return, AsyncHandler, WebSocketActor, WsResult};
|
use crate::{db_or_debug_and_return, AsyncHandler, WebSocketActor, WsResult};
|
||||||
|
|
||||||
|
#[async_trait::async_trait]
|
||||||
|
impl AsyncHandler<WsMsgUser> for WebSocketActor {
|
||||||
|
async fn exec(&mut self, msg: WsMsgUser) -> WsResult {
|
||||||
|
match msg {
|
||||||
|
// user settings
|
||||||
|
WsMsgUser::UserSettingSetEditorMode(mode) => {
|
||||||
|
self.exec(user_settings::SetTextEditorMode { mode }).await
|
||||||
|
}
|
||||||
|
|
||||||
|
// users
|
||||||
|
WsMsgUser::ProfileUpdate(email, name) => self.exec(ProfileUpdate { name, email }).await,
|
||||||
|
|
||||||
|
WsMsgUser::AvatarUrlChanged(_, _) => Ok(None),
|
||||||
|
WsMsgUser::ProfileUpdated => Ok(None),
|
||||||
|
WsMsgUser::UserSettingUpdated(_) => Ok(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct LoadProjectUsers;
|
pub struct LoadProjectUsers;
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
@ -36,7 +56,7 @@ impl AsyncHandler<Register> for WebSocketActor {
|
|||||||
project_id: None,
|
project_id: None,
|
||||||
role: UserRole::Owner,
|
role: UserRole::Owner,
|
||||||
},
|
},
|
||||||
Ok(Some(WsMsg::SignUpPairTaken)),
|
Ok(Some(WsMsgSession::SignUpPairTaken.into())),
|
||||||
Ok(None); async
|
Ok(None); async
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -45,7 +65,7 @@ impl AsyncHandler<Register> for WebSocketActor {
|
|||||||
Err(e) => return Ok(Some(e)),
|
Err(e) => return Ok(Some(e)),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Some(WsMsg::SignUpSuccess))
|
Ok(Some(WsMsgSession::SignUpSuccess.into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +104,7 @@ impl AsyncHandler<ProfileUpdate> for WebSocketActor {
|
|||||||
}; async
|
}; async
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(Some(WsMsg::ProfileUpdated))
|
Ok(Some(WsMsgUser::ProfileUpdated.into()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use database_actor::projects::LoadCurrentProject;
|
|||||||
use database_actor::user_projects::CurrentUserProject;
|
use database_actor::user_projects::CurrentUserProject;
|
||||||
use database_actor::DbExecutor;
|
use database_actor::DbExecutor;
|
||||||
use futures::executor::block_on as wait;
|
use futures::executor::block_on as wait;
|
||||||
use jirs_data::msg::WsMsgInvitation;
|
use jirs_data::msg::{WsMsgInvitation, WsMsgSession};
|
||||||
use jirs_data::{Project, User, UserProject, WsMsg};
|
use jirs_data::{Project, User, UserProject, WsMsg};
|
||||||
use mail_actor::MailExecutor;
|
use mail_actor::MailExecutor;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ impl WebSocketActor {
|
|||||||
match msg {
|
match msg {
|
||||||
WsMsg::Ping => return Ok(Some(WsMsg::Pong)),
|
WsMsg::Ping => return Ok(Some(WsMsg::Pong)),
|
||||||
WsMsg::Pong => return Ok(Some(WsMsg::Ping)),
|
WsMsg::Pong => return Ok(Some(WsMsg::Ping)),
|
||||||
WsMsg::AuthorizeLoad(uuid) => {
|
WsMsg::Session(WsMsgSession::AuthorizeLoad(uuid)) => {
|
||||||
return Ok(self.handle_msg(CheckAuthToken { token: uuid }, ctx)?)
|
return Ok(self.handle_msg(CheckAuthToken { token: uuid }, ctx)?)
|
||||||
}
|
}
|
||||||
WsMsg::Invitation(WsMsgInvitation::InvitationAcceptRequest(invitation_token)) => {
|
WsMsg::Invitation(WsMsgInvitation::InvitationAcceptRequest(invitation_token)) => {
|
||||||
@ -107,27 +107,9 @@ impl WebSocketActor {
|
|||||||
id: user_project_id,
|
id: user_project_id,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// auth
|
WsMsg::User(m) => self.exec(m),
|
||||||
WsMsg::BindTokenCheck(uuid) => self.exec(CheckBindToken { bind_token: uuid }),
|
WsMsg::Message(m) => self.exec(m),
|
||||||
WsMsg::AuthenticateRequest(email, name) => self.exec(Authenticate { name, email }),
|
WsMsg::Session(m) => self.exec(m),
|
||||||
|
|
||||||
// register
|
|
||||||
WsMsg::SignUpRequest(email, username) => self.exec(Register {
|
|
||||||
name: username,
|
|
||||||
email,
|
|
||||||
}),
|
|
||||||
|
|
||||||
// user settings
|
|
||||||
WsMsg::UserSettingSetEditorMode(mode) => {
|
|
||||||
self.exec(user_settings::SetTextEditorMode { mode })
|
|
||||||
}
|
|
||||||
|
|
||||||
// users
|
|
||||||
WsMsg::ProfileUpdate(email, name) => self.exec(ProfileUpdate { name, email }),
|
|
||||||
|
|
||||||
// messages
|
|
||||||
WsMsg::MessagesLoad => self.exec(LoadMessages),
|
|
||||||
WsMsg::MessageMarkSeen(id) => self.exec(MarkMessageSeen { id }),
|
|
||||||
|
|
||||||
// hi
|
// hi
|
||||||
WsMsg::HighlightCode(lang, code) => self.exec(hi::HighlightCode(lang, code)),
|
WsMsg::HighlightCode(lang, code) => self.exec(hi::HighlightCode(lang, code)),
|
||||||
@ -169,13 +151,15 @@ impl WebSocketActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn require_user(&self) -> Result<&User, WsMsg> {
|
fn require_user(&self) -> Result<&User, WsMsg> {
|
||||||
self.current_user.as_ref().ok_or(WsMsg::AuthorizeExpired)
|
self.current_user
|
||||||
|
.as_ref()
|
||||||
|
.ok_or(WsMsgSession::AuthorizeExpired.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn require_user_project(&self) -> Result<&UserProject, WsMsg> {
|
fn require_user_project(&self) -> Result<&UserProject, WsMsg> {
|
||||||
self.current_user_project
|
self.current_user_project
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(WsMsg::AuthorizeExpired)
|
.ok_or(WsMsgSession::AuthorizeExpired.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_user_project(&self) -> Result<UserProject, WsMsg> {
|
fn load_user_project(&self) -> Result<UserProject, WsMsg> {
|
||||||
@ -184,11 +168,11 @@ impl WebSocketActor {
|
|||||||
Ok(Ok(user_project)) => Ok(user_project),
|
Ok(Ok(user_project)) => Ok(user_project),
|
||||||
Ok(Err(e)) => {
|
Ok(Err(e)) => {
|
||||||
error!("load_user_project encounter service error {:?}", e);
|
error!("load_user_project encounter service error {:?}", e);
|
||||||
Err(WsMsg::AuthorizeExpired)
|
Err(WsMsgSession::AuthorizeExpired.into())
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("load_user_project encounter mailbox error {}", e);
|
error!("load_user_project encounter mailbox error {}", e);
|
||||||
Err(WsMsg::AuthorizeExpired)
|
Err(WsMsgSession::AuthorizeExpired.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,11 +183,11 @@ impl WebSocketActor {
|
|||||||
Ok(Ok(project)) => Ok(project),
|
Ok(Ok(project)) => Ok(project),
|
||||||
Ok(Err(e)) => {
|
Ok(Err(e)) => {
|
||||||
error!("{:?}", e);
|
error!("{:?}", e);
|
||||||
Err(WsMsg::AuthorizeExpired)
|
Err(WsMsgSession::AuthorizeExpired.into())
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("{:?}", e);
|
error!("{:?}", e);
|
||||||
Err(WsMsg::AuthorizeExpired)
|
Err(WsMsgSession::AuthorizeExpired.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#![feature(type_ascription, trait_alias, drain_filter)]
|
#![feature(type_ascription, trait_alias, drain_filter, or_patterns)]
|
||||||
|
|
||||||
pub use changes::*;
|
pub use changes::*;
|
||||||
pub use components::*;
|
pub use components::*;
|
||||||
pub use fields::*;
|
pub use fields::*;
|
||||||
pub use images::*;
|
pub use images::*;
|
||||||
|
use jirs_data::msg::WsMsgSession;
|
||||||
use jirs_data::*;
|
use jirs_data::*;
|
||||||
use seed::prelude::*;
|
use seed::prelude::*;
|
||||||
use web_sys::File;
|
use web_sys::File;
|
||||||
@ -425,7 +426,11 @@ fn authorize_or_redirect(model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
let pathname = seed::document().location().unwrap().pathname().unwrap();
|
let pathname = seed::document().location().unwrap().pathname().unwrap();
|
||||||
match crate::shared::read_auth_token() {
|
match crate::shared::read_auth_token() {
|
||||||
Ok(token) => {
|
Ok(token) => {
|
||||||
send_ws_msg(WsMsg::AuthorizeLoad(token), model.ws.as_ref(), orders);
|
send_ws_msg(
|
||||||
|
WsMsgSession::AuthorizeLoad(token).into(),
|
||||||
|
model.ws.as_ref(),
|
||||||
|
orders,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Err(..) => {
|
Err(..) => {
|
||||||
match pathname.as_str() {
|
match pathname.as_str() {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use jirs_data::msg::WsMsgUser;
|
||||||
use jirs_data::{ProjectId, User, UsersFieldId, WsMsg};
|
use jirs_data::{ProjectId, User, UsersFieldId, WsMsg};
|
||||||
use seed::prelude::{Method, Orders, Request};
|
use seed::prelude::{Method, Orders, Request};
|
||||||
use web_sys::FormData;
|
use web_sys::FormData;
|
||||||
@ -54,9 +55,8 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
|||||||
orders.perform_cmd(update_avatar(fd, model.host_url.clone()));
|
orders.perform_cmd(update_avatar(fd, model.host_url.clone()));
|
||||||
orders.skip();
|
orders.skip();
|
||||||
}
|
}
|
||||||
Msg::WebSocketChange(WebSocketChanged::WsMsg(WsMsg::AvatarUrlChanged(
|
Msg::WebSocketChange(WebSocketChanged::WsMsg(WsMsg::User(
|
||||||
user_id,
|
WsMsgUser::AvatarUrlChanged(user_id, avatar_url),
|
||||||
avatar_url,
|
|
||||||
))) => {
|
))) => {
|
||||||
if let Some(User { id, .. }) = model.user.as_mut() {
|
if let Some(User { id, .. }) = model.user.as_mut() {
|
||||||
if *id == user_id {
|
if *id == user_id {
|
||||||
@ -69,17 +69,18 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
|
|||||||
}
|
}
|
||||||
Msg::U32InputChanged(FieldId::Profile(UsersFieldId::TextEditorMode), v) => {
|
Msg::U32InputChanged(FieldId::Profile(UsersFieldId::TextEditorMode), v) => {
|
||||||
send_ws_msg(
|
send_ws_msg(
|
||||||
WsMsg::UserSettingSetEditorMode(v.into()),
|
WsMsgUser::UserSettingSetEditorMode(v.into()).into(),
|
||||||
model.ws.as_ref(),
|
model.ws.as_ref(),
|
||||||
orders,
|
orders,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Msg::PageChanged(PageChanged::Profile(ProfilePageChange::SubmitForm)) => {
|
Msg::PageChanged(PageChanged::Profile(ProfilePageChange::SubmitForm)) => {
|
||||||
send_ws_msg(
|
send_ws_msg(
|
||||||
WsMsg::ProfileUpdate(
|
WsMsgUser::ProfileUpdate(
|
||||||
profile_page.email.value.clone(),
|
profile_page.email.value.clone(),
|
||||||
profile_page.name.value.clone(),
|
profile_page.name.value.clone(),
|
||||||
),
|
)
|
||||||
|
.into(),
|
||||||
model.ws.as_ref(),
|
model.ws.as_ref(),
|
||||||
orders,
|
orders,
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use jirs_data::msg::{WsMsgIssueStatus, WsMsgProject};
|
use jirs_data::msg::{WsMsgIssueStatus, WsMsgProject, WsMsgSession};
|
||||||
use jirs_data::{IssueStatus, IssueStatusId, ProjectFieldId, UpdateProjectPayload, WsMsg};
|
use jirs_data::{IssueStatus, IssueStatusId, ProjectFieldId, UpdateProjectPayload, WsMsg};
|
||||||
use seed::prelude::Orders;
|
use seed::prelude::Orders;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
build_page_content(model, orders);
|
build_page_content(model, orders);
|
||||||
}
|
}
|
||||||
Msg::WebSocketChange(ref change) => match change {
|
Msg::WebSocketChange(ref change) => match change {
|
||||||
WebSocketChanged::WsMsg(WsMsg::AuthorizeLoaded(..)) => {
|
WebSocketChanged::WsMsg(WsMsg::Session(WsMsgSession::AuthorizeLoaded(..))) => {
|
||||||
board_load(model, orders);
|
board_load(model, orders);
|
||||||
}
|
}
|
||||||
WebSocketChanged::WsMsg(WsMsg::IssueStatus(WsMsgIssueStatus::IssueStatusCreated(
|
WebSocketChanged::WsMsg(WsMsg::IssueStatus(WsMsgIssueStatus::IssueStatusCreated(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use jirs_data::msg::WsMsgSession;
|
||||||
use jirs_data::{SignInFieldId, WsMsg};
|
use jirs_data::{SignInFieldId, WsMsg};
|
||||||
use seed::prelude::*;
|
use seed::prelude::*;
|
||||||
use seed::*;
|
use seed::*;
|
||||||
@ -39,7 +40,7 @@ pub fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>)
|
|||||||
}
|
}
|
||||||
Msg::SignInRequest => {
|
Msg::SignInRequest => {
|
||||||
send_ws_msg(
|
send_ws_msg(
|
||||||
WsMsg::AuthenticateRequest(page.email.clone(), page.username.clone()),
|
WsMsgSession::AuthenticateRequest(page.email.clone(), page.username.clone()).into(),
|
||||||
model.ws.as_ref(),
|
model.ws.as_ref(),
|
||||||
orders,
|
orders,
|
||||||
);
|
);
|
||||||
@ -52,13 +53,17 @@ pub fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
send_ws_msg(WsMsg::BindTokenCheck(bind_token), model.ws.as_ref(), orders);
|
send_ws_msg(
|
||||||
|
WsMsgSession::BindTokenCheck(bind_token).into(),
|
||||||
|
model.ws.as_ref(),
|
||||||
|
orders,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Msg::WebSocketChange(change) => match change {
|
Msg::WebSocketChange(change) => match change {
|
||||||
WebSocketChanged::WsMsg(WsMsg::AuthenticateSuccess) => {
|
WebSocketChanged::WsMsg(WsMsg::Session(WsMsgSession::AuthenticateSuccess)) => {
|
||||||
page.login_success = true;
|
page.login_success = true;
|
||||||
}
|
}
|
||||||
WebSocketChanged::WsMsg(WsMsg::BindTokenOk(access_token)) => {
|
WebSocketChanged::WsMsg(WsMsg::Session(WsMsgSession::BindTokenOk(access_token))) => {
|
||||||
match write_auth_token(Some(access_token)) {
|
match write_auth_token(Some(access_token)) {
|
||||||
Ok(msg) => {
|
Ok(msg) => {
|
||||||
orders.skip().send_msg(msg);
|
orders.skip().send_msg(msg);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use jirs_data::msg::WsMsgSession;
|
||||||
use jirs_data::{SignUpFieldId, WsMsg};
|
use jirs_data::{SignUpFieldId, WsMsg};
|
||||||
use seed::prelude::*;
|
use seed::prelude::*;
|
||||||
|
|
||||||
@ -32,16 +33,16 @@ pub fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>)
|
|||||||
}
|
}
|
||||||
Msg::SignUpRequest => {
|
Msg::SignUpRequest => {
|
||||||
send_ws_msg(
|
send_ws_msg(
|
||||||
WsMsg::SignUpRequest(page.email.clone(), page.username.clone()),
|
WsMsgSession::SignUpRequest(page.email.clone(), page.username.clone()).into(),
|
||||||
model.ws.as_ref(),
|
model.ws.as_ref(),
|
||||||
orders,
|
orders,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Msg::WebSocketChange(change) => match change {
|
Msg::WebSocketChange(change) => match change {
|
||||||
WebSocketChanged::WsMsg(WsMsg::SignUpSuccess) => {
|
WebSocketChanged::WsMsg(WsMsg::Session(WsMsgSession::SignUpSuccess)) => {
|
||||||
page.sign_up_success = true;
|
page.sign_up_success = true;
|
||||||
}
|
}
|
||||||
WebSocketChanged::WsMsg(WsMsg::SignUpPairTaken) => {
|
WebSocketChanged::WsMsg(WsMsg::Session(WsMsgSession::SignUpPairTaken)) => {
|
||||||
page.error = "Pair you give is either taken or is not matching".to_string();
|
page.error = "Pair you give is either taken or is not matching".to_string();
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use jirs_data::msg::WsMsgInvitation;
|
use jirs_data::msg::{WsMsgInvitation, WsMsgSession};
|
||||||
use jirs_data::{InvitationState, UserRole, UsersFieldId, WsMsg};
|
use jirs_data::{InvitationState, UserRole, UsersFieldId, WsMsg};
|
||||||
use seed::prelude::Orders;
|
use seed::prelude::Orders;
|
||||||
|
|
||||||
@ -26,7 +26,9 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
invitation_load(model, orders);
|
invitation_load(model, orders);
|
||||||
}
|
}
|
||||||
Msg::WebSocketChange(change) => match change {
|
Msg::WebSocketChange(change) => match change {
|
||||||
WebSocketChanged::WsMsg(WsMsg::AuthorizeLoaded(Ok(_))) if model.user.is_some() => {
|
WebSocketChanged::WsMsg(WsMsg::Session(WsMsgSession::AuthorizeLoaded(Ok(_))))
|
||||||
|
if model.user.is_some() =>
|
||||||
|
{
|
||||||
invitation_load(model, orders);
|
invitation_load(model, orders);
|
||||||
}
|
}
|
||||||
WebSocketChanged::WsMsg(WsMsg::Invitation(WsMsgInvitation::InvitedUsersLoaded(
|
WebSocketChanged::WsMsg(WsMsg::Invitation(WsMsgInvitation::InvitedUsersLoaded(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use jirs_data::msg::WsMsgProject;
|
use jirs_data::msg::{WsMsgMessage, WsMsgProject};
|
||||||
use jirs_data::{UserRole, WsMsg};
|
use jirs_data::{UserRole, WsMsg};
|
||||||
use seed::prelude::*;
|
use seed::prelude::*;
|
||||||
use seed::*;
|
use seed::*;
|
||||||
@ -16,7 +16,7 @@ pub fn update(msg: &Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
WsMsg::UserProjectsLoad,
|
WsMsg::UserProjectsLoad,
|
||||||
WsMsg::Project(WsMsgProject::ProjectsLoad),
|
WsMsg::Project(WsMsgProject::ProjectsLoad),
|
||||||
WsMsg::Project(WsMsgProject::ProjectUsersLoad),
|
WsMsg::Project(WsMsgProject::ProjectUsersLoad),
|
||||||
WsMsg::MessagesLoad,
|
WsMsg::Message(WsMsgMessage::MessagesLoad),
|
||||||
],
|
],
|
||||||
model.ws.as_ref(),
|
model.ws.as_ref(),
|
||||||
orders,
|
orders,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use jirs_data::msg::WsMsgInvitation;
|
use jirs_data::msg::{WsMsgInvitation, WsMsgMessage};
|
||||||
use jirs_data::{InvitationToken, Message, MessageType, WsMsg};
|
use jirs_data::{InvitationToken, Message, MessageType, WsMsg};
|
||||||
use seed::prelude::*;
|
use seed::prelude::*;
|
||||||
use seed::*;
|
use seed::*;
|
||||||
@ -42,7 +42,7 @@ pub fn update(msg: &Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
Msg::MessageInvitationDismiss(token) => {
|
Msg::MessageInvitationDismiss(token) => {
|
||||||
WsMsgInvitation::InvitationRejectRequest(*token).into()
|
WsMsgInvitation::InvitationRejectRequest(*token).into()
|
||||||
}
|
}
|
||||||
Msg::MessageSeen(id) => WsMsg::MessageMarkSeen(*id),
|
Msg::MessageSeen(id) => WsMsg::Message(WsMsgMessage::MessageMarkSeen(*id)),
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
send_ws_msg(m, model.ws.as_ref(), orders);
|
send_ws_msg(m, model.ws.as_ref(), orders);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
pub use init_load_sets::*;
|
pub use init_load_sets::*;
|
||||||
use jirs_data::msg::{WsMsgComment, WsMsgEpic, WsMsgIssue, WsMsgIssueStatus, WsMsgProject};
|
use jirs_data::msg::{
|
||||||
|
WsMsgComment, WsMsgEpic, WsMsgIssue, WsMsgIssueStatus, WsMsgMessage, WsMsgProject,
|
||||||
|
WsMsgSession, WsMsgUser,
|
||||||
|
};
|
||||||
use jirs_data::*;
|
use jirs_data::*;
|
||||||
use seed::prelude::*;
|
use seed::prelude::*;
|
||||||
|
|
||||||
@ -92,7 +95,7 @@ pub async fn read_incoming(msg: WebSocketMessage) -> Msg {
|
|||||||
pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||||
match msg {
|
match msg {
|
||||||
// auth
|
// auth
|
||||||
WsMsg::AuthorizeLoaded(Ok((user, setting))) => {
|
WsMsg::Session(WsMsgSession::AuthorizeLoaded(Ok((user, setting)))) => {
|
||||||
model.user = Some(user);
|
model.user = Some(user);
|
||||||
model.user_settings = Some(setting);
|
model.user_settings = Some(setting);
|
||||||
|
|
||||||
@ -119,7 +122,7 @@ pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
model.user.as_ref().map(|u| u.id),
|
model.user.as_ref().map(|u| u.id),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
WsMsg::AuthorizeExpired => {
|
WsMsg::Session(WsMsgSession::AuthorizeExpired) => {
|
||||||
log::warn!("Received token expired");
|
log::warn!("Received token expired");
|
||||||
if let Ok(msg) = write_auth_token(None) {
|
if let Ok(msg) = write_auth_token(None) {
|
||||||
orders.skip().send_msg(msg).send_msg(Msg::ResourceChanged(
|
orders.skip().send_msg(msg).send_msg(Msg::ResourceChanged(
|
||||||
@ -166,7 +169,7 @@ pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
// user settings
|
// user settings
|
||||||
WsMsg::UserSettingUpdated(setting) => {
|
WsMsg::User(WsMsgUser::UserSettingUpdated(setting)) => {
|
||||||
model.user_settings = Some(setting);
|
model.user_settings = Some(setting);
|
||||||
orders.send_msg(Msg::ResourceChanged(
|
orders.send_msg(Msg::ResourceChanged(
|
||||||
ResourceKind::UserSetting,
|
ResourceKind::UserSetting,
|
||||||
@ -331,7 +334,7 @@ pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
Some(comment_id),
|
Some(comment_id),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
WsMsg::AvatarUrlChanged(user_id, avatar_url) => {
|
WsMsg::User(WsMsgUser::AvatarUrlChanged(user_id, avatar_url)) => {
|
||||||
for user in model.users.iter_mut() {
|
for user in model.users.iter_mut() {
|
||||||
if user.id == user_id {
|
if user.id == user_id {
|
||||||
user.avatar_url = Some(avatar_url.clone());
|
user.avatar_url = Some(avatar_url.clone());
|
||||||
@ -349,7 +352,7 @@ pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
// messages
|
// messages
|
||||||
WsMsg::MessageUpdated(mut received) => {
|
WsMsg::Message(WsMsgMessage::MessageUpdated(mut received)) => {
|
||||||
if let Some(idx) = model.messages.iter().position(|m| m.id == received.id) {
|
if let Some(idx) = model.messages.iter().position(|m| m.id == received.id) {
|
||||||
std::mem::swap(&mut model.messages[idx], &mut received);
|
std::mem::swap(&mut model.messages[idx], &mut received);
|
||||||
}
|
}
|
||||||
@ -360,7 +363,7 @@ pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
Some(received.id),
|
Some(received.id),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
WsMsg::MessagesLoaded(v) => {
|
WsMsg::Message(WsMsgMessage::MessagesLoaded(v)) => {
|
||||||
model.messages = v;
|
model.messages = v;
|
||||||
model.messages.sort_by(|a, b| a.id.cmp(&b.id));
|
model.messages.sort_by(|a, b| a.id.cmp(&b.id));
|
||||||
orders.send_msg(Msg::ResourceChanged(
|
orders.send_msg(Msg::ResourceChanged(
|
||||||
@ -369,7 +372,7 @@ pub fn update(msg: WsMsg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
|||||||
None,
|
None,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
WsMsg::MessageMarkedSeen(id, _count) => {
|
WsMsg::Message(WsMsgMessage::MessageMarkedSeen(id, _count)) => {
|
||||||
if let Some(idx) = model.messages.iter().position(|m| m.id == id) {
|
if let Some(idx) = model.messages.iter().position(|m| m.id == id) {
|
||||||
model.messages.remove(idx);
|
model.messages.remove(idx);
|
||||||
}
|
}
|
||||||
|
@ -247,11 +247,7 @@ impl From<WsMsgProject> for WsMsg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||||
pub enum WsMsg {
|
pub enum WsMsgSession {
|
||||||
Ping,
|
|
||||||
Pong,
|
|
||||||
Die,
|
|
||||||
|
|
||||||
// auth
|
// auth
|
||||||
AuthorizeLoad(Uuid),
|
AuthorizeLoad(Uuid),
|
||||||
AuthorizeLoaded(Result<(User, UserSetting), String>),
|
AuthorizeLoaded(Result<(User, UserSetting), String>),
|
||||||
@ -266,22 +262,16 @@ pub enum WsMsg {
|
|||||||
SignUpRequest(EmailString, UsernameString),
|
SignUpRequest(EmailString, UsernameString),
|
||||||
SignUpSuccess,
|
SignUpSuccess,
|
||||||
SignUpPairTaken,
|
SignUpPairTaken,
|
||||||
|
}
|
||||||
|
|
||||||
// invitations
|
impl From<WsMsgSession> for WsMsg {
|
||||||
Invitation(WsMsgInvitation),
|
fn from(msg: WsMsgSession) -> WsMsg {
|
||||||
|
WsMsg::Session(msg)
|
||||||
// project page
|
}
|
||||||
Project(WsMsgProject),
|
}
|
||||||
|
|
||||||
// issue
|
|
||||||
Issue(WsMsgIssue),
|
|
||||||
|
|
||||||
// issue status
|
|
||||||
IssueStatus(WsMsgIssueStatus),
|
|
||||||
|
|
||||||
// comments
|
|
||||||
Comment(WsMsgComment),
|
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||||
|
pub enum WsMsgUser {
|
||||||
// users
|
// users
|
||||||
AvatarUrlChanged(UserId, AvatarUrl),
|
AvatarUrlChanged(UserId, AvatarUrl),
|
||||||
ProfileUpdate(EmailString, UsernameString),
|
ProfileUpdate(EmailString, UsernameString),
|
||||||
@ -290,23 +280,52 @@ pub enum WsMsg {
|
|||||||
// user settings
|
// user settings
|
||||||
UserSettingUpdated(UserSetting),
|
UserSettingUpdated(UserSetting),
|
||||||
UserSettingSetEditorMode(TextEditorMode),
|
UserSettingSetEditorMode(TextEditorMode),
|
||||||
|
}
|
||||||
|
|
||||||
// user projects
|
impl From<WsMsgUser> for WsMsg {
|
||||||
UserProjectsLoad,
|
fn from(msg: WsMsgUser) -> WsMsg {
|
||||||
UserProjectsLoaded(Vec<UserProject>),
|
WsMsg::User(msg)
|
||||||
UserProjectSetCurrent(UserProjectId),
|
}
|
||||||
UserProjectCurrentChanged(UserProject),
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||||
|
pub enum WsMsgMessage {
|
||||||
// messages
|
// messages
|
||||||
MessageUpdated(Message),
|
MessageUpdated(Message),
|
||||||
MessagesLoad,
|
MessagesLoad,
|
||||||
MessagesLoaded(Vec<Message>),
|
MessagesLoaded(Vec<Message>),
|
||||||
MessageMarkSeen(MessageId),
|
MessageMarkSeen(MessageId),
|
||||||
MessageMarkedSeen(MessageId, NumberOfDeleted),
|
MessageMarkedSeen(MessageId, NumberOfDeleted),
|
||||||
|
}
|
||||||
|
|
||||||
// epics
|
impl From<WsMsgMessage> for WsMsg {
|
||||||
|
fn from(msg: WsMsgMessage) -> WsMsg {
|
||||||
|
WsMsg::Message(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||||
|
pub enum WsMsg {
|
||||||
|
Ping,
|
||||||
|
Pong,
|
||||||
|
Die,
|
||||||
|
|
||||||
|
Session(WsMsgSession),
|
||||||
|
Invitation(WsMsgInvitation),
|
||||||
|
Project(WsMsgProject),
|
||||||
|
Issue(WsMsgIssue),
|
||||||
|
IssueStatus(WsMsgIssueStatus),
|
||||||
|
Comment(WsMsgComment),
|
||||||
|
User(WsMsgUser),
|
||||||
|
Message(WsMsgMessage),
|
||||||
Epic(WsMsgEpic),
|
Epic(WsMsgEpic),
|
||||||
|
|
||||||
|
// user projects
|
||||||
|
UserProjectsLoad,
|
||||||
|
UserProjectsLoaded(Vec<UserProject>),
|
||||||
|
UserProjectSetCurrent(UserProjectId),
|
||||||
|
UserProjectCurrentChanged(UserProject),
|
||||||
|
|
||||||
// highlight
|
// highlight
|
||||||
HighlightCode(Lang, Code),
|
HighlightCode(Lang, Code),
|
||||||
HighlightedCode(HighlightedCode),
|
HighlightedCode(HighlightedCode),
|
||||||
|
Loading…
Reference in New Issue
Block a user