Missed a same_username

Making sure to check the username in the fallback too. Otherwise, seems to be working!
This commit is contained in:
Cy 2020-06-01 08:22:36 +00:00
parent 6d22b6fc66
commit f471cf656f
No known key found for this signature in database
GPG Key ID: F66D599380F88521

View File

@ -84,6 +84,7 @@ def get_usercontext(request):
): ):
raise NotLoggedInException() raise NotLoggedInException()
mastodon = Mastodon( mastodon = Mastodon(
debug_requests=True,
client_id=client.client_id, client_id=client.client_id,
client_secret=client.client_secret, client_secret=client.client_secret,
access_token=user.access_token, access_token=user.access_token,
@ -720,18 +721,16 @@ def user(request, username, prev=None, next=None):
user_dict = None user_dict = None
# pleroma currently flops if the user's not already locally known # pleroma currently flops if the user's not already locally known
# this is a BUG that they MUST FIX # this is a BUG that they MUST FIX
# but until then, we might have to "prime the engine" # but until then, we might have to fallback to a regular search,
# by doing a regular search, if the account search fails # if the account search fails to return results.
# to return results.
for dict in mastodon.account_search(username): for dict in mastodon.account_search(username):
print("check", dict.acct)
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:
for dict in mastodon.search(username, for dict in mastodon.search(username,
result_type="accounts", result_type="accounts").accounts:
account_id=username): if not same_username(account, dict.acct, username): continue
user_dict = dict user_dict = dict
break break
else: else: