models: rename post/pool archives to post/pool versions.

This commit is contained in:
evazion
2020-02-15 06:52:10 -06:00
parent 51f3f7338a
commit 60ff2ae929
27 changed files with 71 additions and 84 deletions

View File

@@ -4,7 +4,7 @@ class PoolVersionsController < ApplicationController
around_action :set_timeout
def index
@pool_versions = PoolArchive.paginated_search(params)
@pool_versions = PoolVersion.paginated_search(params)
@pool_versions = @pool_versions.includes(:updater, :pool) if request.format.html?
respond_with(@pool_versions)
@@ -14,10 +14,10 @@ class PoolVersionsController < ApplicationController
end
def diff
@pool_version = PoolArchive.find(params[:id])
@pool_version = PoolVersion.find(params[:id])
if params[:other_id]
@other_version = PoolArchive.find(params[:other_id])
@other_version = PoolVersion.find(params[:other_id])
else
@other_version = @pool_version.previous
end
@@ -25,19 +25,15 @@ class PoolVersionsController < ApplicationController
private
def model_name
"PoolArchive"
end
def set_timeout
PoolArchive.connection.execute("SET statement_timeout = #{CurrentUser.user.statement_timeout}")
PoolVersion.connection.execute("SET statement_timeout = #{CurrentUser.user.statement_timeout}")
yield
ensure
PoolArchive.connection.execute("SET statement_timeout = 0")
PoolVersion.connection.execute("SET statement_timeout = 0")
end
def check_availabililty
if !PoolArchive.enabled?
if !PoolVersion.enabled?
raise NotImplementedError.new("Archive service is not configured. Pool versions are not saved.")
end
end

View File

@@ -6,7 +6,7 @@ class PostVersionsController < ApplicationController
respond_to :js, only: [:undo]
def index
@post_versions = PostArchive.paginated_search(params)
@post_versions = PostVersion.paginated_search(params)
if request.format.html?
@post_versions = @post_versions.includes(:updater, post: [:uploader, :versions])
@@ -21,7 +21,7 @@ class PostVersionsController < ApplicationController
end
def undo
@post_version = PostArchive.find(params[:id])
@post_version = PostVersion.find(params[:id])
@post_version.undo!
respond_with(@post_version)
@@ -29,19 +29,15 @@ class PostVersionsController < ApplicationController
private
def model_name
"PostArchive"
end
def set_timeout
PostArchive.connection.execute("SET statement_timeout = #{CurrentUser.user.statement_timeout}")
PostVersion.connection.execute("SET statement_timeout = #{CurrentUser.user.statement_timeout}")
yield
ensure
PostArchive.connection.execute("SET statement_timeout = 0")
PostVersion.connection.execute("SET statement_timeout = 0")
end
def check_availabililty
if !PostArchive.enabled?
if !PostVersion.enabled?
raise NotImplementedError.new("Archive service is not configured. Post versions are not saved.")
end
end