its an inbox
This commit is contained in:
parent
b1215fbc1b
commit
aac3e66f7b
8 changed files with 58 additions and 54 deletions
|
|
@ -81,9 +81,9 @@ def api_upload(user_id, items):
|
|||
from user.models import List
|
||||
peer = User.get(user_id)
|
||||
if peer:
|
||||
l = List.get_or_create(':Public')
|
||||
l = List.get_or_create(':Inbox')
|
||||
if l:
|
||||
logger.debug('%s added items to public folder: %s', user_id, items)
|
||||
logger.debug('%s added items to inbox: %s', user_id, items)
|
||||
l.add_items(items)
|
||||
trigger_event('change', {})
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ class Node(Thread):
|
|||
return False
|
||||
|
||||
def upload(self, items):
|
||||
logger.debug('add items to %s\'s public folder: %s', self.id, items)
|
||||
logger.debug('add items to %s\'s inbox: %s', self.user_id, items)
|
||||
r = self.request('upload', items)
|
||||
return bool(r)
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ def getLists(data):
|
|||
'type': 'libraries',
|
||||
'user': None,
|
||||
})
|
||||
List.get_or_create(':Public')
|
||||
List.get_or_create(':Inbox')
|
||||
for u in models.User.query.filter((models.User.peered==True)|(models.User.id==settings.USER_ID)):
|
||||
lists += u.lists_json()
|
||||
return {
|
||||
|
|
@ -289,7 +289,7 @@ def removeList(data):
|
|||
}
|
||||
'''
|
||||
l = models.List.get(data['id'])
|
||||
if l and l.name != 'Public':
|
||||
if l and l.name != 'Inbox':
|
||||
l.remove()
|
||||
return {}
|
||||
actions.register(removeList, cache=False)
|
||||
|
|
@ -308,12 +308,10 @@ def addListItems(data):
|
|||
i = Item.get(item_id)
|
||||
i.queue_download()
|
||||
i.update()
|
||||
elif data['list'] and (data['list'].startswith(':') or
|
||||
data['list'].endswith(':Public') or
|
||||
data['list'].enswtih(':')):
|
||||
elif data['list'] and (data['list'].startswith(':') or data['list'].endswith(':')):
|
||||
l = models.List.get_or_create(data['list'])
|
||||
if l:
|
||||
if l.name in ('Public', '') and l.user_id != settings.USER_ID:
|
||||
if l.name in ('Inbox', '') and l.user_id != settings.USER_ID:
|
||||
state.tasks.queue('upload', {
|
||||
'user': l.user_id,
|
||||
'items': data['items']
|
||||
|
|
@ -350,12 +348,11 @@ def sortLists(data):
|
|||
'''
|
||||
n = 0
|
||||
logger.debug('sortLists %s', data)
|
||||
lists = ['Public']
|
||||
for id in data['ids']:
|
||||
l = models.List.get(id)
|
||||
l.index_ = n
|
||||
n += 1
|
||||
if l.type == 'static':
|
||||
if l.type == 'static' and l.name not in ('', 'Inbox'):
|
||||
lists.append(l.name)
|
||||
state.db.session.add(l)
|
||||
state.db.session.commit()
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ class User(db.Model):
|
|||
Changelog.record(self, 'edititem', item.id, item.meta, _commit=False)
|
||||
lists = []
|
||||
for l in List.query.filter_by(user_id=self.id, type='static').order_by('index_'):
|
||||
if l.name:
|
||||
if l.name and l.name != 'Inbox':
|
||||
lists.append(l.name)
|
||||
Changelog.record(self, 'addlist', l.name, _commit=False)
|
||||
items = [i.id for i in l.get_items().options(load_only('id'))]
|
||||
|
|
@ -300,7 +300,7 @@ class List(db.Model):
|
|||
state.db.session.add(l)
|
||||
state.db.session.commit()
|
||||
if user_id == settings.USER_ID:
|
||||
if l.type == 'static' and name != '':
|
||||
if l.type == 'static' and name != '' and name != 'Inbox':
|
||||
add_record('addlist', l.name)
|
||||
return l
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue