Skip to content

Commit

Permalink
fix 404 when user not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name authored and alphatownsman committed Jul 6, 2024
1 parent cbc4c8d commit 6568b23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from discord import SyncWebhook
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.core.signing import b62_decode, b62_encode
from django.http import Http404, HttpRequest, HttpResponseRedirect, QueryDict
from django.utils import timezone
Expand Down Expand Up @@ -87,7 +87,7 @@ def wrapper(request, user_name, *args, **kwargs):

try:
target = APIdentity.get_by_handle(user_name, match_linked=True)
except APIdentity.DoesNotExist:
except ObjectDoesNotExist:
raise Http404(_("User not found"))
target_user = target.user
viewer = None
Expand Down
7 changes: 7 additions & 0 deletions mastodon/views/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,11 @@ def disconnect_identity(request, account):
_("You cannot disconnect last login identity."),
)
account.delete()
messages.add_message(
request,
messages.INFO,
_("Login information about {handle} has been removed.").format(
handle=account.handle
),
)
return redirect(reverse("users:info"))

0 comments on commit 6568b23

Please sign in to comment.