mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 17:31:02 +00:00
* Fix issue with sending private messages to yourself. Fixes #3912 * Fix clippy.
This commit is contained in:
parent
c38dfdcd64
commit
0b41ddca58
1 changed files with 1 additions and 9 deletions
|
@ -18,7 +18,7 @@ pub async fn get_private_message(
|
|||
let limit = data.limit;
|
||||
let unread_only = data.unread_only.unwrap_or_default();
|
||||
let creator_id = data.creator_id;
|
||||
let mut messages = PrivateMessageQuery {
|
||||
let messages = PrivateMessageQuery {
|
||||
page,
|
||||
limit,
|
||||
unread_only,
|
||||
|
@ -27,14 +27,6 @@ pub async fn get_private_message(
|
|||
.list(&mut context.pool(), person_id)
|
||||
.await?;
|
||||
|
||||
// Messages sent by ourselves should be marked as read. The `read` column in database is only
|
||||
// for the recipient, and shouldnt be exposed to sender.
|
||||
messages.iter_mut().for_each(|pmv| {
|
||||
if pmv.creator.id == person_id {
|
||||
pmv.private_message.read = true
|
||||
}
|
||||
});
|
||||
|
||||
Ok(Json(PrivateMessagesResponse {
|
||||
private_messages: messages,
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue