comment_view.comment.read = true;
}
- let mut res = CommentResponse {
+ let res = CommentResponse {
comment_view,
recipient_ids,
form_id: data.form_id.to_owned(),
websocket_id,
});
- // strip out the recipient_ids, so that
- // users don't get double notifs
- // TODO Do this in a different way
- res.recipient_ids = Vec::new();
-
Ok(res)
}
}
})
.await??;
- let mut res = CommentResponse {
+ let res = CommentResponse {
comment_view,
recipient_ids,
form_id: data.form_id.to_owned(),
websocket_id,
});
- // strip out the recipient_ids, so that
- // users don't get double notifs
- // TODO again
- res.recipient_ids = Vec::new();
-
Ok(res)
}
}
)
.await?;
- let mut res = CommentResponse {
+ let res = CommentResponse {
comment_view,
recipient_ids,
form_id: None, // TODO a comment delete might clear forms?
websocket_id,
});
- // strip out the recipient_ids, so that
- // users don't get double notifs
- // TODO again
- res.recipient_ids = Vec::new();
-
Ok(res)
}
}
)
.await?;
- let mut res = CommentResponse {
+ let res = CommentResponse {
comment_view,
recipient_ids,
form_id: None, // TODO maybe this might clear other forms
websocket_id,
});
- // strip out the recipient_ids, so that
- // users don't get double notifs
- // TODO again
- res.recipient_ids = Vec::new();
-
Ok(res)
}
}
})
.await??;
- let mut res = CommentResponse {
+ let res = CommentResponse {
comment_view: liked_comment,
recipient_ids,
form_id: None,
websocket_id,
});
- // strip out the recipient_ids, so that
- // users don't get double notifs
- res.recipient_ids = Vec::new();
- // TODO why
-
Ok(res)
}
}
websocket_id: Option<ConnectionId>,
op: UserOperation,
) {
- // TODO is there any way around this?
// Strip out the user id and subscribed when sending to others
- // let mut res_sent = res.clone();
- // res_sent.community_view.user_id = None;
- // res_sent.community.subscribed = None;
+ let mut res_sent = res.clone();
+ res_sent.community_view.subscribed = false;
context.chat_server().do_send(SendCommunityRoomMessage {
op,
- response: res.to_owned(),
+ response: res_sent,
community_id: res.community_view.community.id,
websocket_id,
});
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,
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(
)?;
}
- // 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(())
}
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,
)?;