chore: fix user awareness fetch (#5048)

* chore: fix user awareness fetch

* chore: update

* chore: update
This commit is contained in:
Nathan.fooo
2024-04-03 15:43:19 +08:00
committed by GitHub
parent 38fe61ff69
commit 58fb529eaa
22 changed files with 216 additions and 172 deletions

View File

@ -212,7 +212,12 @@ pub trait UserCloudService: Send + Sync + 'static {
FutureResult::new(async { Ok(vec![]) })
}
fn get_user_awareness_doc_state(&self, uid: i64) -> FutureResult<Vec<u8>, FlowyError>;
fn get_user_awareness_doc_state(
&self,
uid: i64,
workspace_id: &str,
object_id: &str,
) -> FutureResult<Vec<u8>, FlowyError>;
fn receive_realtime_event(&self, _json: Value) {}

View File

@ -396,6 +396,10 @@ pub struct WorkspaceMember {
pub name: String,
}
pub fn awareness_oid_from_user_uuid(user_uuid: &Uuid) -> Uuid {
Uuid::new_v5(user_uuid, b"user_awareness")
/// represent the user awareness object id for the workspace.
pub fn user_awareness_object_id(user_uuid: &Uuid, workspace_id: &str) -> Uuid {
Uuid::new_v5(
user_uuid,
format!("user_awareness:{}", workspace_id).as_bytes(),
)
}