summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-09-28 13:57:08 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2018-06-05 16:20:21 +0200
commit67fe0a17d87a7a5380b41e04ef23212d5da637ba (patch)
tree2be846ca693640f73058ebd0dd1b39b06e3f2666 /lib
parent40ffa8401b96dda5f67ea699dbcca0ff64263810 (diff)
downloadgitlab-ce-67fe0a17d87a7a5380b41e04ef23212d5da637ba.tar.gz
call Gitlab::Favicon.status in serializer
this ways we can keep the `lib/gitlab/ci/status/*` classes to return the bare favicon name as it was before. also the favicon uploader versions are now have the same names as the stock favicons (+ `favicon_` prefix), which makes working with the status names easier.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/status/canceled.rb2
-rw-r--r--lib/gitlab/ci/status/created.rb2
-rw-r--r--lib/gitlab/ci/status/failed.rb2
-rw-r--r--lib/gitlab/ci/status/manual.rb2
-rw-r--r--lib/gitlab/ci/status/pending.rb2
-rw-r--r--lib/gitlab/ci/status/running.rb2
-rw-r--r--lib/gitlab/ci/status/skipped.rb2
-rw-r--r--lib/gitlab/ci/status/success.rb2
-rw-r--r--lib/gitlab/favicon.rb17
9 files changed, 18 insertions, 15 deletions
diff --git a/lib/gitlab/ci/status/canceled.rb b/lib/gitlab/ci/status/canceled.rb
index 0d71ff03163..e6195a60d4f 100644
--- a/lib/gitlab/ci/status/canceled.rb
+++ b/lib/gitlab/ci/status/canceled.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('canceled')
+ 'favicon_status_canceled'
end
end
end
diff --git a/lib/gitlab/ci/status/created.rb b/lib/gitlab/ci/status/created.rb
index de86191dfeb..846f00b83dd 100644
--- a/lib/gitlab/ci/status/created.rb
+++ b/lib/gitlab/ci/status/created.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('created')
+ 'favicon_status_created'
end
end
end
diff --git a/lib/gitlab/ci/status/failed.rb b/lib/gitlab/ci/status/failed.rb
index 20e2050108c..27ce85bd3ed 100644
--- a/lib/gitlab/ci/status/failed.rb
+++ b/lib/gitlab/ci/status/failed.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('failed')
+ 'favicon_status_failed'
end
end
end
diff --git a/lib/gitlab/ci/status/manual.rb b/lib/gitlab/ci/status/manual.rb
index 2c02ce6e870..fc387e2fd25 100644
--- a/lib/gitlab/ci/status/manual.rb
+++ b/lib/gitlab/ci/status/manual.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('manual')
+ 'favicon_status_manual'
end
end
end
diff --git a/lib/gitlab/ci/status/pending.rb b/lib/gitlab/ci/status/pending.rb
index 9122d11cfed..6780780db32 100644
--- a/lib/gitlab/ci/status/pending.rb
+++ b/lib/gitlab/ci/status/pending.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('pending')
+ 'favicon_status_pending'
end
end
end
diff --git a/lib/gitlab/ci/status/running.rb b/lib/gitlab/ci/status/running.rb
index 9bc48ec2c29..ee13905e46d 100644
--- a/lib/gitlab/ci/status/running.rb
+++ b/lib/gitlab/ci/status/running.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('running')
+ 'favicon_status_running'
end
end
end
diff --git a/lib/gitlab/ci/status/skipped.rb b/lib/gitlab/ci/status/skipped.rb
index b404118cd3b..0dbdc4de426 100644
--- a/lib/gitlab/ci/status/skipped.rb
+++ b/lib/gitlab/ci/status/skipped.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('skipped')
+ 'favicon_status_skipped'
end
end
end
diff --git a/lib/gitlab/ci/status/success.rb b/lib/gitlab/ci/status/success.rb
index be7e5d60b26..731013ec017 100644
--- a/lib/gitlab/ci/status/success.rb
+++ b/lib/gitlab/ci/status/success.rb
@@ -15,7 +15,7 @@ module Gitlab
end
def favicon
- Gitlab::Favicon.status('success')
+ 'favicon_status_success'
end
end
end
diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb
index 8802f58e31c..51a25b408ee 100644
--- a/lib/gitlab/favicon.rb
+++ b/lib/gitlab/favicon.rb
@@ -1,8 +1,8 @@
module Gitlab
class Favicon
class << self
- def default
- return custom_favicon_url(appearance_favicon.default.url) if appearance_favicon.exists?
+ def main
+ return custom_favicon_url(appearance_favicon.favicon_main.url) if appearance_favicon.exists?
return 'favicon-yellow.ico' if Gitlab::Utils.to_boolean(ENV['CANARY'])
return 'favicon-blue.ico' if Rails.env.development?
@@ -11,13 +11,16 @@ module Gitlab
def status(status_name)
if appearance_favicon.exists?
- custom_favicon_url(appearance_favicon.public_send("status_#{status_name}").url) # rubocop:disable GitlabSecurity/PublicSend
+ custom_favicon_url(appearance_favicon.public_send("#{status_name}").url) # rubocop:disable GitlabSecurity/PublicSend
else
- dir = 'ci_favicons'
- dir = File.join(dir, 'dev') if Rails.env.development?
- dir = File.join(dir, 'canary') if Gitlab::Utils.to_boolean(ENV['CANARY'])
+ path = File.join(
+ 'ci_favicons',
+ Rails.env.development? ? 'dev' : '',
+ Gitlab::Utils.to_boolean(ENV['CANARY']) ? 'canary' : '',
+ "#{status_name}.ico"
+ )
- File.join(dir, "favicon_status_#{status_name}.ico")
+ ActionController::Base.helpers.image_path(path)
end
end