diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-28 12:09:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-28 12:09:44 +0000 |
commit | c74b7b5e4345702a1d59c72d923c3580ef157a59 (patch) | |
tree | 0d6cc261341fa36babe44e497dc26153da611b7b /app/models | |
parent | 0f59ad0c29c8679957c716317c842f606177f223 (diff) | |
download | gitlab-ce-c74b7b5e4345702a1d59c72d923c3580ef157a59.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/pipeline.rb | 16 | ||||
-rw-r--r-- | app/models/wiki.rb | 8 |
2 files changed, 17 insertions, 7 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index a2797f494ba..1f3d47997f7 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -393,16 +393,18 @@ module Ci false end - ## - # TODO We do not completely switch to persisted stages because of - # race conditions with setting statuses gitlab-foss#23257. - # def ordered_stages - return legacy_stages unless complete? - - if Feature.enabled?('ci_pipeline_persisted_stages', default_enabled: true) + if Feature.enabled?(:ci_atomic_processing, project, default_enabled: false) + # The `Ci::Stage` contains all up-to date data + # as atomic processing updates all data in-bulk + stages + elsif Feature.enabled?(:ci_pipeline_persisted_stages, default_enabled: true) && complete? + # The `Ci::Stage` contains up-to date data only for `completed` pipelines + # this is due to asynchronous processing of pipeline, and stages possibly + # not updated inline with processing of pipeline stages else + # In other cases, we need to calculate stages dynamically legacy_stages end end diff --git a/app/models/wiki.rb b/app/models/wiki.rb index a1f779ca282..f91af9b6d83 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -93,6 +93,14 @@ class Wiki end end + def sidebar_entries(limit: Gitlab::WikiPages::MAX_SIDEBAR_PAGES, **options) + pages = list_pages(**options.merge(limit: limit + 1)) + limited = pages.size > limit + pages = pages.first(limit) if limited + + [WikiPage.group_by_directory(pages), limited] + end + # Finds a page within the repository based on a tile # or slug. # |