forked from github/plane
Merge branch 'develop' of github.com:makeplane/plane into feat/issue_relation
This commit is contained in:
commit
c059724bff
@ -601,7 +601,7 @@ class IssueLiteSerializer(BaseSerializer):
|
|||||||
class IssuePublicSerializer(BaseSerializer):
|
class IssuePublicSerializer(BaseSerializer):
|
||||||
project_detail = ProjectLiteSerializer(read_only=True, source="project")
|
project_detail = ProjectLiteSerializer(read_only=True, source="project")
|
||||||
state_detail = StateLiteSerializer(read_only=True, source="state")
|
state_detail = StateLiteSerializer(read_only=True, source="state")
|
||||||
issue_reactions = IssueReactionLiteSerializer(read_only=True, many=True)
|
reactions = IssueReactionLiteSerializer(read_only=True, many=True, source="issue_reactions")
|
||||||
votes = IssueVoteSerializer(read_only=True, many=True)
|
votes = IssueVoteSerializer(read_only=True, many=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -618,12 +618,13 @@ class IssuePublicSerializer(BaseSerializer):
|
|||||||
"workspace",
|
"workspace",
|
||||||
"priority",
|
"priority",
|
||||||
"target_date",
|
"target_date",
|
||||||
"issue_reactions",
|
"reactions",
|
||||||
"votes",
|
"votes",
|
||||||
]
|
]
|
||||||
read_only_fields = fields
|
read_only_fields = fields
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class IssueSubscriberSerializer(BaseSerializer):
|
class IssueSubscriberSerializer(BaseSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IssueSubscriber
|
model = IssueSubscriber
|
||||||
|
@ -29,7 +29,7 @@ from django.db import IntegrityError
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.parsers import MultiPartParser, FormParser
|
from rest_framework.parsers import MultiPartParser, FormParser
|
||||||
from rest_framework.permissions import AllowAny
|
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||||
from sentry_sdk import capture_exception
|
from sentry_sdk import capture_exception
|
||||||
|
|
||||||
# Module imports
|
# Module imports
|
||||||
@ -1507,7 +1507,7 @@ class CommentReactionViewSet(BaseViewSet):
|
|||||||
{
|
{
|
||||||
"reaction": str(reaction_code),
|
"reaction": str(reaction_code),
|
||||||
"identifier": str(comment_reaction.id),
|
"identifier": str(comment_reaction.id),
|
||||||
"comment_id": str(comment_id)
|
"comment_id": str(comment_id),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -1535,6 +1535,18 @@ class IssueCommentPublicViewSet(BaseViewSet):
|
|||||||
"workspace__id",
|
"workspace__id",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def get_permissions(self):
|
||||||
|
if self.action in ["list", "retrieve"]:
|
||||||
|
self.permission_classes = [
|
||||||
|
AllowAny,
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
self.permission_classes = [
|
||||||
|
IsAuthenticated,
|
||||||
|
]
|
||||||
|
|
||||||
|
return super(IssueCommentPublicViewSet, self).get_permissions()
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
project_deploy_board = ProjectDeployBoard.objects.get(
|
project_deploy_board = ProjectDeployBoard.objects.get(
|
||||||
workspace__slug=self.kwargs.get("slug"),
|
workspace__slug=self.kwargs.get("slug"),
|
||||||
@ -1906,7 +1918,7 @@ class CommentReactionPublicViewSet(BaseViewSet):
|
|||||||
{
|
{
|
||||||
"reaction": str(reaction_code),
|
"reaction": str(reaction_code),
|
||||||
"identifier": str(comment_reaction.id),
|
"identifier": str(comment_reaction.id),
|
||||||
"comment_id": str(comment_id)
|
"comment_id": str(comment_id),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -1956,13 +1968,13 @@ class IssueVotePublicViewSet(BaseViewSet):
|
|||||||
issue_vote.vote = request.data.get("vote", 1)
|
issue_vote.vote = request.data.get("vote", 1)
|
||||||
issue_vote.save()
|
issue_vote.save()
|
||||||
issue_activity.delay(
|
issue_activity.delay(
|
||||||
type="issue_vote.activity.created",
|
type="issue_vote.activity.created",
|
||||||
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
requested_data=json.dumps(self.request.data, cls=DjangoJSONEncoder),
|
||||||
actor_id=str(self.request.user.id),
|
actor_id=str(self.request.user.id),
|
||||||
issue_id=str(self.kwargs.get("issue_id", None)),
|
issue_id=str(self.kwargs.get("issue_id", None)),
|
||||||
project_id=str(self.kwargs.get("project_id", None)),
|
project_id=str(self.kwargs.get("project_id", None)),
|
||||||
current_instance=None,
|
current_instance=None,
|
||||||
)
|
)
|
||||||
serializer = IssueVoteSerializer(issue_vote)
|
serializer = IssueVoteSerializer(issue_vote)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -2265,4 +2277,3 @@ class ProjectIssuesPublicEndpoint(BaseAPIView):
|
|||||||
{"error": "Something went wrong please try again later"},
|
{"error": "Something went wrong please try again later"},
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ class IssueComment(ProjectBaseModel):
|
|||||||
comment_json = models.JSONField(blank=True, default=dict)
|
comment_json = models.JSONField(blank=True, default=dict)
|
||||||
comment_html = models.TextField(blank=True, default="<p></p>")
|
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, related_name="issue_comments")
|
||||||
# System can also create comment
|
# System can also create comment
|
||||||
actor = models.ForeignKey(
|
actor = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL,
|
settings.AUTH_USER_MODEL,
|
||||||
|
Loading…
Reference in New Issue
Block a user