[WEB-1435] dev: conflict free issue descriptions (#5912)
* chore: new description binary endpoints * chore: conflict free issue description * chore: fix submitting status * chore: update yjs utils * chore: handle component re-mounting * chore: update buffer response type * chore: add try catch for issue description update * chore: update buffer response type * chore: description binary in retrieve * chore: update issue description hook * chore: decode description binary * chore: migrations fixes and cleanup * chore: migration fixes * fix: inbox issue description * chore: move update operations to the issue store * fix: merge conflicts * chore: reverted the commit * chore: removed the unwanted imports * chore: remove unnecessary props * chore: remove unused services * chore: update live server error handling --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
parent
229610513a
commit
e9680cab74
65 changed files with 1466 additions and 358 deletions
|
|
@ -1,3 +1,6 @@
|
|||
# Python imports
|
||||
import base64
|
||||
|
||||
# Django imports
|
||||
from django.utils import timezone
|
||||
from django.core.validators import URLValidator
|
||||
|
|
@ -732,14 +735,31 @@ class IssueLiteSerializer(DynamicBaseSerializer):
|
|||
read_only_fields = fields
|
||||
|
||||
|
||||
class Base64BinaryField(serializers.CharField):
|
||||
def to_representation(self, value):
|
||||
# Encode the binary data to base64 string for JSON response
|
||||
if value:
|
||||
return base64.b64encode(value).decode("utf-8")
|
||||
return None
|
||||
|
||||
def to_internal_value(self, data):
|
||||
# Decode the base64 string to binary data when saving
|
||||
try:
|
||||
return base64.b64decode(data)
|
||||
except (TypeError, ValueError):
|
||||
raise serializers.ValidationError("Invalid base64-encoded data")
|
||||
|
||||
|
||||
class IssueDetailSerializer(IssueSerializer):
|
||||
description_html = serializers.CharField()
|
||||
description_binary = Base64BinaryField()
|
||||
is_subscribed = serializers.BooleanField(read_only=True)
|
||||
|
||||
class Meta(IssueSerializer.Meta):
|
||||
fields = IssueSerializer.Meta.fields + [
|
||||
"description_html",
|
||||
"is_subscribed",
|
||||
"description_binary",
|
||||
]
|
||||
read_only_fields = fields
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue