diff options
author | ayleph <ayleph@thisshitistemp.com> | 2017-06-27 22:45:42 -0700 |
---|---|---|
committer | Andrew Browning <ayleph@thisshitistemp.com> | 2017-08-15 01:43:58 -0400 |
commit | 2f2b4cbacb72cbeb21d51323296fb90a20c81737 (patch) | |
tree | fc5ff942c00542f54ab01ec099a992ef6e011896 /mediagoblin/user_pages/views.py | |
parent | 1f8c877d7430c1101740ef6ee732e90ff4c9cfdc (diff) | |
download | mediagoblin-2f2b4cbacb72cbeb21d51323296fb90a20c81737.tar.lz mediagoblin-2f2b4cbacb72cbeb21d51323296fb90a20c81737.tar.xz mediagoblin-2f2b4cbacb72cbeb21d51323296fb90a20c81737.zip |
Fix #5513 - Can't delete blog post drafts
Modify the @get_media_entry_by_id decorator to return media regardless
of processing state. Separately modify all view functions that use the
@get_media_entry_by_id decorator to require that the media be in the
processed state, other than for the media_confirm_delete view. This
allows blog post drafts to be deleted without returning a 404. Further,
it adds the ability to delete unprocessed media in the future, which
would be a nice addition to the user processing panel.
Diffstat (limited to 'mediagoblin/user_pages/views.py')
-rw-r--r-- | mediagoblin/user_pages/views.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 484d27cd..ab235695 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -180,6 +180,10 @@ def media_post_comment(request, media): if not request.method == 'POST': raise MethodNotAllowed() + # If media is not processed, return NotFound. + if not media.state == u'processed': + return render_404(request) + comment = request.db.TextComment() comment.actor = request.user.id comment.content = six.text_type(request.form['comment_content']) @@ -232,6 +236,10 @@ def media_preview_comment(request): def media_collect(request, media): """Add media to collection submission""" + # If media is not processed, return NotFound. + if not media.state == u'processed': + return render_404(request) + form = user_forms.MediaCollectForm(request.form) # A user's own collections: form.collection.query = Collection.query.filter_by( |