From 6e99c007a5abc961647fb82fa9a8798e1151c8bc Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:40:59 +0530 Subject: [PATCH] fix: make issue description null (#183) * fix: make issue description null * fix: put none check during stripping html --- apiserver/plane/db/models/issue.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apiserver/plane/db/models/issue.py b/apiserver/plane/db/models/issue.py index ed72e9b19..f69f11574 100644 --- a/apiserver/plane/db/models/issue.py +++ b/apiserver/plane/db/models/issue.py @@ -32,9 +32,9 @@ class Issue(ProjectBaseModel): related_name="state_issue", ) name = models.CharField(max_length=255, verbose_name="Issue Name") - description = models.JSONField(blank=True) - description_html = models.TextField(blank=True) - description_stripped = models.TextField(blank=True) + description = models.JSONField(blank=True, null=True) + description_html = models.TextField(blank=True, null=True) + description_stripped = models.TextField(blank=True, null=True) priority = models.CharField( max_length=30, choices=PRIORITY_CHOICES, @@ -84,10 +84,12 @@ class Issue(ProjectBaseModel): ) except ImportError: pass - + # Strip the html tags using html parser self.description_stripped = ( - strip_tags(self.description_html) if self.description_html != "" else "" + None + if (self.description_html == "" or self.description_html is None) + else strip_tags(self.description_html) ) super(Issue, self).save(*args, **kwargs) @@ -211,10 +213,11 @@ class IssueComment(ProjectBaseModel): ) def save(self, *args, **kwargs): - self.comment_stripped = strip_tags(self.comment_html) if self.comment_html != "" else "" + self.comment_stripped = ( + strip_tags(self.comment_html) if self.comment_html != "" else "" + ) return super(IssueComment, self).save(*args, **kwargs) - class Meta: verbose_name = "Issue Comment" verbose_name_plural = "Issue Comments"