diff --git a/oml/library.py b/oml/library.py index 94e30e8..362826d 100644 --- a/oml/library.py +++ b/oml/library.py @@ -130,16 +130,22 @@ class Peer(object): self.info['lists'][new['name']] = self.info['lists'].pop(name) else: 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': self.info['listorder'] = args[0] elif action == 'removelist': name = args[0] if name in self.info['lists']: 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': name, ids = args if name not in self.info['lists']: 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)) elif action == 'removelistitems': name, ids = args