Skip to content

Commit

Permalink
chages
Browse files Browse the repository at this point in the history
  • Loading branch information
krrish-sehgal committed Jan 4, 2025
1 parent 516f829 commit b702b73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion website/templates/sitemap.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h2 class="text-6xl text-black font-bold">Sitemap</h2>
</li>
<li class="flex items-center space-x-3 text-black hover:text-red-600 hover:translate-x-1 transition duration-200 cursor-pointer">
<i class="fas fa-sync-alt w-5 h-5 mr-1 align-middle"></i>
<a href="{% url 'update_comment' 1 1 %}">Update Comment // 1</a>
<a href="{% url 'update_content_comment' 1 1 %}">Update Comment // 1</a>
</li>
<li class="flex items-center space-x-3 text-black hover:text-red-600 hover:translate-x-1 transition duration-200 cursor-pointer">
<i class="fas fa-trash-alt w-5 h-5 mr-1 align-middle"></i>
Expand Down
5 changes: 5 additions & 0 deletions website/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@ def comment_on_content(request, content_pk):
content_type = request.POST.get("content_type")
content_type_obj = ContentType.objects.get(model=content_type)
content = content_type_obj.get_object_for_this_type(pk=content_pk)
VALID_CONTENT_TYPES = ["issue", "post"]

if request.method == "POST" and isinstance(request.user, User):
comment = escape(request.POST.get("comment", ""))
Expand All @@ -1515,6 +1516,10 @@ def comment_on_content(request, content_pk):

parent_comment = Comment.objects.filter(pk=replying_to_comment_id).first()

if content_type not in VALID_CONTENT_TYPES:
messages.error(request, "Invalid content type.")
return redirect("home")

if parent_comment is None:
messages.error(request, "Parent comment doesn't exist.")
return redirect(f"/{content_type}/{content_pk}")
Expand Down

0 comments on commit b702b73

Please sign in to comment.