Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated methods #2421

Merged
merged 4 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/models/alchemy/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,6 @@ class Page < BaseRecord
# site_name accessor
delegate :name, to: :site, prefix: true, allow_nil: true

# Old public_on and public_until attributes for historical reasons
#
# These attributes now exist on the page versions
#
attr_readonly :legacy_public_on, :legacy_public_until
deprecate :legacy_public_on, deprecator: Alchemy::Deprecation
deprecate :legacy_public_until, deprecator: Alchemy::Deprecation

# Class methods
#
class << self
Expand Down
14 changes: 0 additions & 14 deletions app/models/alchemy/page/page_layouts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ def layouts_for_select(language_id, layoutpages: false)
mapped_layouts_for_select(selectable_layouts(language_id, layoutpages: layoutpages))
end

# Returns page layouts including given layout ready for Rails' select form helper.
#
def layouts_with_own_for_select(page_layout_name, language_id, layoutpages: false)
layouts = selectable_layouts(language_id, layoutpages: layoutpages)
if layouts.detect { |l| l["name"] == page_layout_name }.nil?
@map_array = [[human_layout_name(page_layout_name), page_layout_name]]
else
@map_array = []
end
mapped_layouts_for_select(layouts)
end

deprecate :layouts_with_own_for_select, deprecator: Alchemy::Deprecation

# Returns all layouts that can be used for creating a new page.
#
# It removes all layouts from available layouts that are unique and already taken and that are marked as hide.
Expand Down
6 changes: 0 additions & 6 deletions app/models/alchemy/page/page_natures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ def expiration_time
public_until ? public_until - Time.current : nil
end

def taggable?
definition["taggable"] == true
end

deprecate :taggable?, deprecator: Alchemy::Deprecation

def rootpage?
!new_record? && parent_id.blank?
end
Expand Down
30 changes: 0 additions & 30 deletions app/models/alchemy/picture/transformations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,6 @@ def resize(size, upsample = false)
image_file.thumbnail(upsample ? size : "#{size}>")
end

# Returns true if picture's width is greater than it's height
#
def landscape_format?
image_file.landscape?
end

alias_method :landscape?, :landscape_format?
deprecate landscape_format?: "Use image_file.landscape? instead", deprecator: Alchemy::Deprecation
deprecate landscape?: "Use image_file.landscape? instead", deprecator: Alchemy::Deprecation

# Returns true if picture's width is smaller than it's height
#
def portrait_format?
image_file.portrait?
end

alias_method :portrait?, :portrait_format?
deprecate portrait_format?: "Use image_file.portrait? instead", deprecator: Alchemy::Deprecation
deprecate portrait?: "Use image_file.portrait? instead", deprecator: Alchemy::Deprecation

# Returns true if picture's width and height is equal
#
def square_format?
image_file.aspect_ratio == 1.0
end

alias_method :square?, :square_format?
deprecate square_format?: "Use image_file.aspect_ratio instead", deprecator: Alchemy::Deprecation
deprecate square?: "Use image_file.aspect_ratio instead", deprecator: Alchemy::Deprecation

# Returns true if the class we're included in has a meaningful render_size attribute
#
def render_size?
Expand Down
2 changes: 0 additions & 2 deletions db/migrate/20230121212637_alchemy_six_point_one.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ def up
t.integer "updater_id"
t.references "language", null: false, foreign_key: { to_table: :alchemy_languages }
t.datetime "published_at", precision: nil
t.datetime "legacy_public_on", precision: nil
t.datetime "legacy_public_until", precision: nil
t.datetime "locked_at", precision: nil
t.index ["creator_id"], name: "index_alchemy_pages_on_creator_id"
t.index ["locked_at", "locked_by"], name: "index_alchemy_pages_on_locked_at_and_locked_by"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ def up
t.integer "updater_id"
t.references "language", null: false, foreign_key: { to_table: :alchemy_languages }
t.datetime "published_at", precision: nil
t.datetime "legacy_public_on", precision: nil
t.datetime "legacy_public_until", precision: nil
t.datetime "locked_at", precision: nil
t.index ["creator_id"], name: "index_alchemy_pages_on_creator_id"
t.index ["locked_at", "locked_by"], name: "index_alchemy_pages_on_locked_at_and_locked_by"
Expand Down
2 changes: 0 additions & 2 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@
t.integer "updater_id"
t.integer "language_id", null: false
t.datetime "published_at", precision: nil
t.datetime "legacy_public_on", precision: nil
t.datetime "legacy_public_until", precision: nil
t.datetime "locked_at", precision: nil
t.boolean "searchable", default: true, null: false
t.index ["creator_id"], name: "index_alchemy_pages_on_creator_id"
Expand Down
18 changes: 0 additions & 18 deletions spec/models/alchemy/page/page_layouts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@
require "rails_helper"

RSpec.describe Alchemy::Page::PageLayouts do
describe ".layouts_with_own_for_select" do
it "should not hold a layout twice" do
Alchemy::Deprecation.silence do
layouts = Alchemy::Page.layouts_with_own_for_select("standard", 1, layoutpages: false)
layouts = layouts.collect(&:last)
expect(layouts.count { |l| l == "standard" }).to eq(1)
end
end

it "should return layoutpages" do
Alchemy::Deprecation.silence do
layouts = Alchemy::Page.layouts_with_own_for_select("footer", 1, layoutpages: true)
layouts = layouts.collect(&:last)
expect(layouts.count { |l| l == "footer" }).to eq(1)
end
end
end

describe ".selectable_layouts" do
let(:site) { create(:alchemy_site) }
let!(:language) { create(:alchemy_language, code: :de) }
Expand Down
30 changes: 0 additions & 30 deletions spec/models/alchemy/page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1627,36 +1627,6 @@ def copy_children_to(new_parent)
end
end

describe "#taggable?" do
around do |example|
Alchemy::Deprecation.silence { example.run }
end

context "definition has 'taggable' key with true value" do
it "should return true" do
page = build(:alchemy_page)
allow(page).to receive(:definition).and_return({ "name" => "standard", "taggable" => true })
expect(page.taggable?).to be_truthy
end
end

context "definition has 'taggable' key with foo value" do
it "should return false" do
page = build(:alchemy_page)
allow(page).to receive(:definition).and_return({ "name" => "standard", "taggable" => "foo" })
expect(page.taggable?).to be_falsey
end
end

context "definition has no 'taggable' key" do
it "should return false" do
page = build(:alchemy_page)
allow(page).to receive(:definition).and_return({ "name" => "standard" })
expect(page.taggable?).to be_falsey
end
end
end

describe "#unlock!" do
let(:page) { create(:alchemy_page, :locked) }

Expand Down
4 changes: 0 additions & 4 deletions spec/models/alchemy/picture_variant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

let(:alchemy_picture) { build_stubbed(:alchemy_picture, image_file: image_file) }

it_behaves_like "has image transformations" do
let(:picture) { described_class.new(alchemy_picture) }
end

subject { described_class.new(alchemy_picture, options).image }

let(:options) { Hash.new }
Expand Down
1 change: 0 additions & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

require_relative "support/calculation_examples"
require_relative "support/hint_examples"
require_relative "support/transformation_examples"
require_relative "support/capybara_helpers"
require_relative "support/custom_news_elements_finder"

Expand Down
67 changes: 0 additions & 67 deletions spec/support/transformation_examples.rb

This file was deleted.