Skip to content

Commit

Permalink
final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SahilDhillon21 authored and DonnieBLT committed Nov 19, 2023
1 parent aaabfac commit aac5251
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 121 deletions.
3 changes: 0 additions & 3 deletions blt/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@
re_path(
r"^dislike_issue/(?P<issue_pk>\d+)/$", website.views.dislike_issue, name="dislike_issue"
),
re_path(
r"^update_issue_likes_dislikes/(?P<issue_pk>\d+)/$", website.views.update_issue_likes_dislikes, name="like_issue"
),
re_path(
r"^flag_issue/(?P<issue_pk>\d+)/$", website.views.flag_issue, name="flag_issue"
),
Expand Down
37 changes: 0 additions & 37 deletions website/templates/_dislikes.html

This file was deleted.

37 changes: 0 additions & 37 deletions website/templates/_likes.html

This file was deleted.

7 changes: 1 addition & 6 deletions website/templates/_likes_and_dislikes.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<a href="#likedBy" class="btn btn-xs btn-default liked-by" data-toggle="modal">Liked By</a>
{% endif %}

{% if likers %}
<div id="likedBy" class="modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
Expand All @@ -34,9 +33,7 @@ <h3>Liked by:</h3>
</div>
</div>
</div>
{% endif %}

{% load gravatar %}

{% if request.user.is_authenticated %}
<a class="btn btn-info btn-xs dislike_undislike" name="{{ object.pk }}">
Expand All @@ -52,7 +49,6 @@ <h3>Liked by:</h3>
<a href="#dislikedBy" class="btn btn-xs btn-default disliked-by" data-toggle="modal">Disliked By</a>
{% endif %}

{% if dislikers %}
<div id="dislikedBy" class="modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
Expand All @@ -71,5 +67,4 @@ <h3>Disliked by:</h3>
</div>
</div>
</div>
</div>
{% endif %}
</div>
38 changes: 0 additions & 38 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1966,33 +1966,6 @@ def dislike_issue(request, issue_pk):
userprof.issue_downvoted.remove(issue)
else:
userprof.issue_downvoted.add(issue)
liked_user = issue.user
liker_user = request.user
issue_pk = issue.pk
msg_plain = render_to_string(
"email/issue_liked.txt",
{
"liker_user": liker_user.username,
"liked_user": liked_user.username,
"issue_pk": issue_pk,
},
)
msg_html = render_to_string(
"email/issue_liked.txt",
{
"liker_user": liker_user.username,
"liked_user": liked_user.username,
"issue_pk": issue_pk,
},
)

send_mail(
"Your issue got an upvote!!",
msg_plain,
settings.EMAIL_TO_STRING,
[liked_user.email],
html_message=msg_html,
)

userprof.save()
total_downvotes = UserProfile.objects.filter(issue_downvoted=issue).count()
Expand All @@ -2005,17 +1978,6 @@ def dislike_issue(request, issue_pk):
return render(request, "_likes_and_dislikes.html", context)


def update_issue_likes_dislikes(request,issue_pk):
context = {}
issue_pk = int(issue_pk)
issue = Issue.objects.get(pk=issue_pk)
context["likes"] = UserProfile.objects.filter(issue_upvoted=issue).count()
context["likers"] = UserProfile.objects.filter(issue_upvoted=issue)
context["dislikes"] = UserProfile.objects.filter(issue_downvoted=issue).count()
context["dislikers"] = UserProfile.objects.filter(issue_downvoted=issue)

return context

@login_required(login_url="/accounts/login")
def save_issue(request, issue_pk):
issue_pk = int(issue_pk)
Expand Down

0 comments on commit aac5251

Please sign in to comment.