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 { if result {
Ok(()) Ok(())
} else { } 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}")] #[error("Not Logged In:{0}")]
NotLoggedIn(String), NotLoggedIn(String),
#[error("User does not have permissions to execute this action")] #[error(
NotEnoughPermissions, "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}")] #[error("s3 response error:{0}")]
S3ResponseError(String), S3ResponseError(String),

View File

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

View File

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

View File

@ -75,7 +75,7 @@ impl CollabGroup {
)); ));
let broadcast = { let broadcast = {
let lock = collab.read().await; 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); let (destroy_group_tx, rx) = mpsc::channel(1);

View File

@ -79,8 +79,15 @@ pub async fn get_access_request(
) -> Result<AccessRequest, AppError> { ) -> Result<AccessRequest, AppError> {
let access_request_with_view_id = let access_request_with_view_id =
select_access_request_by_request_id(pg_pool, access_request_id).await?; select_access_request_by_request_id(pg_pool, access_request_id).await?;
if access_request_with_view_id.workspace.owner_uid != user_uid { 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( let folder = get_latest_collab_folder(
collab_storage, collab_storage,