Merge pull request #3015 from evazion/feat-replace-images

Fix #2949: Sample image replacement ability
This commit is contained in:
Albert Yi
2017-05-12 17:11:29 -07:00
committed by GitHub
12 changed files with 295 additions and 26 deletions

View File

@@ -1,10 +1,12 @@
module Moderator
module Post
class PostsController < ApplicationController
before_filter :approver_only, :only => [:delete, :undelete, :move_favorites, :ban, :unban, :confirm_delete, :confirm_move_favorites, :confirm_ban]
before_filter :approver_only, :only => [:delete, :undelete, :move_favorites, :replace, :ban, :unban, :confirm_delete, :confirm_move_favorites, :confirm_ban]
before_filter :admin_only, :only => [:expunge]
skip_before_filter :api_check
respond_to :html, :json, :xml
def confirm_delete
@post = ::Post.find(params[:id])
end
@@ -35,6 +37,15 @@ module Moderator
redirect_to(post_path(@post))
end
def replace
@post = ::Post.find(params[:id])
@post.replace!(params[:post][:source])
respond_with(@post) do |format|
format.html { redirect_to(@post) }
end
end
def expunge
@post = ::Post.find(params[:id])
@post.expunge!