dont reset list position while setting private lists public

This commit is contained in:
j 2011-11-10 23:12:20 +00:00
parent 2d7d0414f9
commit dac0738047
3 changed files with 16 additions and 14 deletions

View file

@ -16,6 +16,7 @@
// "canClickMap": {"friend": true, "staff": true, "admin": true},
"canDeleteItems": {"admin": true},
"canDownloadVideo": {"guest": 0, "member": 0, "friend": 4, "staff": 4, "admin": 4},
"canEditFeaturedLists": {"staff": true, "admin": true},
"canEditMetadata": {"staff": true, "admin": true},
"canEditSitePages": {"staff": true, "admin": true},
"canEditUsers": {"admin": true},

View file

@ -233,8 +233,8 @@ def addList(request):
value = data['status']
if value not in list._status:
value = list._status[0]
if not request.user.is_staff and value == 'featured':
value = 'private'
if value == 'featured' and request.user.get_profile().capability('canEditFeaturedLists'):
value = list.status
list.status = value
if 'description' in data:
list.description = data['description']
@ -329,20 +329,20 @@ def editList(request):
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
pos.save()
models.Position.objects.filter(list=list).exclude(id=pos.id).delete()
else:
models.Position.objects.filter(list=list).delete()
pos, created = models.Position.objects.get_or_create(list=list,
user=list.user,section='personal')
qs = models.Position.objects.filter(user=list.user,
section='personal')
elif list.status == 'featured' and value == 'public':
models.Position.objects.filter(list=list).delete()
pos, created = models.Position.objects.get_or_create(list=list,
user=list.user,section='personal')
qs = models.Position.objects.filter(user=list.user,
section='personal')
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
pos.save()
for u in list.subscribed_users.all():
pos, created = models.Position.objects.get_or_create(list=list, user=u,
section='public')
qs = models.Position.objects.filter(user=u, section='public')
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
pos.save()
for u in list.subscribed_users.all():
pos, created = models.Position.objects.get_or_create(list=list, user=u,
section='public')
qs = models.Position.objects.filter(user=u, section='public')
pos.position = qs.aggregate(Max('position'))['position__max'] + 1
pos.save()
list.status = value
elif key == 'name':

View file

@ -1,6 +1,7 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.folderList = function(id) {
// FIXME: use canEditFeaturedLists capability, not 'admin'
var i = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id),
that;
if (pandora.user.ui.section == 'items') {