Skip to content

Commit

Permalink
Minor fix for searchFor. See comments on #266
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Mar 5, 2018
1 parent 4dd15b0 commit fb1ad58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fbchat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
__version__ = '1.3.3'
__version__ = '1.3.4'
__license__ = 'BSD'
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
__email__ = '[email protected]'
Expand Down
8 changes: 6 additions & 2 deletions fbchat/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ def graphql_to_thread(thread):
c_info = get_customization_info(thread)
participants = [node['messaging_actor'] for node in thread['all_participants']['nodes']]
user = next(p for p in participants if p['id'] == thread['thread_key']['other_user_id'])
last_message_timestamp = thread['last_message']['nodes'][0]['timestamp_precise']
last_message_timestamp = None
if 'last_message' in thread:
last_message_timestamp = thread['last_message']['nodes'][0]['timestamp_precise']

return User(
user['id'],
Expand All @@ -207,7 +209,9 @@ def graphql_to_group(group):
if group.get('image') is None:
group['image'] = {}
c_info = get_customization_info(group)
last_message_timestamp = group['last_message']['nodes'][0]['timestamp_precise']
last_message_timestamp = None
if 'last_message' in group:
last_message_timestamp = group['last_message']['nodes'][0]['timestamp_precise']
return Group(
group['thread_key']['thread_fbid'],
participants=set([node['messaging_actor']['id'] for node in group['all_participants']['nodes']]),
Expand Down

0 comments on commit fb1ad58

Please sign in to comment.