mirror of
https://github.com/makeplane/plane.git
synced 2025-12-16 20:07:56 +01:00
chore: migrating description to description json
This commit is contained in:
@@ -17,7 +17,7 @@ class IssueForIntakeSerializer(BaseSerializer):
|
|||||||
model = Issue
|
model = Issue
|
||||||
fields = [
|
fields = [
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description_json",
|
||||||
"description_html",
|
"description_html",
|
||||||
"priority",
|
"priority",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class IssueSerializer(BaseSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Issue
|
model = Issue
|
||||||
read_only_fields = ["id", "workspace", "project", "updated_by", "updated_at"]
|
read_only_fields = ["id", "workspace", "project", "updated_by", "updated_at"]
|
||||||
exclude = ["description", "description_stripped"]
|
exclude = ["description_json", "description_stripped"]
|
||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class IntakeIssueListCreateAPIEndpoint(BaseAPIView):
|
|||||||
# create an issue
|
# create an issue
|
||||||
issue = Issue.objects.create(
|
issue = Issue.objects.create(
|
||||||
name=request.data.get("issue", {}).get("name"),
|
name=request.data.get("issue", {}).get("name"),
|
||||||
description=request.data.get("issue", {}).get("description", {}),
|
description_json=request.data.get("issue", {}).get("description_json", {}),
|
||||||
description_html=request.data.get("issue", {}).get("description_html", "<p></p>"),
|
description_html=request.data.get("issue", {}).get("description_html", "<p></p>"),
|
||||||
priority=request.data.get("issue", {}).get("priority", "none"),
|
priority=request.data.get("issue", {}).get("priority", "none"),
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
@@ -368,7 +368,7 @@ class IntakeIssueDetailAPIEndpoint(BaseAPIView):
|
|||||||
issue_data = {
|
issue_data = {
|
||||||
"name": issue_data.get("name", issue.name),
|
"name": issue_data.get("name", issue.name),
|
||||||
"description_html": issue_data.get("description_html", issue.description_html),
|
"description_html": issue_data.get("description_html", issue.description_html),
|
||||||
"description": issue_data.get("description", issue.description),
|
"description_json": issue_data.get("description_json", issue.description_json),
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_serializer = IssueSerializer(issue, data=issue_data, partial=True)
|
issue_serializer = IssueSerializer(issue, data=issue_data, partial=True)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class IssueFlatSerializer(BaseSerializer):
|
|||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description_json",
|
||||||
"description_html",
|
"description_html",
|
||||||
"priority",
|
"priority",
|
||||||
"start_date",
|
"start_date",
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class PageSerializer(BaseSerializer):
|
|||||||
labels = validated_data.pop("labels", None)
|
labels = validated_data.pop("labels", None)
|
||||||
project_id = self.context["project_id"]
|
project_id = self.context["project_id"]
|
||||||
owned_by_id = self.context["owned_by_id"]
|
owned_by_id = self.context["owned_by_id"]
|
||||||
description = self.context["description"]
|
description_json = self.context["description_json"]
|
||||||
description_binary = self.context["description_binary"]
|
description_binary = self.context["description_binary"]
|
||||||
description_html = self.context["description_html"]
|
description_html = self.context["description_html"]
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ class PageSerializer(BaseSerializer):
|
|||||||
# Create the page
|
# Create the page
|
||||||
page = Page.objects.create(
|
page = Page.objects.create(
|
||||||
**validated_data,
|
**validated_data,
|
||||||
description=description,
|
description_json=description_json,
|
||||||
description_binary=description_binary,
|
description_binary=description_binary,
|
||||||
description_html=description_html,
|
description_html=description_html,
|
||||||
owned_by_id=owned_by_id,
|
owned_by_id=owned_by_id,
|
||||||
@@ -171,7 +171,7 @@ class PageBinaryUpdateSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
description_binary = serializers.CharField(required=False, allow_blank=True)
|
description_binary = serializers.CharField(required=False, allow_blank=True)
|
||||||
description_html = serializers.CharField(required=False, allow_blank=True)
|
description_html = serializers.CharField(required=False, allow_blank=True)
|
||||||
description = serializers.JSONField(required=False, allow_null=True)
|
description_json = serializers.JSONField(required=False, allow_null=True)
|
||||||
|
|
||||||
def validate_description_binary(self, value):
|
def validate_description_binary(self, value):
|
||||||
"""Validate the base64-encoded binary data"""
|
"""Validate the base64-encoded binary data"""
|
||||||
@@ -214,8 +214,8 @@ class PageBinaryUpdateSerializer(serializers.Serializer):
|
|||||||
if "description_html" in validated_data:
|
if "description_html" in validated_data:
|
||||||
instance.description_html = validated_data.get("description_html")
|
instance.description_html = validated_data.get("description_html")
|
||||||
|
|
||||||
if "description" in validated_data:
|
if "description_json" in validated_data:
|
||||||
instance.description = validated_data.get("description")
|
instance.description_json = validated_data.get("description_json")
|
||||||
|
|
||||||
instance.save()
|
instance.save()
|
||||||
return instance
|
return instance
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ class IntakeIssueViewSet(BaseViewSet):
|
|||||||
issue_data = {
|
issue_data = {
|
||||||
"name": issue_data.get("name", issue.name),
|
"name": issue_data.get("name", issue.name),
|
||||||
"description_html": issue_data.get("description_html", issue.description_html),
|
"description_html": issue_data.get("description_html", issue.description_html),
|
||||||
"description": issue_data.get("description", issue.description),
|
"description_json": issue_data.get("description_json", issue.description_json),
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_current_instance = json.dumps(IssueDetailSerializer(issue).data, cls=DjangoJSONEncoder)
|
issue_current_instance = json.dumps(IssueDetailSerializer(issue).data, cls=DjangoJSONEncoder)
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class PageViewSet(BaseViewSet):
|
|||||||
context={
|
context={
|
||||||
"project_id": project_id,
|
"project_id": project_id,
|
||||||
"owned_by_id": request.user.id,
|
"owned_by_id": request.user.id,
|
||||||
"description": request.data.get("description", {}),
|
"description_json": request.data.get("description_json", {}),
|
||||||
"description_binary": request.data.get("description_binary", None),
|
"description_binary": request.data.get("description_binary", None),
|
||||||
"description_html": request.data.get("description_html", "<p></p>"),
|
"description_html": request.data.get("description_html", "<p></p>"),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ def copy_s3_objects_of_description_and_assets(entity_name, entity_identifier, pr
|
|||||||
external_data = sync_with_external_service(entity_name, updated_html)
|
external_data = sync_with_external_service(entity_name, updated_html)
|
||||||
|
|
||||||
if external_data:
|
if external_data:
|
||||||
entity.description = external_data.get("description")
|
entity.description_json = external_data.get("description_json")
|
||||||
entity.description_binary = base64.b64decode(external_data.get("description_binary"))
|
entity.description_binary = base64.b64decode(external_data.get("description_binary"))
|
||||||
entity.save()
|
entity.save()
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def sync_issue_description_version(batch_size=5000, offset=0, countdown=300):
|
|||||||
"description_binary",
|
"description_binary",
|
||||||
"description_html",
|
"description_html",
|
||||||
"description_stripped",
|
"description_stripped",
|
||||||
"description",
|
"description_json",
|
||||||
)[offset:end_offset]
|
)[offset:end_offset]
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ def sync_issue_description_version(batch_size=5000, offset=0, countdown=300):
|
|||||||
description_binary=issue.description_binary,
|
description_binary=issue.description_binary,
|
||||||
description_html=issue.description_html,
|
description_html=issue.description_html,
|
||||||
description_stripped=issue.description_stripped,
|
description_stripped=issue.description_stripped,
|
||||||
description_json=issue.description,
|
description_json=issue.description_json,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ def should_update_existing_version(
|
|||||||
|
|
||||||
|
|
||||||
def update_existing_version(version: IssueDescriptionVersion, issue) -> None:
|
def update_existing_version(version: IssueDescriptionVersion, issue) -> None:
|
||||||
version.description_json = issue.description
|
version.description_json = issue.description_json
|
||||||
version.description_html = issue.description_html
|
version.description_html = issue.description_html
|
||||||
version.description_binary = issue.description_binary
|
version.description_binary = issue.description_binary
|
||||||
version.description_stripped = issue.description_stripped
|
version.description_stripped = issue.description_stripped
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ def page_version(page_id, existing_instance, user_id):
|
|||||||
description_binary=page.description_binary,
|
description_binary=page.description_binary,
|
||||||
owned_by_id=user_id,
|
owned_by_id=user_id,
|
||||||
last_saved_at=page.updated_at,
|
last_saved_at=page.updated_at,
|
||||||
description_json=page.description,
|
description_json=page.description_json,
|
||||||
description_stripped=page.description_stripped,
|
description_stripped=page.description_stripped,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ def create_pages(workspace: Workspace, project_map: Dict[int, uuid.UUID]) -> Non
|
|||||||
is_global=False,
|
is_global=False,
|
||||||
access=page_seed.get("access", Page.PUBLIC_ACCESS),
|
access=page_seed.get("access", Page.PUBLIC_ACCESS),
|
||||||
name=page_seed.get("name"),
|
name=page_seed.get("name"),
|
||||||
description=page_seed.get("description", {}),
|
description_json=page_seed.get("description_json", {}),
|
||||||
description_html=page_seed.get("description_html", "<p></p>"),
|
description_html=page_seed.get("description_html", "<p></p>"),
|
||||||
description_binary=page_seed.get("description_binary", None),
|
description_binary=page_seed.get("description_binary", None),
|
||||||
description_stripped=page_seed.get("description_stripped", None),
|
description_stripped=page_seed.get("description_stripped", None),
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 4.2.25 on 2025-12-02 08:50
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('db', '0112_auto_20251124_0603'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='issue',
|
||||||
|
old_name='description',
|
||||||
|
new_name='description_json',
|
||||||
|
),
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='page',
|
||||||
|
old_name='description',
|
||||||
|
new_name='description_json',
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -39,7 +39,7 @@ class DraftIssue(WorkspaceBaseModel):
|
|||||||
blank=True,
|
blank=True,
|
||||||
)
|
)
|
||||||
name = models.CharField(max_length=255, verbose_name="Issue Name", blank=True, null=True)
|
name = models.CharField(max_length=255, verbose_name="Issue Name", blank=True, null=True)
|
||||||
description = models.JSONField(blank=True, default=dict)
|
description_json = models.JSONField(blank=True, default=dict)
|
||||||
description_html = models.TextField(blank=True, default="<p></p>")
|
description_html = models.TextField(blank=True, default="<p></p>")
|
||||||
description_stripped = models.TextField(blank=True, null=True)
|
description_stripped = models.TextField(blank=True, null=True)
|
||||||
description_binary = models.BinaryField(null=True)
|
description_binary = models.BinaryField(null=True)
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class Issue(ProjectBaseModel):
|
|||||||
blank=True,
|
blank=True,
|
||||||
)
|
)
|
||||||
name = models.CharField(max_length=255, verbose_name="Issue Name")
|
name = models.CharField(max_length=255, verbose_name="Issue Name")
|
||||||
description = models.JSONField(blank=True, default=dict)
|
description_json = models.JSONField(blank=True, default=dict)
|
||||||
description_html = models.TextField(blank=True, default="<p></p>")
|
description_html = models.TextField(blank=True, default="<p></p>")
|
||||||
description_stripped = models.TextField(blank=True, null=True)
|
description_stripped = models.TextField(blank=True, null=True)
|
||||||
description_binary = models.BinaryField(null=True)
|
description_binary = models.BinaryField(null=True)
|
||||||
@@ -840,7 +840,7 @@ class IssueDescriptionVersion(ProjectBaseModel):
|
|||||||
description_binary=issue.description_binary,
|
description_binary=issue.description_binary,
|
||||||
description_html=issue.description_html,
|
description_html=issue.description_html,
|
||||||
description_stripped=issue.description_stripped,
|
description_stripped=issue.description_stripped,
|
||||||
description_json=issue.description,
|
description_json=issue.description_json,
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Page(BaseModel):
|
|||||||
|
|
||||||
workspace = models.ForeignKey("db.Workspace", on_delete=models.CASCADE, related_name="pages")
|
workspace = models.ForeignKey("db.Workspace", on_delete=models.CASCADE, related_name="pages")
|
||||||
name = models.TextField(blank=True)
|
name = models.TextField(blank=True)
|
||||||
description = models.JSONField(default=dict, blank=True)
|
description_json = models.JSONField(default=dict, blank=True)
|
||||||
description_binary = models.BinaryField(null=True)
|
description_binary = models.BinaryField(null=True)
|
||||||
description_html = models.TextField(blank=True, default="<p></p>")
|
description_html = models.TextField(blank=True, default="<p></p>")
|
||||||
description_stripped = models.TextField(blank=True, null=True)
|
description_stripped = models.TextField(blank=True, null=True)
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class IssueFlatSerializer(BaseSerializer):
|
|||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
"name",
|
"name",
|
||||||
"description",
|
"description_json",
|
||||||
"description_html",
|
"description_html",
|
||||||
"priority",
|
"priority",
|
||||||
"start_date",
|
"start_date",
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class IntakeIssuePublicViewSet(BaseViewSet):
|
|||||||
# create an issue
|
# create an issue
|
||||||
issue = Issue.objects.create(
|
issue = Issue.objects.create(
|
||||||
name=request.data.get("issue", {}).get("name"),
|
name=request.data.get("issue", {}).get("name"),
|
||||||
description=request.data.get("issue", {}).get("description", {}),
|
description_json=request.data.get("issue", {}).get("description_json", {}),
|
||||||
description_html=request.data.get("issue", {}).get("description_html", "<p></p>"),
|
description_html=request.data.get("issue", {}).get("description_html", "<p></p>"),
|
||||||
priority=request.data.get("issue", {}).get("priority", "low"),
|
priority=request.data.get("issue", {}).get("priority", "low"),
|
||||||
project_id=project_deploy_board.project_id,
|
project_id=project_deploy_board.project_id,
|
||||||
@@ -201,7 +201,7 @@ class IntakeIssuePublicViewSet(BaseViewSet):
|
|||||||
issue_data = {
|
issue_data = {
|
||||||
"name": issue_data.get("name", issue.name),
|
"name": issue_data.get("name", issue.name),
|
||||||
"description_html": issue_data.get("description_html", issue.description_html),
|
"description_html": issue_data.get("description_html", issue.description_html),
|
||||||
"description": issue_data.get("description", issue.description),
|
"description_json": issue_data.get("description_json", issue.description_json),
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_serializer = IssueCreateSerializer(
|
issue_serializer = IssueCreateSerializer(
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ class IssueRetrievePublicEndpoint(BaseAPIView):
|
|||||||
"name",
|
"name",
|
||||||
"state_id",
|
"state_id",
|
||||||
"sort_order",
|
"sort_order",
|
||||||
"description",
|
"description_json",
|
||||||
"description_html",
|
"description_html",
|
||||||
"description_stripped",
|
"description_stripped",
|
||||||
"description_binary",
|
"description_binary",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const usePageFallback = (args: TArgs) => {
|
|||||||
await updatePageDescription({
|
await updatePageDescription({
|
||||||
description_binary: encodedBinary,
|
description_binary: encodedBinary,
|
||||||
description_html: html,
|
description_html: html,
|
||||||
description: json,
|
description_json: json,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error in updating description using fallback logic:", error);
|
console.error("Error in updating description using fallback logic:", error);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export class BasePage extends ExtendedBasePage implements TBasePage {
|
|||||||
id: string | undefined;
|
id: string | undefined;
|
||||||
name: string | undefined;
|
name: string | undefined;
|
||||||
logo_props: TLogoProps | undefined;
|
logo_props: TLogoProps | undefined;
|
||||||
description: object | undefined;
|
description_json: object | undefined;
|
||||||
description_html: string | undefined;
|
description_html: string | undefined;
|
||||||
color: string | undefined;
|
color: string | undefined;
|
||||||
label_ids: string[] | undefined;
|
label_ids: string[] | undefined;
|
||||||
@@ -114,7 +114,7 @@ export class BasePage extends ExtendedBasePage implements TBasePage {
|
|||||||
this.id = page?.id || undefined;
|
this.id = page?.id || undefined;
|
||||||
this.name = page?.name;
|
this.name = page?.name;
|
||||||
this.logo_props = page?.logo_props || undefined;
|
this.logo_props = page?.logo_props || undefined;
|
||||||
this.description = page?.description || undefined;
|
this.description_json = page?.description_json || undefined;
|
||||||
this.description_html = page?.description_html || undefined;
|
this.description_html = page?.description_html || undefined;
|
||||||
this.color = page?.color || undefined;
|
this.color = page?.color || undefined;
|
||||||
this.label_ids = page?.label_ids || undefined;
|
this.label_ids = page?.label_ids || undefined;
|
||||||
@@ -139,7 +139,7 @@ export class BasePage extends ExtendedBasePage implements TBasePage {
|
|||||||
id: observable.ref,
|
id: observable.ref,
|
||||||
name: observable.ref,
|
name: observable.ref,
|
||||||
logo_props: observable.ref,
|
logo_props: observable.ref,
|
||||||
description: observable,
|
description_json: observable.ref,
|
||||||
description_html: observable.ref,
|
description_html: observable.ref,
|
||||||
color: observable.ref,
|
color: observable.ref,
|
||||||
label_ids: observable,
|
label_ids: observable,
|
||||||
@@ -213,7 +213,7 @@ export class BasePage extends ExtendedBasePage implements TBasePage {
|
|||||||
return {
|
return {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
description: this.description,
|
description_json: this.description_json,
|
||||||
description_html: this.description_html,
|
description_html: this.description_html,
|
||||||
color: this.color,
|
color: this.color,
|
||||||
label_ids: this.label_ids,
|
label_ids: this.label_ids,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export function PageRenderer(props: Props) {
|
|||||||
"wide-layout": displayConfig.wideLayout,
|
"wide-layout": displayConfig.wideLayout,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{isLoading ? (
|
{false ? (
|
||||||
<DocumentContentLoader className={documentLoaderClassName} />
|
<DocumentContentLoader className={documentLoaderClassName} />
|
||||||
) : (
|
) : (
|
||||||
<EditorContainer
|
<EditorContainer
|
||||||
|
|||||||
Reference in New Issue
Block a user