fix: update remirror description to save empty string and empty paragraph (#237)

This commit is contained in:
pablohashescobar 2023-02-07 01:19:42 +05:30 committed by GitHub
parent aaaf75c5da
commit b93abb4b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ from django.dispatch import receiver
from . import ProjectBaseModel from . import ProjectBaseModel
from plane.utils.html_processor import strip_tags from plane.utils.html_processor import strip_tags
# TODO: Handle identifiers for Bulk Inserts - nk # TODO: Handle identifiers for Bulk Inserts - nk
class Issue(ProjectBaseModel): class Issue(ProjectBaseModel):
PRIORITY_CHOICES = ( PRIORITY_CHOICES = (
@ -32,8 +33,8 @@ class Issue(ProjectBaseModel):
related_name="state_issue", related_name="state_issue",
) )
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, null=True) description = models.JSONField(blank=True, default="")
description_html = models.TextField(blank=True, null=True) 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)
priority = models.CharField( priority = models.CharField(
max_length=30, max_length=30,
@ -196,8 +197,8 @@ class TimelineIssue(ProjectBaseModel):
class IssueComment(ProjectBaseModel): class IssueComment(ProjectBaseModel):
comment_stripped = models.TextField(verbose_name="Comment", blank=True) comment_stripped = models.TextField(verbose_name="Comment", blank=True)
comment_json = models.JSONField(blank=True, null=True) comment_json = models.JSONField(blank=True, default="")
comment_html = models.TextField(blank=True) comment_html = models.TextField(blank=True, default="<p></p>")
attachments = ArrayField(models.URLField(), size=10, blank=True, default=list) attachments = ArrayField(models.URLField(), size=10, blank=True, default=list)
issue = models.ForeignKey(Issue, on_delete=models.CASCADE) issue = models.ForeignKey(Issue, on_delete=models.CASCADE)
# System can also create comment # System can also create comment
@ -246,7 +247,6 @@ class IssueProperty(ProjectBaseModel):
class Label(ProjectBaseModel): class Label(ProjectBaseModel):
parent = models.ForeignKey( parent = models.ForeignKey(
"self", "self",
on_delete=models.CASCADE, on_delete=models.CASCADE,
@ -269,7 +269,6 @@ class Label(ProjectBaseModel):
class IssueLabel(ProjectBaseModel): class IssueLabel(ProjectBaseModel):
issue = models.ForeignKey( issue = models.ForeignKey(
"db.Issue", on_delete=models.CASCADE, related_name="label_issue" "db.Issue", on_delete=models.CASCADE, related_name="label_issue"
) )
@ -288,7 +287,6 @@ class IssueLabel(ProjectBaseModel):
class IssueSequence(ProjectBaseModel): class IssueSequence(ProjectBaseModel):
issue = models.ForeignKey( issue = models.ForeignKey(
Issue, on_delete=models.SET_NULL, related_name="issue_sequence", null=True Issue, on_delete=models.SET_NULL, related_name="issue_sequence", null=True
) )
@ -305,7 +303,6 @@ class IssueSequence(ProjectBaseModel):
# TODO: Find a better method to save the model # TODO: Find a better method to save the model
@receiver(post_save, sender=Issue) @receiver(post_save, sender=Issue)
def create_issue_sequence(sender, instance, created, **kwargs): def create_issue_sequence(sender, instance, created, **kwargs):
if created: if created:
IssueSequence.objects.create( IssueSequence.objects.create(
issue=instance, sequence=instance.sequence_id, project=instance.project issue=instance, sequence=instance.sequence_id, project=instance.project