mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Better find friends with emails.
This commit is contained in:
parent
534e16fb84
commit
a03d058874
1 changed files with 7 additions and 1 deletions
|
@ -1105,7 +1105,13 @@ def ignore_follower(request):
|
|||
def find_friends(request):
|
||||
query = request.GET['query']
|
||||
limit = int(request.GET.get('limit', 3))
|
||||
profiles = MSocialProfile.objects.filter(username__iexact=query)[:limit]
|
||||
profiles = []
|
||||
|
||||
if '@' in query:
|
||||
email = re.search(r'[\w\.-]+@[\w\.-]+', query).group(0)
|
||||
profiles = MSocialProfile.objects.filter(email__icontains=email)[:limit]
|
||||
if not profiles:
|
||||
profiles = MSocialProfile.objects.filter(username__iexact=query)[:limit]
|
||||
if not profiles:
|
||||
profiles = MSocialProfile.objects.filter(username__icontains=query)[:limit]
|
||||
if not profiles:
|
||||
|
|
Loading…
Add table
Reference in a new issue