mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-16 21:16:30 +00:00
Fixing top level replies, and notifs.
This commit is contained in:
parent
eafdf3033f
commit
82227846af
3 changed files with 6 additions and 4 deletions
|
@ -152,7 +152,7 @@ impl Perform for CreateComment {
|
||||||
comment_view.comment.read = true;
|
comment_view.comment.read = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let res = CommentResponse {
|
let mut res = CommentResponse {
|
||||||
comment_view,
|
comment_view,
|
||||||
recipient_ids,
|
recipient_ids,
|
||||||
form_id: data.form_id.to_owned(),
|
form_id: data.form_id.to_owned(),
|
||||||
|
@ -164,6 +164,8 @@ impl Perform for CreateComment {
|
||||||
websocket_id,
|
websocket_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
res.recipient_ids = Vec::new(); // Necessary to avoid doubles
|
||||||
|
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,7 +321,8 @@ impl<'a> CommentQueryBuilder<'a> {
|
||||||
if let Some(recipient_id) = self.recipient_id {
|
if let Some(recipient_id) = self.recipient_id {
|
||||||
query = query
|
query = query
|
||||||
// TODO needs lots of testing
|
// TODO needs lots of testing
|
||||||
.filter(user_alias_1::id.eq(recipient_id))
|
.filter(user_alias_1::id.eq(recipient_id)) // Gets the comment replies
|
||||||
|
.or_filter(comment::parent_id.is_null().and(post::creator_id.eq(recipient_id))) // Gets the top level replies
|
||||||
.filter(comment::deleted.eq(false))
|
.filter(comment::deleted.eq(false))
|
||||||
.filter(comment::removed.eq(false));
|
.filter(comment::removed.eq(false));
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,6 +335,7 @@ impl ChatServer {
|
||||||
|
|
||||||
// Send it to the post room
|
// Send it to the post room
|
||||||
let mut comment_post_sent = comment_reply_sent.clone();
|
let mut comment_post_sent = comment_reply_sent.clone();
|
||||||
|
// Remove the recipients here to separate mentions / user messages from post or community comments
|
||||||
comment_post_sent.recipient_ids = Vec::new();
|
comment_post_sent.recipient_ids = Vec::new();
|
||||||
self.send_post_room_message(
|
self.send_post_room_message(
|
||||||
user_operation,
|
user_operation,
|
||||||
|
@ -352,8 +353,6 @@ impl ChatServer {
|
||||||
websocket_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
|
// Send it to the recipient(s) including the mentioned users
|
||||||
for recipient_id in &comment_reply_sent.recipient_ids {
|
for recipient_id in &comment_reply_sent.recipient_ids {
|
||||||
self.send_user_room_message(
|
self.send_user_room_message(
|
||||||
|
|
Loading…
Reference in a new issue