forked from 0x2620/pandora
get[section], fixes #1834
This commit is contained in:
parent
95d87ef382
commit
e1760e7b50
4 changed files with 29 additions and 2 deletions
|
@ -204,8 +204,8 @@ def getEdit(request):
|
||||||
'''
|
'''
|
||||||
data = json.loads(request.POST['data'])
|
data = json.loads(request.POST['data'])
|
||||||
if 'id' in data:
|
if 'id' in data:
|
||||||
edit = get_edit_or_404_json(data['id'])
|
|
||||||
response = json_response()
|
response = json_response()
|
||||||
|
edit = get_edit_or_404_json(data['id'])
|
||||||
if edit.accessible(request.user):
|
if edit.accessible(request.user):
|
||||||
response['data'] = edit.json(user=request.user)
|
response['data'] = edit.json(user=request.user)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -119,6 +119,30 @@ def findLists(request):
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(findLists)
|
actions.register(findLists)
|
||||||
|
|
||||||
|
def getList(request):
|
||||||
|
'''
|
||||||
|
takes {
|
||||||
|
id: listid
|
||||||
|
}
|
||||||
|
returns {
|
||||||
|
id:
|
||||||
|
section:
|
||||||
|
...
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
data = json.loads(request.POST['data'])
|
||||||
|
if 'id' in data:
|
||||||
|
response = json_response()
|
||||||
|
list = get_list_or_404_json(data['id'])
|
||||||
|
if list.accessible(request.user):
|
||||||
|
response['data'] = list.json(user=request.user)
|
||||||
|
else:
|
||||||
|
response = json_response(status=403, text='not allowed')
|
||||||
|
else:
|
||||||
|
response = json_response(status=404, text='not found')
|
||||||
|
return render_to_json_response(response)
|
||||||
|
actions.register(getList)
|
||||||
|
|
||||||
@login_required_json
|
@login_required_json
|
||||||
def addListItems(request):
|
def addListItems(request):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -97,6 +97,9 @@ def getText(request):
|
||||||
text = qs[0]
|
text = qs[0]
|
||||||
else:
|
else:
|
||||||
text = get_text_or_404_json(data['id'])
|
text = get_text_or_404_json(data['id'])
|
||||||
|
if not text.accessible(request.user):
|
||||||
|
text = None
|
||||||
|
response['status']['code'] = 404
|
||||||
if text:
|
if text:
|
||||||
response['data'] = text.json(user=request.user)
|
response['data'] = text.json(user=request.user)
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
|
|
|
@ -2017,7 +2017,7 @@ pandora.selectList = function() {
|
||||||
var id = pandora.user.ui[pandora.user.ui.section.slice(0,-1)],
|
var id = pandora.user.ui[pandora.user.ui.section.slice(0,-1)],
|
||||||
section = Ox.toTitleCase(pandora.user.ui.section.slice(0, -1));
|
section = Ox.toTitleCase(pandora.user.ui.section.slice(0, -1));
|
||||||
if (id) {
|
if (id) {
|
||||||
pandora.api['edit' + section]({id: id}, function(result) {
|
pandora.api['get' + section]({id: id}, function(result) {
|
||||||
var folder;
|
var folder;
|
||||||
if (result.data.id) {
|
if (result.data.id) {
|
||||||
folder = result.data.status == 'featured' ? 'featured' : (
|
folder = result.data.status == 'featured' ? 'featured' : (
|
||||||
|
|
Loading…
Reference in a new issue