chore: remove logs (#986)

This commit is contained in:
Nathan.fooo 2024-11-13 13:59:23 +08:00 committed by GitHub
parent 9778843746
commit 91b0c50722
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 9 deletions

View File

@ -162,7 +162,10 @@ where
if result {
Ok(())
} else {
Err(AppError::NotEnoughPermissions)
Err(AppError::NotEnoughPermissions {
user: uid.to_string(),
workspace_id: workspace_id.to_string(),
})
}
}

View File

@ -64,8 +64,10 @@ pub enum AppError {
#[error("Not Logged In:{0}")]
NotLoggedIn(String),
#[error("User does not have permissions to execute this action")]
NotEnoughPermissions,
#[error(
"User:{user} does not have permissions to execute this action in workspace:{workspace_id}"
)]
NotEnoughPermissions { user: String, workspace_id: String },
#[error("s3 response error:{0}")]
S3ResponseError(String),

View File

@ -526,7 +526,10 @@ pub async fn delete_workspace_members(
.unwrap_or(false);
if is_owner {
return Err(AppError::NotEnoughPermissions);
return Err(AppError::NotEnoughPermissions {
user: member_email.to_string(),
workspace_id: workspace_id.to_string(),
});
}
sqlx::query!(

View File

@ -206,11 +206,12 @@ impl CollabBroadcast {
trace!("[realtime]: send {} => {}", message, cloned_user.user_device());
if let Err(err) = sink.send(message).await {
error!("fail to broadcast message:{}", err);
warn!("fail to broadcast message:{}", err);
}
}
Err(e) => {
error!("fail to receive message:{}", e);
Err(_) => {
// Err(RecvError::Closed) is returned when all Sender halves have dropped,
// indicating that no further values can be sent on the channel.
break;
},
}

View File

@ -75,7 +75,7 @@ impl CollabGroup {
));
let broadcast = {
let lock = collab.read().await;
CollabBroadcast::new(&object_id, 10, edit_state.clone(), &lock)
CollabBroadcast::new(&object_id, 1000, edit_state.clone(), &lock)
};
let (destroy_group_tx, rx) = mpsc::channel(1);

View File

@ -79,8 +79,15 @@ pub async fn get_access_request(
) -> Result<AccessRequest, AppError> {
let access_request_with_view_id =
select_access_request_by_request_id(pg_pool, access_request_id).await?;
if access_request_with_view_id.workspace.owner_uid != user_uid {
return Err(AppError::NotEnoughPermissions);
return Err(AppError::NotEnoughPermissions {
user: user_uid.to_string(),
workspace_id: access_request_with_view_id
.workspace
.workspace_id
.to_string(),
});
}
let folder = get_latest_collab_folder(
collab_storage,