Fix deletion of private notes (#814)

This commit is contained in:
Geometrically
2023-12-28 20:25:55 -05:00
committed by GitHub
parent f199ecf8e9
commit cf9c8cbb4f
4 changed files with 26 additions and 6 deletions

View File

@@ -51,7 +51,10 @@ pub enum MessageBody {
},
ThreadClosure,
ThreadReopen,
Deleted,
Deleted {
#[serde(default)]
private: bool,
},
}
#[derive(Serialize, Deserialize, Eq, PartialEq, Copy, Clone)]
@@ -103,6 +106,8 @@ impl Thread {
.filter(|x| {
if let MessageBody::Text { private, .. } = x.body {
!private || user.role.is_mod()
} else if let MessageBody::Deleted { private, .. } = x.body {
!private || user.role.is_mod()
} else {
true
}