Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMike Ricketts <rickettm@uk.ibm.com>2017-06-15 16:47:33 +0300
committerRémy Coutable <remy@rymai.me>2017-06-15 16:47:33 +0300
commit03b2ac659e43f39a4c6e646d0dbb5bd0a973cc38 (patch)
tree4d22335d7a35486280f063525540615f2add0a19 /app
parent039c375372f76050c48d6e5c39bb8322c8bf7dc5 (diff)
#13336 - display multiple messages in both the UI and git output
Diffstat (limited to 'app')
-rw-r--r--app/helpers/broadcast_messages_helper.rb2
-rw-r--r--app/models/broadcast_message.rb2
-rw-r--r--app/views/layouts/_broadcast.html.haml3
3 files changed, 4 insertions, 3 deletions
diff --git a/app/helpers/broadcast_messages_helper.rb b/app/helpers/broadcast_messages_helper.rb
index eb03ced67eb..0a15c29cfb5 100644
--- a/app/helpers/broadcast_messages_helper.rb
+++ b/app/helpers/broadcast_messages_helper.rb
@@ -1,5 +1,5 @@
module BroadcastMessagesHelper
- def broadcast_message(message = BroadcastMessage.current)
+ def broadcast_message(message)
return unless message.present?
content_tag :div, class: 'broadcast-message', style: broadcast_message_style(message) do
diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb
index cb40f33932a..944725d91c3 100644
--- a/app/models/broadcast_message.rb
+++ b/app/models/broadcast_message.rb
@@ -16,7 +16,7 @@ class BroadcastMessage < ActiveRecord::Base
def self.current
Rails.cache.fetch("broadcast_message_current", expires_in: 1.minute) do
- where("ends_at > :now AND starts_at <= :now", now: Time.zone.now).last
+ where('ends_at > :now AND starts_at <= :now', now: Time.zone.now).order([:created_at, :id]).to_a
end
end
diff --git a/app/views/layouts/_broadcast.html.haml b/app/views/layouts/_broadcast.html.haml
index 3a7e0929c16..bcd2f03e83c 100644
--- a/app/views/layouts/_broadcast.html.haml
+++ b/app/views/layouts/_broadcast.html.haml
@@ -1 +1,2 @@
-= broadcast_message
+- BroadcastMessage.current.each do |message|
+ = broadcast_message(message)