trigger status for all peers on ws connect

This commit is contained in:
j 2016-01-31 22:14:00 +05:30
commit 0cc3a4523e
2 changed files with 9 additions and 3 deletions

View file

@ -109,6 +109,12 @@ class User(db.Model):
def is_online(self):
return state.nodes and state.nodes.is_online(self.id)
def trigger_status(self):
trigger_event('status', {
'id': self.id,
'online': self.is_online()
})
def lists_json(self):
self.library
return [l.json() for l in self.lists.order_by('index_')]