fix: not show deleted post to admin
This commit is contained in:
@@ -224,12 +224,12 @@ pub trait Ugc {
|
|||||||
fn extra_delete_condition(&self) -> bool;
|
fn extra_delete_condition(&self) -> bool;
|
||||||
async fn do_set_deleted(&mut self, db: &Db) -> Api<()>;
|
async fn do_set_deleted(&mut self, db: &Db) -> Api<()>;
|
||||||
fn check_permission(&self, user: &CurrentUser, mode: &str) -> Api<()> {
|
fn check_permission(&self, user: &CurrentUser, mode: &str) -> Api<()> {
|
||||||
if user.is_admin {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
if mode.contains('r') && self.get_is_deleted() {
|
if mode.contains('r') && self.get_is_deleted() {
|
||||||
return Err(ApiError::Pc(PolicyError::IsDeleted));
|
return Err(ApiError::Pc(PolicyError::IsDeleted));
|
||||||
}
|
}
|
||||||
|
if user.is_admin {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
if mode.contains('o') && self.get_is_reported() {
|
if mode.contains('o') && self.get_is_reported() {
|
||||||
return Err(ApiError::Pc(PolicyError::IsReported));
|
return Err(ApiError::Pc(PolicyError::IsReported));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user