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,
|
||||
/// we need to read binary data from disk instead of reading from the open document.
|
||||
/// Get the encoded collab of the document.
|
||||
pub async fn encode_collab(&self, doc_id: &str) -> FlowyResult<EncodedCollab> {
|
||||
let doc_state = DataSource::Disk;
|
||||
let uid = self.user_service.user_id()?;
|
||||
|
@ -73,12 +73,14 @@ pub struct PublishViewMeta {
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishViewPayload {
|
||||
pub meta: PublishViewMeta,
|
||||
/// The doc_state of the encoded collab.
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct PublishInfoResponse {
|
||||
pub view_id: String,
|
||||
/// one part of publish url: /{namespace}/{publish_name}
|
||||
pub publish_name: String,
|
||||
pub namespace: Option<String>,
|
||||
}
|
||||
|
@ -868,8 +868,8 @@ impl FolderManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The view will be published to the web with the specified view id.
|
||||
/// The [publish_name] is the [view name] + [view id] when currently published
|
||||
/// Publish the view with the given view id.
|
||||
/// [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)]
|
||||
pub async fn publish_view(&self, view_id: &str, publish_name: Option<String>) -> FlowyResult<()> {
|
||||
let view = self
|
||||
@ -898,6 +898,7 @@ impl FolderManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Unpublish the view with the given view id.
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
pub async fn unpublish_views(&self, view_ids: Vec<String>) -> FlowyResult<()> {
|
||||
let workspace_id = self.user.workspace_id()?;
|
||||
@ -908,12 +909,16 @@ impl FolderManager {
|
||||
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)]
|
||||
pub async fn get_publish_info(&self, view_id: &str) -> FlowyResult<PublishInfoResponse> {
|
||||
let publish_info = self.cloud_service.get_publish_info(view_id).await?;
|
||||
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)]
|
||||
pub async fn set_publish_namespace(&self, namespace: String) -> FlowyResult<()> {
|
||||
let workspace_id = self.user.workspace_id()?;
|
||||
@ -924,6 +929,7 @@ impl FolderManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get the namespace of the current workspace.
|
||||
#[tracing::instrument(level = "debug", skip(self), err)]
|
||||
pub async fn get_publish_namespace(&self) -> FlowyResult<String> {
|
||||
let workspace_id = self.user.workspace_id()?;
|
||||
|
Loading…
Reference in New Issue
Block a user