|
|
|
@ -328,15 +328,14 @@ impl ChatServer {
|
|
|
|
|
comment: &CommentResponse,
|
|
|
|
|
websocket_id: Option<ConnectionId>,
|
|
|
|
|
) -> Result<(), LemmyError> {
|
|
|
|
|
let comment_reply_sent = comment.clone();
|
|
|
|
|
// TODO what is this here
|
|
|
|
|
// comment_reply_sent.comment_view.my_vote = None;
|
|
|
|
|
// comment_reply_sent.comment.user_id = None;
|
|
|
|
|
let mut comment_reply_sent = comment.clone();
|
|
|
|
|
|
|
|
|
|
let mut comment_post_sent = comment_reply_sent.clone();
|
|
|
|
|
comment_post_sent.recipient_ids = Vec::new();
|
|
|
|
|
// Strip out my specific user info
|
|
|
|
|
comment_reply_sent.comment_view.my_vote = None;
|
|
|
|
|
|
|
|
|
|
// Send it to the post room
|
|
|
|
|
let mut comment_post_sent = comment_reply_sent.clone();
|
|
|
|
|
comment_post_sent.recipient_ids = Vec::new();
|
|
|
|
|
self.send_post_room_message(
|
|
|
|
|
user_operation,
|
|
|
|
|
&comment_post_sent,
|
|
|
|
@ -344,6 +343,17 @@ impl ChatServer {
|
|
|
|
|
websocket_id,
|
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
// Send it to the community too
|
|
|
|
|
self.send_community_room_message(user_operation, &comment_post_sent, 0, websocket_id)?;
|
|
|
|
|
self.send_community_room_message(
|
|
|
|
|
user_operation,
|
|
|
|
|
&comment_post_sent,
|
|
|
|
|
comment.comment_view.community.id,
|
|
|
|
|
websocket_id,
|
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
// Remove the form id here to separate mentions / user messages from post or community comments
|
|
|
|
|
comment_reply_sent.form_id = None;
|
|
|
|
|
// Send it to the recipient(s) including the mentioned users
|
|
|
|
|
for recipient_id in &comment_reply_sent.recipient_ids {
|
|
|
|
|
self.send_user_room_message(
|
|
|
|
@ -354,15 +364,6 @@ impl ChatServer {
|
|
|
|
|
)?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Send it to the community too
|
|
|
|
|
self.send_community_room_message(user_operation, &comment_post_sent, 0, websocket_id)?;
|
|
|
|
|
self.send_community_room_message(
|
|
|
|
|
user_operation,
|
|
|
|
|
&comment_post_sent,
|
|
|
|
|
comment.comment_view.community.id,
|
|
|
|
|
websocket_id,
|
|
|
|
|
)?;
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -375,19 +376,17 @@ impl ChatServer {
|
|
|
|
|
let community_id = post_res.post_view.community.id;
|
|
|
|
|
|
|
|
|
|
// Don't send my data with it
|
|
|
|
|
// TODO no idea what to do here
|
|
|
|
|
// let mut post_sent = post_res.clone();
|
|
|
|
|
// post_sent.post.my_vote = None;
|
|
|
|
|
// post_sent.post.user_id = None;
|
|
|
|
|
let mut post_sent = post_res.clone();
|
|
|
|
|
post_sent.post_view.my_vote = None;
|
|
|
|
|
|
|
|
|
|
// Send it to /c/all and that community
|
|
|
|
|
self.send_community_room_message(user_operation, &post_res, 0, websocket_id)?;
|
|
|
|
|
self.send_community_room_message(user_operation, &post_res, community_id, websocket_id)?;
|
|
|
|
|
self.send_community_room_message(user_operation, &post_sent, 0, websocket_id)?;
|
|
|
|
|
self.send_community_room_message(user_operation, &post_sent, community_id, websocket_id)?;
|
|
|
|
|
|
|
|
|
|
// Send it to the post room
|
|
|
|
|
self.send_post_room_message(
|
|
|
|
|
user_operation,
|
|
|
|
|
&post_res,
|
|
|
|
|
&post_sent,
|
|
|
|
|
post_res.post_view.post.id,
|
|
|
|
|
websocket_id,
|
|
|
|
|
)?;
|
|
|
|
|