diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-29 19:49:23 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-29 19:49:23 +0100 |
commit | f87afeff18337fa6205ee65710033b33a7c5aa66 (patch) | |
tree | 8c583c5c97d882767f9fc126a7e9d6fa76160ec1 /app/controllers/concerns | |
parent | 4b1d42bbc583b0884498bd129653587acc69ab0f (diff) | |
parent | 44edd1111f9ba6dd0dacffad23b54c0c85a723c4 (diff) | |
download | gitlab-ce-f87afeff18337fa6205ee65710033b33a7c5aa66.tar.gz |
Merge remote-tracking branch 'upstream/master' into pawel/connect_to_prometheus_through_proxy-30480
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r-- | app/controllers/concerns/group_tree.rb | 6 | ||||
-rw-r--r-- | app/controllers/concerns/issuable_actions.rb | 2 | ||||
-rw-r--r-- | app/controllers/concerns/with_performance_bar.rb | 15 |
3 files changed, 18 insertions, 5 deletions
diff --git a/app/controllers/concerns/group_tree.rb b/app/controllers/concerns/group_tree.rb index b569029283f..fafb10090ca 100644 --- a/app/controllers/concerns/group_tree.rb +++ b/app/controllers/concerns/group_tree.rb @@ -2,7 +2,11 @@ module GroupTree # rubocop:disable Gitlab/ModuleWithInstanceVariables def render_group_tree(groups) @groups = if params[:filter].present? - Gitlab::GroupHierarchy.new(groups.search(params[:filter])) + # We find the ancestors by ID of the search results here. + # Otherwise the ancestors would also have filters applied, + # which would cause them not to be preloaded. + group_ids = groups.search(params[:filter]).select(:id) + Gitlab::GroupHierarchy.new(Group.where(id: group_ids)) .base_and_ancestors else # Only show root groups if no parent-id is given diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index 74a4f437dc8..337957c366d 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -45,7 +45,7 @@ module IssuableActions } if issuable.edited? - response[:updated_at] = issuable.updated_at + response[:updated_at] = issuable.last_edited_at.to_time.iso8601 response[:updated_by_name] = issuable.last_edited_by.name response[:updated_by_path] = user_path(issuable.last_edited_by) end diff --git a/app/controllers/concerns/with_performance_bar.rb b/app/controllers/concerns/with_performance_bar.rb index 230bbe4b1aa..6a8b1a4de7b 100644 --- a/app/controllers/concerns/with_performance_bar.rb +++ b/app/controllers/concerns/with_performance_bar.rb @@ -6,13 +6,22 @@ module WithPerformanceBar end def peek_enabled? - return true if Rails.env.development? return false unless Gitlab::PerformanceBar.enabled?(current_user) if RequestStore.active? - RequestStore.fetch(:peek_enabled) { cookies[:perf_bar_enabled].present? } + RequestStore.fetch(:peek_enabled) { cookie_or_default_value } else - cookies[:perf_bar_enabled].present? + cookie_or_default_value + end + end + + private + + def cookie_or_default_value + if cookies[:perf_bar_enabled].present? + cookies[:perf_bar_enabled] == 'true' + else + cookies[:perf_bar_enabled] = 'true' if Rails.env.development? end end end |