Skip to content

Commit

Permalink
Merge branch 'main' into activity-feed
Browse files Browse the repository at this point in the history
  • Loading branch information
krrish-sehgal authored Nov 23, 2024
2 parents 4b657bc + 84fb69d commit da827d1
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 24 deletions.
20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ beautifulsoup4 = "^4.12.3"
colorthief = "^0.2.1"
django-email-obfuscator = "^0.1.5"
django-gravatar2 = "^1.4.5"
django-import-export = "^4.1.0"
django-import-export = "^4.3.1"
django-annoying = "^0.10.7"
dj-rest-auth = "^5.0.2"
tweepy = "^4.8.0"
Expand Down Expand Up @@ -63,7 +63,7 @@ django-filter = "^24.3"
webdriver-manager = "^4.0.2"
pillow = "^10.4.0"
chromedriver-autoinstaller = "^0.6.4"
sentry-sdk = "^2.18.0"
sentry-sdk = "^2.19.0"
bitcash = "^1.0.2"
pydantic = "^2.7.3"
pydantic_core = "^2.18.4"
Expand Down
18 changes: 16 additions & 2 deletions website/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,22 @@
{% for message in messages %}
$.notify("{{ message }}", {
style: "custom",
className: "{{message.level_tag }}"
});
className: "{{message.level_tag }}",
autoHide: true,
autoHideDelay: 2000,
clicktoHide: true,
position: "left bottom",
gap: 5,
elementSize: {
width: "auto",
height: "auto"
}
});
setTimeout(function() {
$('.notifyjs-wrapper').on('mouseenter', function() {
$(this).fadeOut();
});
}, 100);
{% endfor %}
{% endif %}
});
Expand Down
8 changes: 7 additions & 1 deletion website/templates/new_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
right: 15px;
}
</style>
<div class="flex flex-col sm:flex-row mt-[35px]">
<div class="mt-14 ml-8">
<a href="{% url 'report' %}"
class="bg-red-500 text-white px-8 py-4 rounded-lg shadow-lg font-bold text-2xl hover:bg-red-600 transform hover:-translate-y-1 transition hover:text-white">
Report a Bug!
</a>
</div>
<div class="flex flex-col sm:flex-row mt-[25px]">
<div class="flex-1">
<div class="hero-bugs-container grid grid-cols-1 sm:grid-cols-2 gap-4 mx-4 my-2.5">
{% for bug in bugs %}
Expand Down
2 changes: 1 addition & 1 deletion website/templates/profile_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ <h2 class="text-4xl font-bold text-center mb-12">Edit Profile</h2>
<div class="mt-8 border-t pt-6">
<h3 class="text-lg font-semibold text-red-600">Danger Zone</h3>
<div class="mt-4">
<form action="{% url 'delete_user' %}"
<form action="{% url 'delete' %}"
method="post"
onsubmit="return confirm('Are you sure you want to delete your account? This action cannot be undone.');">
{% csrf_token %}
Expand Down
19 changes: 12 additions & 7 deletions website/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,13 @@ def UpdateIssue(request):
return HttpResponse("Missing issue ID")
issue = get_object_or_404(Issue, pk=request.POST.get("issue_pk"))
try:
for token in Token.objects.all():
if request.POST["token"] == token.key:
request.user = User.objects.get(id=token.user_id)
tokenauth = True
tokenauth = False
if "token" in request.POST:
for token in Token.objects.all():
if request.POST["token"] == token.key:
request.user = User.objects.get(id=token.user_id)
tokenauth = True
break
except:
tokenauth = False
if (
Expand Down Expand Up @@ -348,9 +351,11 @@ def newhome(request, template="new_home.html"):

def delete_issue(request, id):
try:
token = Token.objects.get(key=request.POST["token"])
request.user = User.objects.get(id=token.user_id)
tokenauth = True
# TODO: Refactor this for a direct query instead of looping through all tokens
for token in Token.objects.all():
if request.POST["token"] == token.key:
request.user = User.objects.get(id=token.user_id)
tokenauth = True
except Token.DoesNotExist:
tokenauth = False

Expand Down
6 changes: 5 additions & 1 deletion website/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def post(self, request, *args, **kwargs):
logout(request)
user.delete()
messages.success(request, "Account successfully deleted")
return redirect(reverse("index"))
return redirect(reverse("home"))
return render(request, "user_deletion.html", {"form": form})


Expand Down Expand Up @@ -202,6 +202,10 @@ def get(self, request, *args, **kwargs):
return super(UserProfileDetailView, self).get(request, *args, **kwargs)

def get_context_data(self, **kwargs):
# if userprofile does not exist, create it
if not UserProfile.objects.filter(user=self.object).exists():
UserProfile.objects.create(user=self.object)

user = self.object
context = super(UserProfileDetailView, self).get_context_data(**kwargs)
context["my_score"] = list(
Expand Down

0 comments on commit da827d1

Please sign in to comment.