You've already forked AstralRinth
forked from didirus/AstralRinth
Fix deletion of private notes (#814)
This commit is contained in:
@@ -40,7 +40,10 @@ pub enum LegacyMessageBody {
|
||||
},
|
||||
ThreadClosure,
|
||||
ThreadReopen,
|
||||
Deleted,
|
||||
Deleted {
|
||||
#[serde(default)]
|
||||
private: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Eq, PartialEq, Copy, Clone)]
|
||||
@@ -90,7 +93,9 @@ impl From<crate::models::v3::threads::MessageBody> for LegacyMessageBody {
|
||||
crate::models::v3::threads::MessageBody::ThreadReopen => {
|
||||
LegacyMessageBody::ThreadReopen
|
||||
}
|
||||
crate::models::v3::threads::MessageBody::Deleted => LegacyMessageBody::Deleted,
|
||||
crate::models::v3::threads::MessageBody::Deleted { private } => {
|
||||
LegacyMessageBody::Deleted { private }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user