Commit Graph

35 Commits

Author SHA1 Message Date
GitLab Bot 59712a466f Add latest changes from gitlab-org/gitlab@master 2023-07-05 21:08:43 +00:00
GitLab Bot db19df2373 Add latest changes from gitlab-org/gitlab@master 2022-03-16 15:07:32 +00:00
GitLab Bot 41482e5dce Add latest changes from gitlab-org/gitlab@master 2022-02-14 09:13:38 +00:00
GitLab Bot 6a5b78ac69 Add latest changes from gitlab-org/gitlab@master 2021-12-07 03:12:22 +00:00
GitLab Bot a8c1bc6f75 Add latest changes from gitlab-org/gitlab@master 2021-05-25 15:10:33 +00:00
GitLab Bot 2e9f877e8b Add latest changes from gitlab-org/gitlab@master 2021-02-22 09:10:46 +00:00
GitLab Bot d8714cf67c Add latest changes from gitlab-org/gitlab@master 2021-02-02 00:09:14 +00:00
GitLab Bot adfb0e182c Add latest changes from gitlab-org/gitlab@master 2020-09-01 15:10:39 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 2eda658f34 Add latest changes from gitlab-org/gitlab@master 2020-04-15 21:09:18 +00:00
GitLab Bot eb1f5a3e08 Add latest changes from gitlab-org/gitlab@master 2020-02-17 18:09:00 +00:00
Reuben Pereira af4a597d3f Save instance administration project id in DB
- This will make it easy to identify the project even if admins change
the name of the project or move it.
2019-08-07 18:40:36 +00:00
Thong Kuah f540ffcef6 Add frozen_string_literal to spec/lib (part 1)
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-07-26 13:25:07 +12:00
Heinrich Lee Yu aeb67dd489 Upgrade to Rails 5.2
Updates changed method names and fixes spec failures
2019-07-12 10:15:31 +08:00
Lin Jen-Shin 43afcd0333 Apply suggestion to spec/lib/gitlab/current_settings_spec.rb 2019-03-28 07:05:12 +00:00
Rémy Coutable 90718774e1
Use a Gitlab::FakeApplicationSettings when migrations are pending
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-03-26 23:02:57 +01:00
Takuya Noguchi a565f3d88d Fix misspellings in app/spec executable lines
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2019-02-27 22:41:34 +09:00
Bob Van Landuyt 7e55a227a5 Revert "Merge branch 'use_gitlab_current_settings' into 'master'"
This reverts merge request !25370
2019-02-19 12:58:05 +00:00
Thong Kuah 8a1b6041c8 Use Gitlab::CurrentSettings in UrlValidator
Gitlab::CurrentSettings will create ApplicationSetting.current if not
present which means we don't have to use `&.`. We can also more easily
use stub_application_setting in specs
2019-02-19 22:04:08 +13:00
Rémy Coutable cc06bb2c6e
Simplify spec/lib/gitlab/current_settings_spec.rb a bit
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-12-19 11:24:55 +01:00
Lin Jen-Shin 0ff27ce059
Method `create_from_defaults` will never give nil 2018-12-19 11:24:54 +01:00
Rémy Coutable 71672dfa6a
Return an ApplicationSetting in CurrentSettings
This replaces the use of fake_application_settings with
`::ApplicationSetting.build`_from_defaults. The reason is that
`fake_application_settings` doesn't have the custom accessors that
`ApplicationSetting` has, e.g. `#commit_email_hostname`, thus this
can lead to unexpected `nil` values which comes from the database
column instead of `.default_commit_email_hostname` returned by
`ApplicationSetting#commit_email_hostname`.

Using `::ApplicationSetting.build_from_defaults` should be safe as it
doesn't try to `INSERT` a DB record, in contrary to
`::ApplicationSetting.create_from_defaults` which we used to use, and
which created issues that the introduction of
`fake_application_settings` tried to resolve (575dced5).

Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-12-19 11:24:53 +01:00
Rémy Coutable 6afe6fa6bc
Make Gitlab::CurrentSettings.current_application_settings return cached settings early if they exist without issuing any DB query
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-06-07 17:23:49 +02:00
Rémy Coutable 2bdf6edefa
Simplify Gitlab::CurrentSettings now that the logic is in CacheableAttributes
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-05-23 16:14:43 +02:00
Mario de la Ossa eaada9d706 use Gitlab::UserSettings directly as a singleton instead of including/extending it 2018-02-02 18:39:55 +00:00
Winnie Hellmann beeed14f04 Fix failure in current_settings_spec.rb 2017-10-20 18:33:00 +00:00
Nick Thomas aeb2869f66 Prevent bad data being added to application settings when Redis is unavailable 2017-07-10 15:40:51 +01:00
Stan Hu 575dced5d7 If migrations are pending, make CurrentSettings use existing values and populate missing columns with defaults
master was failing because `ApplicationSetting.create_from_defaults` attempted
to write to a column that did not exist in the database. This occurred in a
`rake db:migrate` task, which was unable to perform the migration that would
have added the missing column in the first place.

In 9.3 RC2, we also had a bug where password sign-ins were disabled because
there were many pending migrations. The problem occurred because
`fake_application_settings` was being returned with an OpenStruct that did not
include the predicate method `signup_enabled?`. As a result, the value would
erroneously return `nil` instead of `true`. This commit uses the values of the
defaults to mimic this behavior.

This commit also refactors some of the logic to be clearer.
2017-06-19 09:54:48 -07:00
Paul Charlton d93352825a redesign caching of application settings 2017-06-06 16:48:10 +00:00
Robert Speicher d49768296c Auto-correct `RSpec/DescribedClass` violations 2017-05-01 11:13:33 -04:00
Grzegorz Bizon 632c2939bb Revert "Merge branch 'revert-9cac0317' into 'master' "
This reverts commit c20934869f, reversing
changes made to 4b7ec44b91.
2017-01-23 16:35:24 +01:00
Grzegorz Bizon baeaa97ef4 Revert "Merge branch 'dont-persist-application-settings-in-test-env' into 'master'"
This reverts merge request !8573
2017-01-21 22:55:35 +00:00
Rémy Coutable f6cc29ed83 Don't persist ApplicationSetting in test env
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-15 01:07:29 -05:00
Stan Hu d10642a4b8 Handle case when Redis cache returns an empty setting 2016-06-29 14:28:41 -07:00
Stan Hu c600cf8348 Fix database migrations when Redis is not running
If Redis were not running or USE_DB were set to false, the
application settings retrieval would fail completely. This
change only attempts to use the cache if the system actually
wants to connect to the DB and rescues any failures in talking to
Redis.

Closes #17557
2016-06-29 14:04:59 -07:00