From 0f7a1f41d0bd05e96180c1158f8a73ed02509fea Mon Sep 17 00:00:00 2001
From: Khor Shu Heng <32997938+khorshuheng@users.noreply.github.com>
Date: Fri, 17 Jan 2025 09:43:56 +0800
Subject: [PATCH] feat: support disabling comments and disallow duplicate as
template for published page (#1167)
---
...fec948a99c96d6f02bcf11eae7aeeea62e5a0.json | 20 ------
...6f57705151e3c2318519e877b22f8ffc871b.json} | 16 ++++-
...ff015d39bdd78ac20d56570306616bf10faf3.json | 22 ++++++
...f01df960e3fe5abd841752c05782c7203ff12.json | 16 -----
libs/client-api-test/src/test_client.rs | 10 ++-
libs/database-entity/src/dto.rs | 4 ++
libs/database/src/pg_row.rs | 2 +
libs/database/src/publish.rs | 72 ++++++++++++-------
libs/shared-entity/src/dto/workspace_dto.rs | 4 ++
migrations/20250113091708_publish_options.sql | 3 +
nginx/nginx.conf | 12 ++++
src/api/workspace.rs | 16 ++++-
src/biz/collab/ops.rs | 2 +
src/biz/search/ops.rs | 2 -
src/biz/workspace/page_view.rs | 4 ++
tests/workspace/page_view.rs | 2 +
tests/workspace/publish.rs | 63 ++++++++++++++--
tests/workspace/template.rs | 2 +
18 files changed, 201 insertions(+), 71 deletions(-)
delete mode 100644 .sqlx/query-0857da7f3d100186aab8a6f881dfec948a99c96d6f02bcf11eae7aeeea62e5a0.json
rename .sqlx/{query-4787139d2189fc33ac25ac07bb9f585f578bde4cd3f75a7da95aa849a25bca9d.json => query-223e530f8605f6d00789344565666f57705151e3c2318519e877b22f8ffc871b.json} (57%)
create mode 100644 .sqlx/query-94555a25b986992bd3cfb67bd36ff015d39bdd78ac20d56570306616bf10faf3.json
delete mode 100644 .sqlx/query-a98cb855107a0641979d3a7fecaf01df960e3fe5abd841752c05782c7203ff12.json
create mode 100644 migrations/20250113091708_publish_options.sql
diff --git a/.sqlx/query-0857da7f3d100186aab8a6f881dfec948a99c96d6f02bcf11eae7aeeea62e5a0.json b/.sqlx/query-0857da7f3d100186aab8a6f881dfec948a99c96d6f02bcf11eae7aeeea62e5a0.json
deleted file mode 100644
index 3d2465a7e..000000000
--- a/.sqlx/query-0857da7f3d100186aab8a6f881dfec948a99c96d6f02bcf11eae7aeeea62e5a0.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n INSERT INTO af_published_collab (workspace_id, view_id, publish_name, published_by, metadata, blob)\n SELECT * FROM UNNEST(\n (SELECT array_agg((SELECT $1::uuid)) FROM generate_series(1, $7))::uuid[],\n $2::uuid[],\n $3::text[],\n (SELECT array_agg((SELECT uid FROM af_user WHERE uuid = $4)) FROM generate_series(1, $7))::bigint[],\n $5::jsonb[],\n $6::bytea[]\n )\n ON CONFLICT (workspace_id, view_id) DO UPDATE\n SET metadata = EXCLUDED.metadata,\n blob = EXCLUDED.blob,\n published_by = EXCLUDED.published_by,\n publish_name = EXCLUDED.publish_name\n ",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Uuid",
- "UuidArray",
- "TextArray",
- "Uuid",
- "JsonbArray",
- "ByteaArray",
- "Int4"
- ]
- },
- "nullable": []
- },
- "hash": "0857da7f3d100186aab8a6f881dfec948a99c96d6f02bcf11eae7aeeea62e5a0"
-}
diff --git a/.sqlx/query-4787139d2189fc33ac25ac07bb9f585f578bde4cd3f75a7da95aa849a25bca9d.json b/.sqlx/query-223e530f8605f6d00789344565666f57705151e3c2318519e877b22f8ffc871b.json
similarity index 57%
rename from .sqlx/query-4787139d2189fc33ac25ac07bb9f585f578bde4cd3f75a7da95aa849a25bca9d.json
rename to .sqlx/query-223e530f8605f6d00789344565666f57705151e3c2318519e877b22f8ffc871b.json
index 63da70088..1432f1116 100644
--- a/.sqlx/query-4787139d2189fc33ac25ac07bb9f585f578bde4cd3f75a7da95aa849a25bca9d.json
+++ b/.sqlx/query-223e530f8605f6d00789344565666f57705151e3c2318519e877b22f8ffc871b.json
@@ -1,6 +1,6 @@
{
"db_name": "PostgreSQL",
- "query": "\n SELECT\n apc.view_id,\n apc.publish_name,\n au.email AS publisher_email,\n apc.created_at AS publish_timestamp\n FROM af_published_collab apc\n JOIN af_user au ON apc.published_by = au.uid\n WHERE workspace_id = $1\n AND unpublished_at IS NULL\n ",
+ "query": "\n SELECT\n apc.view_id,\n apc.publish_name,\n au.email AS publisher_email,\n apc.created_at AS publish_timestamp,\n apc.comments_enabled,\n apc.duplicate_enabled\n FROM af_published_collab apc\n JOIN af_user au ON apc.published_by = au.uid\n WHERE workspace_id = $1\n AND unpublished_at IS NULL\n ",
"describe": {
"columns": [
{
@@ -22,6 +22,16 @@
"ordinal": 3,
"name": "publish_timestamp",
"type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 4,
+ "name": "comments_enabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 5,
+ "name": "duplicate_enabled",
+ "type_info": "Bool"
}
],
"parameters": {
@@ -30,11 +40,13 @@
]
},
"nullable": [
+ false,
+ false,
false,
false,
false,
false
]
},
- "hash": "4787139d2189fc33ac25ac07bb9f585f578bde4cd3f75a7da95aa849a25bca9d"
+ "hash": "223e530f8605f6d00789344565666f57705151e3c2318519e877b22f8ffc871b"
}
diff --git a/.sqlx/query-94555a25b986992bd3cfb67bd36ff015d39bdd78ac20d56570306616bf10faf3.json b/.sqlx/query-94555a25b986992bd3cfb67bd36ff015d39bdd78ac20d56570306616bf10faf3.json
new file mode 100644
index 000000000..4de022acd
--- /dev/null
+++ b/.sqlx/query-94555a25b986992bd3cfb67bd36ff015d39bdd78ac20d56570306616bf10faf3.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO af_published_collab (workspace_id, view_id, publish_name, published_by, metadata, blob, comments_enabled, duplicate_enabled)\n SELECT * FROM UNNEST(\n (SELECT array_agg((SELECT $1::uuid)) FROM generate_series(1, $9))::uuid[],\n $2::uuid[],\n $3::text[],\n (SELECT array_agg((SELECT uid FROM af_user WHERE uuid = $4)) FROM generate_series(1, $9))::bigint[],\n $5::jsonb[],\n $6::bytea[],\n $7::boolean[],\n $8::boolean[]\n )\n ON CONFLICT (workspace_id, view_id) DO UPDATE\n SET metadata = EXCLUDED.metadata,\n blob = EXCLUDED.blob,\n published_by = EXCLUDED.published_by,\n publish_name = EXCLUDED.publish_name\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "UuidArray",
+ "TextArray",
+ "Uuid",
+ "JsonbArray",
+ "ByteaArray",
+ "BoolArray",
+ "BoolArray",
+ "Int4"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "94555a25b986992bd3cfb67bd36ff015d39bdd78ac20d56570306616bf10faf3"
+}
diff --git a/.sqlx/query-a98cb855107a0641979d3a7fecaf01df960e3fe5abd841752c05782c7203ff12.json b/.sqlx/query-a98cb855107a0641979d3a7fecaf01df960e3fe5abd841752c05782c7203ff12.json
deleted file mode 100644
index f6ce671ae..000000000
--- a/.sqlx/query-a98cb855107a0641979d3a7fecaf01df960e3fe5abd841752c05782c7203ff12.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n UPDATE af_published_collab\n SET publish_name = $1\n WHERE workspace_id = $2\n AND view_id = $3\n ",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Text",
- "Uuid",
- "Uuid"
- ]
- },
- "nullable": []
- },
- "hash": "a98cb855107a0641979d3a7fecaf01df960e3fe5abd841752c05782c7203ff12"
-}
diff --git a/libs/client-api-test/src/test_client.rs b/libs/client-api-test/src/test_client.rs
index 863438342..e4e69d5a3 100644
--- a/libs/client-api-test/src/test_client.rs
+++ b/libs/client-api-test/src/test_client.rs
@@ -1047,7 +1047,13 @@ impl TestClient {
}
/// data: [(view_id, meta_json, blob_hex)]
- pub async fn publish_collabs(&self, workspace_id: &str, data: Vec<(Uuid, &str, &str)>) {
+ pub async fn publish_collabs(
+ &self,
+ workspace_id: &str,
+ data: Vec<(Uuid, &str, &str)>,
+ comments_enabled: bool,
+ duplicate_enabled: bool,
+ ) {
let pub_items = data
.into_iter()
.map(|(view_id, meta_json, blob_hex)| {
@@ -1060,6 +1066,8 @@ impl TestClient {
metadata: meta,
},
data: blob,
+ comments_enabled,
+ duplicate_enabled,
}
})
.collect();
diff --git a/libs/database-entity/src/dto.rs b/libs/database-entity/src/dto.rs
index c5e979ac2..e08aa347a 100644
--- a/libs/database-entity/src/dto.rs
+++ b/libs/database-entity/src/dto.rs
@@ -801,12 +801,16 @@ pub struct PublishCollabKey {
pub struct PublishCollabItem {
pub meta: PublishCollabMetadata,
pub data: Data,
+ pub comments_enabled: bool,
+ pub duplicate_enabled: bool,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PatchPublishedCollab {
pub view_id: Uuid,
pub publish_name: Option,
+ pub comments_enabled: Option,
+ pub duplicate_enabled: Option,
}
#[derive(Serialize, Deserialize, Debug)]
diff --git a/libs/database/src/pg_row.rs b/libs/database/src/pg_row.rs
index 147980376..f768742cf 100644
--- a/libs/database/src/pg_row.rs
+++ b/libs/database/src/pg_row.rs
@@ -692,4 +692,6 @@ pub struct AFPublishViewWithPublishInfo {
pub publish_name: String,
pub publisher_email: String,
pub publish_timestamp: DateTime,
+ pub comments_enabled: bool,
+ pub duplicate_enabled: bool,
}
diff --git a/libs/database/src/publish.rs b/libs/database/src/publish.rs
index 0fedb0aa9..e80f46d2d 100644
--- a/libs/database/src/publish.rs
+++ b/libs/database/src/publish.rs
@@ -2,7 +2,7 @@ use app_error::AppError;
use database_entity::dto::{
PatchPublishedCollab, PublishCollabItem, PublishCollabKey, PublishInfo, WorkspaceNamespace,
};
-use sqlx::{Executor, PgPool, Postgres};
+use sqlx::{Executor, PgPool, Postgres, QueryBuilder};
use uuid::Uuid;
use crate::pg_row::AFPublishViewWithPublishInfo;
@@ -253,11 +253,15 @@ pub async fn insert_or_replace_publish_collabs(
let mut publish_names: Vec = Vec::with_capacity(item_count);
let mut metadatas: Vec = Vec::with_capacity(item_count);
let mut blobs: Vec> = Vec::with_capacity(item_count);
+ let mut comments_enabled_list: Vec = Vec::with_capacity(item_count);
+ let mut duplicate_enabled_list: Vec = Vec::with_capacity(item_count);
publish_items.into_iter().for_each(|item| {
view_ids.push(item.meta.view_id);
publish_names.push(item.meta.publish_name);
metadatas.push(item.meta.metadata);
blobs.push(item.data);
+ comments_enabled_list.push(item.comments_enabled);
+ duplicate_enabled_list.push(item.duplicate_enabled);
});
let mut txn = pg_pool.begin().await?;
@@ -265,14 +269,16 @@ pub async fn insert_or_replace_publish_collabs(
let res = sqlx::query!(
r#"
- INSERT INTO af_published_collab (workspace_id, view_id, publish_name, published_by, metadata, blob)
+ INSERT INTO af_published_collab (workspace_id, view_id, publish_name, published_by, metadata, blob, comments_enabled, duplicate_enabled)
SELECT * FROM UNNEST(
- (SELECT array_agg((SELECT $1::uuid)) FROM generate_series(1, $7))::uuid[],
+ (SELECT array_agg((SELECT $1::uuid)) FROM generate_series(1, $9))::uuid[],
$2::uuid[],
$3::text[],
- (SELECT array_agg((SELECT uid FROM af_user WHERE uuid = $4)) FROM generate_series(1, $7))::bigint[],
+ (SELECT array_agg((SELECT uid FROM af_user WHERE uuid = $4)) FROM generate_series(1, $9))::bigint[],
$5::jsonb[],
- $6::bytea[]
+ $6::bytea[],
+ $7::boolean[],
+ $8::boolean[]
)
ON CONFLICT (workspace_id, view_id) DO UPDATE
SET metadata = EXCLUDED.metadata,
@@ -286,6 +292,8 @@ pub async fn insert_or_replace_publish_collabs(
publisher_uuid,
&metadatas,
&blobs,
+ &comments_enabled_list,
+ &duplicate_enabled_list,
item_count as i32,
)
.execute(txn.as_mut())
@@ -372,33 +380,45 @@ pub async fn update_published_collabs(
.collect();
delete_published_collabs(txn, workspace_id, &publish_names).await?;
}
-
for patch in patches {
- let new_publish_name = match &patch.publish_name {
- Some(new_publish_name) => new_publish_name,
- None => continue,
- };
-
- let res = sqlx::query!(
+ let mut query_builder: QueryBuilder = QueryBuilder::new(
r#"
- UPDATE af_published_collab
- SET publish_name = $1
- WHERE workspace_id = $2
- AND view_id = $3
+ UPDATE af_published_collab SET
"#,
- patch.publish_name,
- workspace_id,
- patch.view_id,
- )
- .execute(txn.as_mut())
- .await?;
+ );
+ let mut first_set = true;
+ if let Some(comments_enabled) = patch.comments_enabled {
+ first_set = false;
+ query_builder.push(" comments_enabled = ");
+ query_builder.push_bind(comments_enabled);
+ }
+ if let Some(duplicate_enabled) = patch.duplicate_enabled {
+ if !first_set {
+ query_builder.push(",");
+ }
+ first_set = false;
+ query_builder.push(" duplicate_enabled = ");
+ query_builder.push_bind(duplicate_enabled);
+ }
+ if let Some(publish_name) = &patch.publish_name {
+ if !first_set {
+ query_builder.push(",");
+ }
+ query_builder.push(" publish_name = ");
+ query_builder.push_bind(publish_name);
+ }
+ query_builder.push(" WHERE workspace_id = ");
+ query_builder.push_bind(workspace_id);
+ query_builder.push(" AND view_id = ");
+ query_builder.push_bind(patch.view_id);
+ let query = query_builder.build();
+ let res = query.execute(txn.as_mut()).await?;
if res.rows_affected() != 1 {
tracing::error!(
- "Failed to update published collab publish name, workspace_id: {}, view_id: {}, new_publish_name: {}, rows_affected: {}",
+ "Failed to update published collab publish name, workspace_id: {}, view_id: {}, rows_affected: {}",
workspace_id,
patch.view_id,
- new_publish_name,
res.rows_affected()
);
}
@@ -695,7 +715,9 @@ pub async fn select_published_view_ids_with_publish_info_for_workspace<
apc.view_id,
apc.publish_name,
au.email AS publisher_email,
- apc.created_at AS publish_timestamp
+ apc.created_at AS publish_timestamp,
+ apc.comments_enabled,
+ apc.duplicate_enabled
FROM af_published_collab apc
JOIN af_user au ON apc.published_by = au.uid
WHERE workspace_id = $1
diff --git a/libs/shared-entity/src/dto/workspace_dto.rs b/libs/shared-entity/src/dto/workspace_dto.rs
index ad75eb17a..d4ece7d19 100644
--- a/libs/shared-entity/src/dto/workspace_dto.rs
+++ b/libs/shared-entity/src/dto/workspace_dto.rs
@@ -285,6 +285,8 @@ pub struct PublishInfoView {
pub struct PublishPageParams {
pub publish_name: Option,
pub visible_database_view_ids: Option>,
+ pub comments_enabled: Option,
+ pub duplicate_enabled: Option,
}
#[derive(Eq, PartialEq, Debug, Hash, Clone, Serialize_repr, Deserialize_repr)]
@@ -401,6 +403,8 @@ pub struct PublishedViewInfo {
pub publisher_email: String,
pub publish_name: String,
pub publish_timestamp: DateTime,
+ pub comments_enabled: bool,
+ pub duplicate_enabled: bool,
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
diff --git a/migrations/20250113091708_publish_options.sql b/migrations/20250113091708_publish_options.sql
new file mode 100644
index 000000000..d2b669919
--- /dev/null
+++ b/migrations/20250113091708_publish_options.sql
@@ -0,0 +1,3 @@
+ALTER TABLE af_published_collab
+ADD COLUMN comments_enabled BOOLEAN NOT NULL DEFAULT TRUE,
+ADD COLUMN duplicate_enabled BOOLEAN NOT NULL DEFAULT TRUE;
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index 201edf88c..65d791693 100644
--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -105,6 +105,18 @@ http {
proxy_pass $appflowy_cloud_backend;
proxy_request_buffering off;
client_max_body_size 256M;
+ if ($request_method = 'OPTIONS') {
+ add_header 'Access-Control-Allow-Origin' $cors_origin always;
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
+ add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version' always;
+ add_header 'Access-Control-Max-Age' 3600 always;
+ return 204;
+ }
+
+ add_header 'Access-Control-Allow-Origin' $cors_origin always;
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, PATCH, OPTIONS' always;
+ add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Accept, Client-Version' always;
+ add_header 'Access-Control-Max-Age' 3600 always;
}
# AppFlowy-Cloud
diff --git a/src/api/workspace.rs b/src/api/workspace.rs
index d5b3dc7c9..a3b2dbdb1 100644
--- a/src/api/workspace.rs
+++ b/src/api/workspace.rs
@@ -1300,6 +1300,8 @@ async fn publish_page_handler(
let PublishPageParams {
publish_name,
visible_database_view_ids,
+ comments_enabled,
+ duplicate_enabled,
} = payload.into_inner();
publish_page(
&state.pg_pool,
@@ -1311,6 +1313,8 @@ async fn publish_page_handler(
&view_id,
visible_database_view_ids,
publish_name,
+ comments_enabled.unwrap_or(true),
+ duplicate_enabled.unwrap_or(true),
)
.await?;
Ok(Json(AppResponse::Ok()))
@@ -1936,6 +1940,9 @@ async fn delete_published_collab_reaction_handler(
Ok(Json(AppResponse::Ok()))
}
+// FIXME: This endpoint currently has a different behaviour from the publish page endpoint,
+// as it doesn't accept parameters. We will need to deprecate this endpoint and use a new
+// one that accepts parameters.
async fn post_publish_collabs_handler(
workspace_id: web::Path,
user_uuid: UserUuid,
@@ -1974,7 +1981,14 @@ async fn post_publish_collabs_handler(
data_buffer
};
- accumulator.push(PublishCollabItem { meta, data });
+ // Set comments_enabled and duplicate_enabled to true by default, as this is the default
+ // behaviour for the older web version.
+ accumulator.push(PublishCollabItem {
+ meta,
+ data,
+ comments_enabled: true,
+ duplicate_enabled: true,
+ });
}
if accumulator.is_empty() {
diff --git a/src/biz/collab/ops.rs b/src/biz/collab/ops.rs
index ce45bc1b8..4e11ce84d 100644
--- a/src/biz/collab/ops.rs
+++ b/src/biz/collab/ops.rs
@@ -471,6 +471,8 @@ pub async fn get_published_view(
publisher_email: pv.publisher_email.clone(),
publish_name: pv.publish_name.clone(),
publish_timestamp: pv.publish_timestamp,
+ comments_enabled: pv.comments_enabled,
+ duplicate_enabled: pv.duplicate_enabled,
},
)
})
diff --git a/src/biz/search/ops.rs b/src/biz/search/ops.rs
index b8438937f..98d62ff53 100644
--- a/src/biz/search/ops.rs
+++ b/src/biz/search/ops.rs
@@ -12,7 +12,6 @@ use collab_folder::{Folder, View};
use database::collab::GetCollabOrigin;
use std::collections::HashSet;
use std::sync::Arc;
-use tracing::info;
use database::index::{search_documents, SearchDocumentParams};
use shared_entity::dto::search_dto::{
@@ -126,7 +125,6 @@ pub async fn search_document(
0,
MAX_SEARCH_DEPTH,
);
- info!("{:?}", searchable_view_ids);
let results = search_documents(
pg_pool,
SearchDocumentParams {
diff --git a/src/biz/workspace/page_view.rs b/src/biz/workspace/page_view.rs
index df72e901e..fb3782375 100644
--- a/src/biz/workspace/page_view.rs
+++ b/src/biz/workspace/page_view.rs
@@ -1076,6 +1076,8 @@ pub async fn publish_page(
view_id: &str,
visible_database_view_ids: Option>,
publish_name: Option,
+ comments_enabled: bool,
+ duplicate_enabled: bool,
) -> Result<(), AppError> {
let folder = get_latest_collab_folder(
collab_access_control_storage,
@@ -1145,6 +1147,8 @@ pub async fn publish_page(
metadata: serde_json::value::to_value(metadata).unwrap(),
},
data: publish_data,
+ comments_enabled,
+ duplicate_enabled,
}],
&workspace_id,
&user_uuid,
diff --git a/tests/workspace/page_view.rs b/tests/workspace/page_view.rs
index c14220f44..5dd0d5116 100644
--- a/tests/workspace/page_view.rs
+++ b/tests/workspace/page_view.rs
@@ -768,6 +768,8 @@ async fn publish_page() {
&PublishPageParams {
publish_name: None,
visible_database_view_ids: None,
+ comments_enabled: None,
+ duplicate_enabled: None,
},
)
.await
diff --git a/tests/workspace/publish.rs b/tests/workspace/publish.rs
index 36489094a..e6cb0fa22 100644
--- a/tests/workspace/publish.rs
+++ b/tests/workspace/publish.rs
@@ -121,12 +121,14 @@ async fn test_publish_doc() {
vec![PublishCollabItem {
meta: PublishCollabMetadata {
view_id: uuid::Uuid::new_v4(),
- publish_name: "(*&^%$#!".to_string(), // invalid chars
+ publish_name: "(*&^%$#!".to_string(),
metadata: MyCustomMetadata {
title: "my_title_1".to_string(),
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -144,12 +146,14 @@ async fn test_publish_doc() {
vec![PublishCollabItem {
meta: PublishCollabMetadata {
view_id: uuid::Uuid::new_v4(),
- publish_name: "a".repeat(1001), // too long
+ publish_name: "a".repeat(1001),
metadata: MyCustomMetadata {
title: "my_title_1".to_string(),
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -175,6 +179,8 @@ async fn test_publish_doc() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
},
PublishCollabItem {
meta: PublishCollabMetadata {
@@ -185,6 +191,8 @@ async fn test_publish_doc() {
},
},
data: "yrs_encoded_data_2".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
},
],
)
@@ -204,6 +212,8 @@ async fn test_publish_doc() {
},
},
data: "some_other_yrs_data".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -278,6 +288,8 @@ async fn test_publish_doc() {
},
},
data: "yrs_encoded_data_3".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
},
PublishCollabItem {
meta: PublishCollabMetadata {
@@ -288,6 +300,8 @@ async fn test_publish_doc() {
},
},
data: "yrs_encoded_data_4".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
},
],
)
@@ -357,8 +371,9 @@ async fn test_publish_doc() {
&workspace_id,
&[PatchPublishedCollab {
view_id: view_id_1,
- // publish_name_2 already exists
publish_name: Some(publish_name_2.to_string()),
+ comments_enabled: None,
+ duplicate_enabled: None,
}],
)
.await
@@ -373,6 +388,8 @@ async fn test_publish_doc() {
&[PatchPublishedCollab {
view_id: view_id_1,
publish_name: Some(new_publish_name_1.to_string()),
+ comments_enabled: None,
+ duplicate_enabled: None,
}],
)
.await
@@ -400,6 +417,8 @@ async fn test_publish_doc() {
&[PatchPublishedCollab {
view_id: view_id_1,
publish_name: Some(publish_name_1.to_string()),
+ comments_enabled: None,
+ duplicate_enabled: None,
}],
)
.await
@@ -474,6 +493,8 @@ async fn test_publish_comments() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -696,6 +717,8 @@ async fn test_excessive_comment_length() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -732,6 +755,8 @@ async fn test_publish_reactions() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -861,7 +886,9 @@ async fn test_publish_load_test() {
title: format!("title_{}", i),
},
},
- data: vec![0; 100_000], // 100 KB
+ data: vec![0; 100_000],
+ comments_enabled: true,
+ duplicate_enabled: true,
})
.collect();
@@ -903,6 +930,8 @@ async fn workspace_member_publish_unpublish() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -951,6 +980,8 @@ async fn duplicate_to_workspace_references() {
published_data::GRID_1_DB_DATA,
),
],
+ true,
+ true,
)
.await;
@@ -1036,6 +1067,8 @@ async fn duplicate_to_workspace_doc_inline_database() {
published_data::VIEW_OF_GRID_1_DB_DATA,
),
],
+ true,
+ true,
)
.await;
@@ -1209,6 +1242,8 @@ async fn duplicate_to_workspace_db_embedded_in_doc() {
published_data::EMBEDDED_DB_HEX,
),
],
+ true,
+ true,
)
.await;
@@ -1301,6 +1336,8 @@ async fn duplicate_to_workspace_db_with_relation() {
published_data::RELATED_DB_HEX,
),
],
+ true,
+ true,
)
.await;
@@ -1313,6 +1350,8 @@ async fn duplicate_to_workspace_db_with_relation() {
published_data::DB_ROW_WITH_DOC_META,
published_data::DB_ROW_WITH_DOC_HEX,
)],
+ true,
+ true,
)
.await;
@@ -1406,6 +1445,8 @@ async fn duplicate_to_workspace_db_row_with_doc() {
published_data::DB_ROW_WITH_DOC_META,
published_data::DB_ROW_WITH_DOC_HEX,
)],
+ true,
+ true,
)
.await;
@@ -1496,6 +1537,8 @@ async fn duplicate_to_workspace_db_rel_self() {
published_data::DB_REL_SELF_META,
published_data::DB_REL_SELF_HEX,
)],
+ true,
+ true,
)
.await;
@@ -1592,6 +1635,8 @@ async fn duplicate_to_workspace_inline_db_doc_with_relation() {
published_data::GRID_2_HEX,
),
],
+ true,
+ true,
)
.await;
@@ -1668,6 +1713,8 @@ async fn test_republish_doc() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -1717,6 +1764,8 @@ async fn test_republish_doc() {
},
},
data: "yrs_encoded_data_2".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -1762,6 +1811,8 @@ async fn test_republish_patch() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -1786,6 +1837,8 @@ async fn test_republish_patch() {
},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
}],
)
.await
@@ -1798,6 +1851,8 @@ async fn test_republish_patch() {
&[PatchPublishedCollab {
view_id: view_id_2,
publish_name: Some(publish_name.to_string()),
+ comments_enabled: None,
+ duplicate_enabled: None,
}],
)
.await
diff --git a/tests/workspace/template.rs b/tests/workspace/template.rs
index 6d6ae663e..c87cb295a 100644
--- a/tests/workspace/template.rs
+++ b/tests/workspace/template.rs
@@ -228,6 +228,8 @@ async fn test_template_crud() {
metadata: TemplateMetadata {},
},
data: "yrs_encoded_data_1".as_bytes(),
+ comments_enabled: true,
+ duplicate_enabled: true,
})
.collect();