Compare commits

..

No commits in common. "a576de8a82cce2fc18ea0a2dd84e10241286f7bf" and "9c393cdd56c53eeabd0dd02d1814e6674afa351d" have entirely different histories.

3 changed files with 7 additions and 9 deletions

View file

@ -134,6 +134,7 @@ def get_icons_db_path():
icons_db_path = os.path.join(metadata, 'icons.db') icons_db_path = os.path.join(metadata, 'icons.db')
old_icons_db_path = os.path.join(settings.data_path, 'icons.db') old_icons_db_path = os.path.join(settings.data_path, 'icons.db')
if not os.path.exists(icons_db_path) and os.path.exists(old_icons_db_path): if not os.path.exists(icons_db_path) and os.path.exists(old_icons_db_path):
print(icons_db_path, icons_db_path)
shutil.move(old_icons_db_path, icons_db_path) shutil.move(old_icons_db_path, icons_db_path)
return icons_db_path return icons_db_path

View file

@ -42,11 +42,8 @@ class User(db.Model):
return self.id return self.id
@classmethod @classmethod
def get(cls, id, for_update=False): def get(cls, id):
qs = cls.query.filter_by(id=id) user = cls.query.filter_by(id=id).first()
if for_update:
qs = qs.with_for_update()
user = qs.first()
if user and not user.info: if user and not user.info:
user.info = {} user.info = {}
return user return user
@ -599,13 +596,13 @@ def export_list(data):
def update_user_peering(user_id, peered, username=None): def update_user_peering(user_id, peered, username=None):
with db.session(): with db.session():
u = User.get(user_id, for_update=True) u = User.get(user_id)
if u: if u:
u.update_peering(peered, username) u.update_peering(peered, username)
def remove_local_info(id): def remove_local_info(id):
with db.session(): with db.session():
u = User.get(id, for_update=True) u = User.get(id)
if u and 'local' in u.info: if u and 'local' in u.info:
del u.info['local'] del u.info['local']
u.save() u.save()
@ -613,7 +610,7 @@ def remove_local_info(id):
def add_local_info(data): def add_local_info(data):
with db.session(): with db.session():
u = User.get(data['id'], for_update=True) u = User.get(data['id'])
if u: if u:
if u.info['username'] != data['username']: if u.info['username'] != data['username']:
u.info['username'] = data['username'] u.info['username'] = data['username']

View file

@ -353,7 +353,7 @@ oml.ui.folders = function() {
oml.$ui.folder[index].options({title: Ox.encodeHTMLEntities(name)}); oml.$ui.folder[index].options({title: Ox.encodeHTMLEntities(name)});
oml.getLists(function(lists) { oml.getLists(function(lists) {
var items = lists.filter(function(list) { var items = lists.filter(function(list) {
return list.user == name && list.type != 'library' && list.name != 'Public'; return list.user == name && list.type != 'library';
}), }),
library = lists.filter(function(list) { library = lists.filter(function(list) {
return list.user == name && list.type == 'library'; return list.user == name && list.type == 'library';