dont add local peers to db, just show them in user dialog
This commit is contained in:
parent
eeae402218
commit
444c357e54
2 changed files with 15 additions and 6 deletions
|
@ -141,7 +141,8 @@ class LocalNodesBase(Thread):
|
|||
if can_connect(data):
|
||||
self._nodes[data['id']] = data
|
||||
with db.session():
|
||||
u = user.models.User.get_or_create(data['id'])
|
||||
u = user.models.User.get(data['id'])
|
||||
if u:
|
||||
u.info['username'] = data['username']
|
||||
u.info['local'] = data
|
||||
u.update_name()
|
||||
|
|
|
@ -83,8 +83,16 @@ def getUsers(data):
|
|||
}
|
||||
'''
|
||||
users = []
|
||||
ids = set()
|
||||
for u in models.User.query.filter(models.User.id!=settings.USER_ID).all():
|
||||
users.append(u.json())
|
||||
ids.add(u.id)
|
||||
for id in state.nodes._local._nodes:
|
||||
if id not in ids:
|
||||
n = state.nodes._local._nodes[id].copy()
|
||||
n['online'] = True
|
||||
n['name'] = n['username']
|
||||
users.append(n)
|
||||
users.sort(key=lambda u: ox.sort_string(str(u.get('index', '')) + 'Z' + (u.get('name') or '')))
|
||||
return {
|
||||
"users": users
|
||||
|
|
Loading…
Reference in a new issue