1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-09-21 15:45:56 -04:00

Make thread() throw an error 404 rather than 500 on a missing status

This commit is contained in:
Jason McBrayer 2019-04-06 16:51:13 -04:00
parent 300040bdb4
commit a099738cbb

View File

@ -8,7 +8,7 @@ from django.core.files.uploadhandler import TemporaryFileUploadHandler
from django.utils.translation import gettext as _
from brutaldon.forms import LoginForm, OAuthLoginForm, PreferencesForm, PostForm, FilterForm
from brutaldon.models import Client, Account, Preference, Theme
from mastodon import Mastodon, AttribAccessDict, MastodonError, MastodonAPIError
from mastodon import Mastodon, AttribAccessDict, MastodonError, MastodonAPIError, MastodonNotFoundError
from urllib import parse
from pdb import set_trace
from inscriptis import get_text
@ -420,7 +420,10 @@ def note(request, next=None, prev=None):
@br_login_required
def thread(request, id):
account, mastodon = get_usercontext(request)
context = mastodon.status_context(id)
try:
context = mastodon.status_context(id)
except MastodonNotFoundError:
raise Http404(_("Thread not found; the message may have been deleted."))
toot = mastodon.status(id)
notifications = _notes_count(account, mastodon)
filters = get_filters(mastodon, context='thread')