fix: not show deleted post to admin

This commit is contained in:
2022-11-30 21:53:07 +08:00
parent 54fa0e1cbd
commit 104ccb030d

View File

@@ -224,12 +224,12 @@ pub trait Ugc {
fn extra_delete_condition(&self) -> bool;
async fn do_set_deleted(&mut self, db: &Db) -> Api<()>;
fn check_permission(&self, user: &CurrentUser, mode: &str) -> Api<()> {
if user.is_admin {
return Ok(());
}
if mode.contains('r') && self.get_is_deleted() {
return Err(ApiError::Pc(PolicyError::IsDeleted));
}
if user.is_admin {
return Ok(());
}
if mode.contains('o') && self.get_is_reported() {
return Err(ApiError::Pc(PolicyError::IsReported));
}