Mark own private messages as read in api (fixes #2484) (#2531)

This commit is contained in:
Nutomic 2022-11-03 17:41:44 +00:00 committed by GitHub
parent b5cd732372
commit 5e871ca7ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,6 +39,14 @@ impl PerformCrud for GetPrivateMessages {
}) })
.await??; .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 // Blank out deleted or removed info
for pmv in messages for pmv in messages
.iter_mut() .iter_mut()