post regenerations: replace PostRegeneration model with mod actions.
* Remove the PostRegeneration model. Instead just use a mod action to log when a post is regenerated. * Change it so that IQDB is also updated when the image samples are regenerated. This is necessary because when the images samples are regenerated, the thumbnail may change, which means IQDB needs to be updated too. This can happen when regenerating old images with transparent backgrounds where the transparency was flattened to black instead of white in the thumbnail. * Only display one "Regenerate image" option in the post sidebar, to regenerate both the images and IQDB. Regenerating IQDB only can be done through the API. Having two options in the sidebar is too much clutter, and it's too confusing for Mods who don't know the difference between an IQDB-only regeneration and a full image regeneration. * Add a confirm prompt to the "Regenerate image" link.
This commit is contained in:
@@ -1,18 +1,10 @@
|
||||
class PostRegenerationsController < ApplicationController
|
||||
respond_to :html, :xml, :json, :js
|
||||
respond_to :xml, :json, :js
|
||||
|
||||
def create
|
||||
@post_regeneration = authorize PostRegeneration.new(creator: CurrentUser.user, **permitted_attributes(PostRegeneration))
|
||||
@post_regeneration.execute_category_action!
|
||||
@post_regeneration.save
|
||||
@post = authorize Post.find(params[:post_id]), :regenerate?
|
||||
@post.regenerate!(params[:category], CurrentUser.user)
|
||||
|
||||
respond_with(@post_regeneration, location: @post_regeneration.post)
|
||||
end
|
||||
|
||||
def index
|
||||
@post_regenerations = authorize PostRegeneration.paginated_search(params)
|
||||
@post_regenerations = @post_regenerations.includes(:creator, :post) if request.format.html?
|
||||
|
||||
respond_with(@post_regenerations)
|
||||
respond_with(@post)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user