Prevent reverting to foreign versions (fixes #2711).
This commit is contained in:
@@ -24,8 +24,8 @@ class ArtistCommentariesController < ApplicationController
|
||||
end
|
||||
|
||||
def revert
|
||||
@artist_commentary = ArtistCommentary.find_by_post_id(params[:id])
|
||||
@version = ArtistCommentaryVersion.find(params[:version_id])
|
||||
@artist_commentary = ArtistCommentary.find_by_post_id!(params[:id])
|
||||
@version = @artist_commentary.versions.find(params[:version_id])
|
||||
@artist_commentary.revert_to!(@version)
|
||||
respond_with(@artist_commentary)
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class ArtistsController < ApplicationController
|
||||
before_filter :member_only, :except => [:index, :show, :banned]
|
||||
before_filter :builder_only, :only => [:destroy]
|
||||
before_filter :admin_only, :only => [:ban, :unban]
|
||||
before_filter :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete, :revert]
|
||||
before_filter :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete]
|
||||
|
||||
def new
|
||||
@artist = Artist.new_with_defaults(params)
|
||||
@@ -97,7 +97,8 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def revert
|
||||
@version = ArtistVersion.find(params[:version_id])
|
||||
@artist = Artist.find(params[:id])
|
||||
@version = @artist.versions.find(params[:version_id])
|
||||
@artist.revert_to!(@version)
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ class NotesController < ApplicationController
|
||||
|
||||
def revert
|
||||
@note = Note.find(params[:id])
|
||||
@version = NoteVersion.find(params[:version_id])
|
||||
@version = @note.versions.find(params[:version_id])
|
||||
@note.revert_to!(@version)
|
||||
respond_with(@note)
|
||||
end
|
||||
|
||||
@@ -79,7 +79,7 @@ class PoolsController < ApplicationController
|
||||
|
||||
def revert
|
||||
@pool = Pool.find(params[:id])
|
||||
@version = PoolVersion.find(params[:version_id])
|
||||
@version = @pool.versions.find(params[:version_id])
|
||||
@pool.revert_to!(@version)
|
||||
flash[:notice] = "Pool reverted"
|
||||
respond_with(@pool) do |format|
|
||||
|
||||
@@ -59,7 +59,7 @@ class PostsController < ApplicationController
|
||||
|
||||
def revert
|
||||
@post = Post.find(params[:id])
|
||||
@version = PostVersion.find(params[:version_id])
|
||||
@version = @post.versions.find(params[:version_id])
|
||||
|
||||
if @post.visible?
|
||||
@post.revert_to!(@version)
|
||||
|
||||
@@ -67,7 +67,7 @@ class WikiPagesController < ApplicationController
|
||||
|
||||
def revert
|
||||
@wiki_page = WikiPage.find(params[:id])
|
||||
@version = WikiPageVersion.find(params[:version_id])
|
||||
@version = @wiki_page.versions.find(params[:version_id])
|
||||
@wiki_page.revert_to!(@version)
|
||||
flash[:notice] = "Page was reverted"
|
||||
respond_with(@wiki_page)
|
||||
|
||||
Reference in New Issue
Block a user