fix: don't allow reports to be spam deleted

This commit is contained in:
trisua 2025-05-22 00:36:35 -04:00
parent 3224ce3305
commit 37e68079d8

View file

@ -85,6 +85,10 @@ impl DataManager {
} }
pub async fn delete_report(&self, id: usize, user: User) -> Result<()> { pub async fn delete_report(&self, id: usize, user: User) -> Result<()> {
if let Err(e) = self.get_report_by_id(id).await {
return Err(e);
}
if !user.permissions.check(FinePermission::MANAGE_REPORTS) { if !user.permissions.check(FinePermission::MANAGE_REPORTS) {
return Err(Error::NotAllowed); return Err(Error::NotAllowed);
} }