Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
hu8813 committed Apr 23, 2024
1 parent 441e586 commit 2ce5bc8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
Binary file added srcs/backend/media/huaydin_qr_code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added srcs/backend/media/huaydin_qr_code_0Z4BjYN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions srcs/backend/myapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,17 @@ def get_friends(request):
user_id = session.get_decoded().get('_auth_user_id')
if user_id:
online_user_ids.add(user_id)

friend_list = []

for friend in friends:
is_online = friend.id in online_user_ids
is_online = str(friend.id) in online_user_ids
friend_info = {
'username': friend.username,
'nickname': friend.nickname,
'image_link': friend.image_link,
'status': 'online' if is_online else 'offline'
}
friend_list.append(friend_info)

return JsonResponse({'friends': friend_list})

except jwt.ExpiredSignatureError:
Expand All @@ -211,8 +209,6 @@ def get_friends(request):
return JsonResponse({'error': 'User not found'}, status=404)
except Exception as e:
return JsonResponse({'error': str(e)}, status=400)


def unblock_user(request):
try:
token = request.headers.get('Authorization', '').split('Bearer ')[-1]
Expand Down
2 changes: 1 addition & 1 deletion srcs/frontend/js/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ async function fetchAndDisplayFriends() {

if (friendListElement) {
friendListElement.innerHTML = '';

friends.forEach(friend => {
const friendElement = document.createElement('div');
friendElement.classList.add('friend');
Expand Down

0 comments on commit 2ce5bc8

Please sign in to comment.