parent
78ddc82952
commit
2e48c43546
|
@ -134,10 +134,10 @@ class Theme < ActiveRecord::Base
|
||||||
|
|
||||||
all_ids = [parent, *components]
|
all_ids = [parent, *components]
|
||||||
|
|
||||||
enabled_ids = Theme.where(id: all_ids).includes(:remote_theme)
|
disabled_ids = Theme.where(id: all_ids).includes(:remote_theme)
|
||||||
.select(&:enabled?).pluck(:id)
|
.reject(&:enabled?).pluck(:id)
|
||||||
|
|
||||||
all_ids & enabled_ids # Maintain ordering using intersection
|
all_ids - disabled_ids
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,11 @@ describe Stylesheet::Manager do
|
||||||
expect(link).not_to eq("")
|
expect(link).not_to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "still returns something for no themes" do
|
||||||
|
link = Stylesheet::Manager.stylesheet_link_tag(:desktop, 'all', [])
|
||||||
|
expect(link).not_to eq("")
|
||||||
|
end
|
||||||
|
|
||||||
it 'can correctly compile theme css' do
|
it 'can correctly compile theme css' do
|
||||||
theme = Fabricate(:theme)
|
theme = Fabricate(:theme)
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,11 @@ describe Theme do
|
||||||
expect(Theme.transform_ids([theme.id])).to be_empty
|
expect(Theme.transform_ids([theme.id])).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "#transform_ids works with nil values" do
|
||||||
|
# Used in safe mode
|
||||||
|
expect(Theme.transform_ids([nil])).to eq([nil])
|
||||||
|
end
|
||||||
|
|
||||||
it "doesn't allow multi-level theme components" do
|
it "doesn't allow multi-level theme components" do
|
||||||
grandchild = Fabricate(:theme, user: user)
|
grandchild = Fabricate(:theme, user: user)
|
||||||
grandparent = Fabricate(:theme, user: user)
|
grandparent = Fabricate(:theme, user: user)
|
||||||
|
|
Loading…
Reference in New Issue