only publish static lists

This commit is contained in:
j 2016-04-05 11:04:30 +02:00
parent 876f511f45
commit 720076d5d1

View file

@ -290,13 +290,16 @@ class List(db.Model):
name = '%s [%s]' % (prefix, n) name = '%s [%s]' % (prefix, n)
n += 1 n += 1
l = cls(user_id=user_id, name=name) l = cls(user_id=user_id, name=name)
if query:
l._query = query l._query = query
l.type = 'smart' if l._query else 'static' l.type = 'smart'
else:
l.type = 'static'
l.index_ = cls.query.filter_by(user_id=user_id).count() l.index_ = cls.query.filter_by(user_id=user_id).count()
state.db.session.add(l) state.db.session.add(l)
state.db.session.commit() state.db.session.commit()
if user_id == settings.USER_ID: if user_id == settings.USER_ID:
if not l._query and name != '': if l.type == 'static' and name != '':
Changelog.record(state.user(), 'addlist', l.name) Changelog.record(state.user(), 'addlist', l.name)
return l return l