mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-23 15:23:52 -05:00
Catch MastodonNotFoundErrors that were not being caught
This will cause a much more sensible error message in the case of trying to reply to or view the thread of deleted messages
This commit is contained in:
parent
72c7bbcc3d
commit
2354dadddb
@ -673,9 +673,9 @@ def note(request, next=None, prev=None):
|
|||||||
@br_login_required
|
@br_login_required
|
||||||
def thread(request, id):
|
def thread(request, id):
|
||||||
account, mastodon = get_usercontext(request)
|
account, mastodon = get_usercontext(request)
|
||||||
|
try:
|
||||||
toot = mastodon.status(id)
|
toot = mastodon.status(id)
|
||||||
root = toot
|
root = toot
|
||||||
try:
|
|
||||||
context = mastodon.status_context(id)
|
context = mastodon.status_context(id)
|
||||||
if context.ancestors and len(context.ancestors) > 0:
|
if context.ancestors and len(context.ancestors) > 0:
|
||||||
root = context.ancestors[0]
|
root = context.ancestors[0]
|
||||||
@ -1049,8 +1049,11 @@ def safe_get_attachment(toot, index):
|
|||||||
def reply(request, id):
|
def reply(request, id):
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
account, mastodon = get_usercontext(request)
|
account, mastodon = get_usercontext(request)
|
||||||
|
try:
|
||||||
toot = mastodon.status(id)
|
toot = mastodon.status(id)
|
||||||
context = mastodon.status_context(id)
|
context = mastodon.status_context(id)
|
||||||
|
except MastodonNotFoundError:
|
||||||
|
raise Http404(_("Thread not found; the message may have been deleted."))
|
||||||
notifications = _notes_count(account, mastodon)
|
notifications = _notes_count(account, mastodon)
|
||||||
if toot.account.acct != request.session["active_user"].acct:
|
if toot.account.acct != request.session["active_user"].acct:
|
||||||
initial_text = "@" + toot.account.acct + " "
|
initial_text = "@" + toot.account.acct + " "
|
||||||
|
Loading…
Reference in New Issue
Block a user