diff --git a/apiserver/plane/app/serializers/page.py b/apiserver/plane/app/serializers/page.py index 73680cdfd..e4df342e9 100644 --- a/apiserver/plane/app/serializers/page.py +++ b/apiserver/plane/app/serializers/page.py @@ -105,12 +105,10 @@ class PageSerializer(BaseSerializer): class PageDetailSerializer(PageSerializer): description_html = serializers.CharField() - description_yjs = serializers.CharField() class Meta(PageSerializer.Meta): fields = PageSerializer.Meta.fields + [ "description_html", - "description_yjs", ] diff --git a/apiserver/plane/app/views/page/base.py b/apiserver/plane/app/views/page/base.py index 23a5b8838..82441d35c 100644 --- a/apiserver/plane/app/views/page/base.py +++ b/apiserver/plane/app/views/page/base.py @@ -398,7 +398,7 @@ class PagesDescriptionViewSet(BaseViewSet): page = Page.objects.get( pk=pk, workspace__slug=slug, project_id=project_id ) - binary_data = page.description_yjs + binary_data = page.description_binary def stream_data(): if binary_data: @@ -419,7 +419,7 @@ class PagesDescriptionViewSet(BaseViewSet): pk=pk, workspace__slug=slug, project_id=project_id ) - base64_data = request.data.get("description_yjs") + base64_data = request.data.get("description_binary") if base64_data: # Decode the base64 data to bytes @@ -427,8 +427,8 @@ class PagesDescriptionViewSet(BaseViewSet): # Load the existing data into a YDoc existing_doc = Y.YDoc() - if page.description_yjs: - Y.apply_update(existing_doc, page.description_yjs) + if page.description_binary: + Y.apply_update(existing_doc, page.description_binary) # # Load the new data into a separate YDoc # new_doc = Y.YDoc() @@ -444,7 +444,7 @@ class PagesDescriptionViewSet(BaseViewSet): updated_binary_data = Y.encode_state_as_update(existing_doc) # Store the updated binary data - page.description_yjs = updated_binary_data + page.description_binary = updated_binary_data page.description_html = request.data.get("description_html") page.save() return Response({"message": "Updated successfully"}) diff --git a/apiserver/plane/db/migrations/0065_page_description_yjs.py b/apiserver/plane/db/migrations/0066_page_description_binary.py similarity index 66% rename from apiserver/plane/db/migrations/0065_page_description_yjs.py rename to apiserver/plane/db/migrations/0066_page_description_binary.py index 095a2541d..33d0728c7 100644 --- a/apiserver/plane/db/migrations/0065_page_description_yjs.py +++ b/apiserver/plane/db/migrations/0066_page_description_binary.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.11 on 2024-05-08 09:23 +# Generated by Django 4.2.11 on 2024-05-15 11:21 from django.db import migrations, models @@ -6,13 +6,13 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('db', '0064_auto_20240409_1134'), + ('db', '0065_auto_20240415_0937'), ] operations = [ migrations.AddField( model_name='page', - name='description_yjs', + name='description_binary', field=models.BinaryField(null=True), ), ] diff --git a/apiserver/plane/db/models/page.py b/apiserver/plane/db/models/page.py index 6bbdcbce6..f24f67817 100644 --- a/apiserver/plane/db/models/page.py +++ b/apiserver/plane/db/models/page.py @@ -18,7 +18,7 @@ def get_view_props(): class Page(ProjectBaseModel): name = models.CharField(max_length=255) description = models.JSONField(default=dict, blank=True) - description_yjs = models.BinaryField(null=True) + description_binary = models.BinaryField(null=True) description_html = models.TextField(blank=True, default="

") description_stripped = models.TextField(blank=True, null=True) owned_by = models.ForeignKey(