mirror of
https://github.com/jfmcbrayer/brutaldon
synced 2025-01-18 18:02:09 +01:00
Pleroma bug requires /search before /account_search works
Bluh... falling back to /search if /account_search fails.
This commit is contained in:
parent
9dd5e44e6f
commit
6d22b6fc66
@ -710,7 +710,7 @@ def same_username(account, acct, username):
|
|||||||
myhost = account.username.split("@",1)[1]
|
myhost = account.username.split("@",1)[1]
|
||||||
if acct == user and host == myhost: return True
|
if acct == user and host == myhost: return True
|
||||||
return False
|
return False
|
||||||
from pprint import pprint
|
|
||||||
@br_login_required
|
@br_login_required
|
||||||
def user(request, username, prev=None, next=None):
|
def user(request, username, prev=None, next=None):
|
||||||
try:
|
try:
|
||||||
@ -718,15 +718,24 @@ def user(request, username, prev=None, next=None):
|
|||||||
except NotLoggedInException:
|
except NotLoggedInException:
|
||||||
return redirect(about)
|
return redirect(about)
|
||||||
user_dict = None
|
user_dict = None
|
||||||
print("username",username)
|
# pleroma currently flops if the user's not already locally known
|
||||||
|
# this is a BUG that they MUST FIX
|
||||||
|
# but until then, we might have to "prime the engine"
|
||||||
|
# by doing a regular search, if the account search fails
|
||||||
|
# to return results.
|
||||||
for dict in mastodon.account_search(username):
|
for dict in mastodon.account_search(username):
|
||||||
pprint(("check", dict))
|
print("check", dict.acct)
|
||||||
raise SystemExit(23)
|
|
||||||
if not same_username(account, dict.acct, username): continue
|
if not same_username(account, dict.acct, username): continue
|
||||||
user_dict = dict
|
user_dict = dict
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise Http404(_("The user %s could not be found.") % username)
|
for dict in mastodon.search(username,
|
||||||
|
result_type="accounts",
|
||||||
|
account_id=username):
|
||||||
|
user_dict = dict
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise Http404(_("The user %s could not be found.") % username)
|
||||||
data = mastodon.account_statuses(user_dict.id, max_id=next, min_id=prev)
|
data = mastodon.account_statuses(user_dict.id, max_id=next, min_id=prev)
|
||||||
relationship = mastodon.account_relationships(user_dict.id)[0]
|
relationship = mastodon.account_relationships(user_dict.id)[0]
|
||||||
notifications = _notes_count(account, mastodon)
|
notifications = _notes_count(account, mastodon)
|
||||||
@ -1459,6 +1468,7 @@ def search_results(request):
|
|||||||
else:
|
else:
|
||||||
query = ""
|
query = ""
|
||||||
account, mastodon = get_usercontext(request)
|
account, mastodon = get_usercontext(request)
|
||||||
|
|
||||||
results = mastodon.search(query)
|
results = mastodon.search(query)
|
||||||
notifications = _notes_count(account, mastodon)
|
notifications = _notes_count(account, mastodon)
|
||||||
return render(
|
return render(
|
||||||
|
Loading…
Reference in New Issue
Block a user