Commit Graph

38 Commits

Author SHA1 Message Date
GitLab Bot 79d6dbbd46 Add latest changes from gitlab-org/gitlab@master 2022-02-17 15:18:08 +00:00
GitLab Bot f4e1a3641e Add latest changes from gitlab-org/gitlab@master 2022-02-17 03:16:49 +00:00
GitLab Bot b81fd57f3d Add latest changes from gitlab-org/gitlab@master 2021-04-22 09:09:45 +00:00
GitLab Bot 77d49e6a73 Add latest changes from gitlab-org/gitlab@master 2020-10-28 15:08:49 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 4a3ba3e5f2 Add latest changes from gitlab-org/gitlab@master 2020-05-22 09:08:09 +00:00
GitLab Bot b1b7c2f9a7 Add latest changes from gitlab-org/gitlab@master 2020-04-24 09:09:44 +00:00
GitLab Bot a8de96bff5 Add latest changes from gitlab-org/gitlab@master 2020-03-05 18:08:19 +00:00
GitLab Bot 27d91a6299 Add latest changes from gitlab-org/gitlab@master 2019-12-10 15:07:52 +00:00
GitLab Bot 556c79d6cc Add latest changes from gitlab-org/gitlab@master 2019-12-02 15:06:36 +00:00
Douglas Barbosa Alexandre da2f451f95
Set 2 weeks as the expiration time for the current broadcast message 2019-06-25 19:41:05 -03:00
Dmitriy Zaporozhets 15ba85ab8e
Remove some deprecated code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2019-06-07 14:32:31 +03:00
Thong Kuah a2cfc150ce Add # frozen_string_literal to spec/models
Adds `# frozen_string_literal: true` to spec/models ruby files
2019-04-01 14:37:54 +13:00
Douglas Barbosa Alexandre bcc988a6c6
Does not exclude message_html from attributes 2019-03-20 16:51:46 -03:00
Douglas Barbosa Alexandre 3d604a4c55
Refactor BroadcastMessage to use Gitlab::JsonCache 2018-12-19 15:15:06 -02:00
Stan Hu cde78f7f4e Avoid caching BroadcastMessage as an ActiveRecord object
When a Rails 4 host serializes a BroadcastMessage, it will serialize
`ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer`, which does
not exist in Rails 5. This will cause Error 500s on a Rails 5 reading
from this cache.

To make Rails 4 and 5 play well together, store the data as JSON and
construct the ActiveRecord objects from JSON.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55034
2018-12-08 22:06:07 -08:00
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