mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge branch 'feat/support-get-encoded-collab-event' of https://github.com/AppFlowy-IO/AppFlowy into feat/support-get-encoded-collab-event
This commit is contained in:
commit
9c3f083684
@ -75,8 +75,7 @@ impl DocumentManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// In order to support the requirement of automatically publishing sub-documents in publishing requirements,
|
/// Get the encoded collab of the document.
|
||||||
/// we need to read binary data from disk instead of reading from the open document.
|
|
||||||
pub async fn encode_collab(&self, doc_id: &str) -> FlowyResult<EncodedCollab> {
|
pub async fn encode_collab(&self, doc_id: &str) -> FlowyResult<EncodedCollab> {
|
||||||
let doc_state = DataSource::Disk;
|
let doc_state = DataSource::Disk;
|
||||||
let uid = self.user_service.user_id()?;
|
let uid = self.user_service.user_id()?;
|
||||||
|
@ -73,12 +73,14 @@ pub struct PublishViewMeta {
|
|||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct PublishViewPayload {
|
pub struct PublishViewPayload {
|
||||||
pub meta: PublishViewMeta,
|
pub meta: PublishViewMeta,
|
||||||
|
/// The doc_state of the encoded collab.
|
||||||
pub data: Vec<u8>,
|
pub data: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct PublishInfoResponse {
|
pub struct PublishInfoResponse {
|
||||||
pub view_id: String,
|
pub view_id: String,
|
||||||
|
/// one part of publish url: /{namespace}/{publish_name}
|
||||||
pub publish_name: String,
|
pub publish_name: String,
|
||||||
pub namespace: Option<String>,
|
pub namespace: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -868,8 +868,8 @@ impl FolderManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The view will be published to the web with the specified view id.
|
/// Publish the view with the given view id.
|
||||||
/// The [publish_name] is the [view name] + [view id] when currently published
|
/// [publish_name] is one part of the URL of the published view. if it is None, the default publish name will be used. The default publish name is generated by the view id and view name.
|
||||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||||
pub async fn publish_view(&self, view_id: &str, publish_name: Option<String>) -> FlowyResult<()> {
|
pub async fn publish_view(&self, view_id: &str, publish_name: Option<String>) -> FlowyResult<()> {
|
||||||
let view = self
|
let view = self
|
||||||
@ -898,6 +898,7 @@ impl FolderManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Unpublish the view with the given view id.
|
||||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||||
pub async fn unpublish_views(&self, view_ids: Vec<String>) -> FlowyResult<()> {
|
pub async fn unpublish_views(&self, view_ids: Vec<String>) -> FlowyResult<()> {
|
||||||
let workspace_id = self.user.workspace_id()?;
|
let workspace_id = self.user.workspace_id()?;
|
||||||
@ -908,12 +909,16 @@ impl FolderManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the publish info of the view with the given view id.
|
||||||
|
/// The publish info contains the namespace and publish_name of the view.
|
||||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||||
pub async fn get_publish_info(&self, view_id: &str) -> FlowyResult<PublishInfoResponse> {
|
pub async fn get_publish_info(&self, view_id: &str) -> FlowyResult<PublishInfoResponse> {
|
||||||
let publish_info = self.cloud_service.get_publish_info(view_id).await?;
|
let publish_info = self.cloud_service.get_publish_info(view_id).await?;
|
||||||
Ok(publish_info)
|
Ok(publish_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the namespace of the current workspace.
|
||||||
|
/// The namespace is used to generate the URL of the published view.
|
||||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||||
pub async fn set_publish_namespace(&self, namespace: String) -> FlowyResult<()> {
|
pub async fn set_publish_namespace(&self, namespace: String) -> FlowyResult<()> {
|
||||||
let workspace_id = self.user.workspace_id()?;
|
let workspace_id = self.user.workspace_id()?;
|
||||||
@ -924,6 +929,7 @@ impl FolderManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the namespace of the current workspace.
|
||||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||||
pub async fn get_publish_namespace(&self) -> FlowyResult<String> {
|
pub async fn get_publish_namespace(&self) -> FlowyResult<String> {
|
||||||
let workspace_id = self.user.workspace_id()?;
|
let workspace_id = self.user.workspace_id()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user