From: Nutomic Date: Thu, 3 Nov 2022 17:41:44 +0000 (+0000) Subject: Mark own private messages as read in api (fixes #2484) (#2531) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/readmes/%7Burl%7D?a=commitdiff_plain;h=5e871ca7baf2f12f9136aa54814ccb9e92da8203;p=lemmy.git Mark own private messages as read in api (fixes #2484) (#2531) --- diff --git a/crates/api_crud/src/private_message/read.rs b/crates/api_crud/src/private_message/read.rs index fbf7621c..cc03c318 100644 --- a/crates/api_crud/src/private_message/read.rs +++ b/crates/api_crud/src/private_message/read.rs @@ -39,6 +39,14 @@ impl PerformCrud for GetPrivateMessages { }) .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 + } + }); + // Blank out deleted or removed info for pmv in messages .iter_mut()