trigger peering.accept if peering in requestPeering
This commit is contained in:
parent
0b2db6fd80
commit
876f511f45
1 changed files with 3 additions and 1 deletions
|
@ -26,6 +26,7 @@ def api_pullChanges(remote_id, user_id=None, from_=None, to=None):
|
|||
return Changelog.aggregated_changes(from_)
|
||||
|
||||
def api_requestPeering(user_id, username, message):
|
||||
event = 'peering.request'
|
||||
user = User.get_or_create(user_id)
|
||||
if not user.peered:
|
||||
pref = settings.preferences.get('receivedRequests')
|
||||
|
@ -35,13 +36,14 @@ def api_requestPeering(user_id, username, message):
|
|||
user.info['message'] = message
|
||||
user.update_peering(True, username)
|
||||
user.update_name()
|
||||
event = 'peering.accept'
|
||||
else:
|
||||
user.pending = 'received'
|
||||
user.info['username'] = username
|
||||
user.info['message'] = message
|
||||
user.update_name()
|
||||
user.save()
|
||||
trigger_event('peering.request', user.json())
|
||||
trigger_event(event, user.json())
|
||||
if user.peered:
|
||||
state.nodes.queue('add', user.id, True)
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue