add upload to changelog

This commit is contained in:
j 2017-03-12 22:01:32 +02:00
parent ed7a56a5e9
commit 5e37a2d222
2 changed files with 20 additions and 0 deletions

View file

@ -284,6 +284,13 @@ def firefogg_upload(request):
if f.item.rendered and f.selected: if f.item.rendered and f.selected:
Item.objects.filter(id=f.item.id).update(rendered=False) Item.objects.filter(id=f.item.id).update(rendered=False)
Task.start(f.item, request.user) Task.start(f.item, request.user)
add_changelog({
'user': request.user,
'action': 'upload',
}, {
'profile': profile,
'item': f.item.public_id,
}, f.oshash)
response = { response = {
'uploadUrl': '/api/upload/?id=%s&profile=%s' % (f.oshash, profile), 'uploadUrl': '/api/upload/?id=%s&profile=%s' % (f.oshash, profile),
'url': request.build_absolute_uri('/%s' % f.item.public_id), 'url': request.build_absolute_uri('/%s' % f.item.public_id),
@ -341,6 +348,12 @@ def direct_upload(request):
file.uploading = True file.uploading = True
file.save() file.save()
Task.start(file.item, request.user) Task.start(file.item, request.user)
add_changelog({
'user': request.user,
'action': 'upload',
}, {
'item': file.item.public_id,
}, file.oshash)
upload_url = '/api/upload/direct/?id=%s' % file.oshash upload_url = '/api/upload/direct/?id=%s' % file.oshash
return render_to_json_response({ return render_to_json_response({
'uploadUrl': upload_url, 'uploadUrl': upload_url,

View file

@ -417,6 +417,13 @@ def upload(request):
file.save() file.save()
else: else:
return render_to_json_response(response) return render_to_json_response(response)
add_changelog({
'user': request.user,
'action': 'uploadDocument',
}, {
'name': name,
'extension': extension
}, file.get_id())
upload_url = '/api/upload/document?id=%s' % file.get_id() upload_url = '/api/upload/document?id=%s' % file.get_id()
return render_to_json_response({ return render_to_json_response({
'uploadUrl': upload_url, 'uploadUrl': upload_url,