Opened 8 years ago
Closed 8 years ago
#5513 closed defect (fixed)
Can't delete draft blog posts
| Reported by: | ayleph | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 0.10.0 |
| Component: | programming | Keywords: | blog, delete |
| Cc: | Parent Tickets: |
Description
Draft blog posts are set to the 'failed' state. The generated blogpost_delete_url link for a draft gets routed to a 404 page.
Attachments (1)
Change History (7)
comment:1 by , 8 years ago
by , 8 years ago
| Attachment: | 0001-Fix-5513-Can-t-delete-blog-post-drafts.patch added |
|---|
comment:2 by , 8 years ago
I've attached a patch which I think addresses this issue. I removed the requirement from @get_media_entry_by_id for the media to be processed. This allows unprocessed media to be deleted. For all of the other views which used the decorator, I added constraints that the media must be processed.
comment:3 by , 8 years ago
| Status: | new → review |
|---|
comment:4 by , 8 years ago
| Keywords: | delete added |
|---|
comment:5 by , 8 years ago
| Milestone: | → 0.10.0 |
|---|
comment:6 by , 8 years ago
| Resolution: | → fixed |
|---|---|
| Status: | review → closed |
I've been using this patch for weeks without issue. Pushed to master in 2f2b4cb.

And here's why. First, the deletion URL is created using the
media_confirm_deletegenerator.blogpost_delete_url = request.urlgen('mediagoblin.user_pages.media_confirm_delete', user= blog_post.get_actor.username, media_id=blog_post.id)The
media_confirm_deleteview is decorated by@get_media_entry_by_id.The
@get_media_entry_by_idgenerator returns a 404 for media that aren't in the processed state.def get_media_entry_by_id(controller): """ Pass in a MediaEntry based off of a url component """ @wraps(controller) def wrapper(request, *args, **kwargs): media = MediaEntry.query.filter_by( id=request.matchdict['media_id'], state=u'processed').first() # Still no media? Okay, 404. if not media: return render_404(request)Since blog post drafts aren't processed, the delete URL returns a 404.