Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove `register_color_scheme` api (#28777)

Jarek Radosz02f8396cfced
diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb
index 38199ed4d72..c657a463131 100644
--- a/lib/plugin/instance.rb
+++ b/lib/plugin/instance.rb
@@ -49,7 +49,6 @@ class Plugin::Instance
# Memoized array readers
%i[
assets
- color_schemes
initializers
javascripts
locales
@@ -593,12 +592,6 @@ class Plugin::Instance
end
def notify_after_initialize
- color_schemes.each do |c|
- unless ColorScheme.where(name: c[:name]).exists?
- ColorScheme.create_from_base(name: c[:name], colors: c[:colors])
- end
- end
-
initializers.each do |callback|
begin
callback.call(self)
@@ -732,10 +725,6 @@ class Plugin::Instance
service_workers << [File.join(File.dirname(path), "assets", file), opts]
end
- def register_color_scheme(name, colors)
- color_schemes << { name: name, colors: colors }
- end
-
def register_seed_data(key, value)
seed_data[key] = value
end
diff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rb
index eb2cc98902b..12179700de2 100644
--- a/spec/lib/plugin/instance_spec.rb
+++ b/spec/lib/plugin/instance_spec.rb
@@ -444,26 +444,6 @@ TEXT
end
end
- describe "#register_color_scheme" do
- it "can add a color scheme for the first time" do
- plugin = Plugin::Instance.new nil, "/tmp/test.rb"
- expect {
- plugin.register_color_scheme("Purple", primary: "EEE0E5")
- plugin.notify_after_initialize
- }.to change { ColorScheme.count }.by(1)
- expect(ColorScheme.where(name: "Purple")).to be_present
- end
-
- it "doesn't add the same color scheme twice" do
- Fabricate(:color_scheme, name: "Halloween")
- plugin = Plugin::Instance.new nil, "/tmp/test.rb"
- expect {
- plugin.register_color_scheme("Halloween", primary: "EEE0E5")
- plugin.notify_after_initialize
- }.to_not change { ColorScheme.count }
- end
- end
-
describe ".register_seedfu_fixtures" do
it "should add the new path to SeedFu's fixtures path" do
plugin = Plugin::Instance.new nil, "/tmp/test.rb"