Commit graph

22 commits

Author SHA1 Message Date
Michael Kozono
1ce0595b18 Backport: Propagate broadcast messages to secondaries 2018-04-11 11:28:44 -07:00
Yorick Peterse
e0b589f161
Fix caching of future broadcast messages
This changes the caching mechanism so we cache both current _and_ future
broadcast messages, then manually filter out those we don't want to
display. This ensures we don't need any additional queries while still
being able to display the right messages at the right time.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36661
2017-08-21 17:58:37 +02:00
Yorick Peterse
a5c8a52782
Better caching and indexing of broadcast messages
Caching of BroadcastMessage instances has been changed so a cache stays
valid as long as the default cache expiration time permits, instead of
the cache being expired after 1 minute. When modifying broadcast
messages the cache is flushed automatically.

To remove the need for performing sequence scans on the
"broadcast_messages" table we also add an index on (starts_at, ends_at,
id), permitting PostgreSQL to use an index scan to get all necessary
data.

Finally this commit adds a few NOT NULL constraints to the table to
match the Rails validations.

Fixes gitlab-org/gitlab-ce#31706
2017-08-11 16:43:30 +02:00
Rémy Coutable
cddc5cacfb Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Rémy Coutable
ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Mike Ricketts
03b2ac659e #13336 - display multiple messages in both the UI and git output 2017-06-15 13:47:33 +00:00
Semyon Pupkov
cad3ad266a Use build instead create in BroadcastMessage model spec 2016-11-19 03:22:02 +05:00
Lin Jen-Shin
c627dbc8fb Now we already included it in spec_helper.rb 2016-08-20 00:11:03 +08:00
tiagonbotelho
1d268a89de adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
Jeroen van Baarsen
f1479b56b7
Remove the annotate gem and delete old annotations
In 8278b763d9 the default behaviour of annotation
has changes, which was causing a lot of noise in diffs. We decided in #17382
that it is better to get rid of the whole annotate gem, and instead let people
look at schema.rb for the columns in a table.

Fixes: #17382
2016-05-09 18:00:28 +02:00
Robert Speicher
843662821d Move BroadcastMessage#status to a helper since it's presentational 2016-01-13 11:49:59 -05:00
Robert Speicher
df496fcaf0 Update BroadcastMessage model
- Adds default values for `color` and `font` attributes
- Adds `active?`, `started?`, `ended?`, and 'status' methods
2016-01-13 11:34:58 -05:00
Robert Speicher
6ae39c2cd1 Remove alert_type attribute from BroadcastMessage 2016-01-13 11:34:57 -05:00
Douwe Maan
1e8d703a85 Tag model specs 2015-12-09 10:50:51 +01:00
Robert Speicher
e48391b813 Add custom ColorValidator 2015-12-07 16:57:26 -05:00
Guilherme Garnier
848d7b2a2b Fix rubocop warnings in spec/models 2015-10-03 01:48:54 -05:00
Jeroen van Baarsen
0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
Dmitriy Zaporozhets
36f861f1b1
Re-annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-09 15:05:03 +03:00
Andrew Tomaka
0760ba3efb Customization and previewing of broadcast messages 2013-12-18 17:43:45 -05:00
Dmitriy Zaporozhets
201d489780
Annotate
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-13 14:10:03 +02:00
Dmitriy Zaporozhets
c5b667351a
Show broadcast message to users
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-12 15:08:20 +02:00
Dmitriy Zaporozhets
f1ecf53c1e
Broadcast message model + migrations
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-12 13:47:28 +02:00