mirror of
https://gitlab.com/brutaldon/brutaldon.git
synced 2024-12-04 14:46:24 -05:00
Trying to figure out why it's not finding accounts
Refactoring the code to be a little more readable...
This commit is contained in:
parent
00e35409ef
commit
0b418f985d
@ -704,6 +704,12 @@ def thread(request, id):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def same_username(account, acct, username):
|
||||||
|
if acct == username: return True
|
||||||
|
user, host = username.split("@", 1)
|
||||||
|
myhost = account.username.split("@",1)[1]
|
||||||
|
if acct == user and host == myhost: return True
|
||||||
|
return False
|
||||||
|
|
||||||
@br_login_required
|
@br_login_required
|
||||||
def user(request, username, prev=None, next=None):
|
def user(request, username, prev=None, next=None):
|
||||||
@ -711,20 +717,24 @@ def user(request, username, prev=None, next=None):
|
|||||||
account, mastodon = get_usercontext(request)
|
account, mastodon = get_usercontext(request)
|
||||||
except NotLoggedInException:
|
except NotLoggedInException:
|
||||||
return redirect(about)
|
return redirect(about)
|
||||||
|
user_dict = []
|
||||||
|
for dict in mastodon.account_search(username):
|
||||||
|
if same_username(account, dict.acct ,username): continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_dict = [
|
user_dict = [
|
||||||
dict
|
dict
|
||||||
for dict in mastodon.account_search(username)
|
|
||||||
if (
|
if (
|
||||||
(dict.acct == username)
|
(dict.acct == username)
|
||||||
or (
|
or (
|
||||||
dict.acct == username.split("@")[0]
|
dict.acct == username.split("@")[0]
|
||||||
and username.split("@")[1] == account.username.split("@")[1]
|
and
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
][0]
|
][0]
|
||||||
except (IndexError, AttributeError):
|
except (IndexError, AttributeError) as e:
|
||||||
raise Http404(_("The user %s could not be found.") % username)
|
raise Http404(_("The user %s could not be found. %s") % (username, e))
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user