keep listorder in sync
This commit is contained in:
parent
5f36b2eab4
commit
103aab3f4a
1 changed files with 6 additions and 0 deletions
|
@ -130,16 +130,22 @@ class Peer(object):
|
||||||
self.info['lists'][new['name']] = self.info['lists'].pop(name)
|
self.info['lists'][new['name']] = self.info['lists'].pop(name)
|
||||||
else:
|
else:
|
||||||
self.info['lists'][new['name']] = []
|
self.info['lists'][new['name']] = []
|
||||||
|
if name in self.info['listorder']:
|
||||||
|
self.info['listorder'] = [new['name'] if n == name else n for n in self.info['listorder']]
|
||||||
elif action == 'orderlists':
|
elif action == 'orderlists':
|
||||||
self.info['listorder'] = args[0]
|
self.info['listorder'] = args[0]
|
||||||
elif action == 'removelist':
|
elif action == 'removelist':
|
||||||
name = args[0]
|
name = args[0]
|
||||||
if name in self.info['lists']:
|
if name in self.info['lists']:
|
||||||
del self.info['lists'][name]
|
del self.info['lists'][name]
|
||||||
|
if name in self.info['listorder']:
|
||||||
|
self.info['listorder'] = [n for n in self.info['listorder'] if n != name]
|
||||||
elif action == 'addlistitems':
|
elif action == 'addlistitems':
|
||||||
name, ids = args
|
name, ids = args
|
||||||
if name not in self.info['lists']:
|
if name not in self.info['lists']:
|
||||||
self.info['lists'][name] = []
|
self.info['lists'][name] = []
|
||||||
|
if name not in self.info['listorder']:
|
||||||
|
self.info['listorder'].append(name)
|
||||||
self.info['lists'][name] = list(set(self.info['lists'][name]) | set(ids))
|
self.info['lists'][name] = list(set(self.info['lists'][name]) | set(ids))
|
||||||
elif action == 'removelistitems':
|
elif action == 'removelistitems':
|
||||||
name, ids = args
|
name, ids = args
|
||||||
|
|
Loading…
Reference in a new issue