From 0c919a6bc8580f921ef171dbb36e3c7afb7f6bcb Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 18 Sep 2022 05:32:02 -0500 Subject: [PATCH] versions: remove 'subsequent' version comparison option. This option was rarely used and what it actually did was usually difficult to understand. --- app/controllers/application_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/helpers/artist_versions_helper.rb | 4 ---- app/models/artist_commentary_version.rb | 5 ----- app/models/artist_version.rb | 5 ----- app/models/note_version.rb | 5 ----- app/models/pool_version.rb | 5 ----- app/models/post_version.rb | 5 ----- app/models/wiki_page_version.rb | 5 ----- 9 files changed, 2 insertions(+), 36 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d39fb25db..51dddd082 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -65,7 +65,7 @@ class ApplicationController < ActionController::Base end def set_version_comparison(default_type = "previous") - params[:type] = %w[previous subsequent current].include?(params[:type]) ? params[:type] : default_type + params[:type] = %w[previous current].include?(params[:type]) ? params[:type] : default_type end def model_name diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4e77851b7..9bad5a6e9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -62,7 +62,7 @@ module ApplicationHelper def version_type_links(params) html = [] - %w[previous subsequent current].each do |type| + %w[previous current].each do |type| if type == params[:type] html << %{#{type}} else diff --git a/app/helpers/artist_versions_helper.rb b/app/helpers/artist_versions_helper.rb index e6fc03b05..11c9b4d3a 100644 --- a/app/helpers/artist_versions_helper.rb +++ b/app/helpers/artist_versions_helper.rb @@ -6,8 +6,6 @@ module ArtistVersionsHelper this_names = artist_version.other_names if other.present? other_names = other.other_names - elsif type == "subsequent" - other_names = this_names else other_names = [] end @@ -24,8 +22,6 @@ module ArtistVersionsHelper this_urls = artist_version.urls if other.present? other_urls = other.urls - elsif type == "subsequent" - other_urls = this_urls else other_urls = [] end diff --git a/app/models/artist_commentary_version.rb b/app/models/artist_commentary_version.rb index d87c7810a..196064b6b 100644 --- a/app/models/artist_commentary_version.rb +++ b/app/models/artist_commentary_version.rb @@ -30,11 +30,6 @@ class ArtistCommentaryVersion < ApplicationRecord @previous.first end - def subsequent - @subsequent ||= ArtistCommentaryVersion.where("post_id = ? and updated_at > ?", post_id, updated_at).order("updated_at asc").limit(1).to_a - @subsequent.first - end - def current @current ||= ArtistCommentaryVersion.where(post_id: post_id).order("updated_at desc").limit(1).to_a @current.first diff --git a/app/models/artist_version.rb b/app/models/artist_version.rb index 352172efb..85ae3f1f9 100644 --- a/app/models/artist_version.rb +++ b/app/models/artist_version.rb @@ -40,11 +40,6 @@ class ArtistVersion < ApplicationRecord @previous.first end - def subsequent - @subsequent ||= ArtistVersion.where("artist_id = ? and created_at > ?", artist_id, created_at).order("created_at asc").limit(1).to_a - @subsequent.first - end - def current @previous ||= ArtistVersion.where(artist_id: artist_id).order("created_at desc").limit(1).to_a @previous.first diff --git a/app/models/note_version.rb b/app/models/note_version.rb index 1e3bfb6f6..8d9bee888 100644 --- a/app/models/note_version.rb +++ b/app/models/note_version.rb @@ -19,11 +19,6 @@ class NoteVersion < ApplicationRecord @previous.first end - def subsequent - @subsequent ||= NoteVersion.where("note_id = ? and version > ?", note_id, version).order("updated_at asc").limit(1).to_a - @subsequent.first - end - def current @current ||= NoteVersion.where(note_id: note_id).order("updated_at desc").limit(1).to_a @current.first diff --git a/app/models/pool_version.rb b/app/models/pool_version.rb index 8ceeac4de..3cd798bcc 100644 --- a/app/models/pool_version.rb +++ b/app/models/pool_version.rb @@ -100,11 +100,6 @@ class PoolVersion < ApplicationRecord @previous.first end - def subsequent - @subsequent ||= PoolVersion.where("pool_id = ? and version > ?", pool_id, version).order("version asc").limit(1).to_a - @subsequent.first - end - def current @current ||= PoolVersion.where(pool_id: pool_id).order("version desc").limit(1).to_a @current.first diff --git a/app/models/post_version.rb b/app/models/post_version.rb index 93f4bae70..68853f25c 100644 --- a/app/models/post_version.rb +++ b/app/models/post_version.rb @@ -128,11 +128,6 @@ class PostVersion < ApplicationRecord @previous.first end - def subsequent - @subsequent ||= PostVersion.where("post_id = ? and version > ?", post_id, version).order("version asc").limit(1).to_a - @subsequent.first - end - def current @current ||= PostVersion.where(post_id: post_id).order("version desc").limit(1).to_a @current.first diff --git a/app/models/wiki_page_version.rb b/app/models/wiki_page_version.rb index f84c59b5d..99fd950ea 100644 --- a/app/models/wiki_page_version.rb +++ b/app/models/wiki_page_version.rb @@ -29,11 +29,6 @@ class WikiPageVersion < ApplicationRecord @previous.first end - def subsequent - @subsequent ||= WikiPageVersion.where("wiki_page_id = ? and id > ?", wiki_page_id, id).order("id asc").limit(1).to_a - @subsequent.first - end - def current @current ||= WikiPageVersion.where(wiki_page_id: wiki_page_id).order("id desc").limit(1).to_a @current.first