diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/helpers/issuables_helper.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/helpers/issuables_helper.rb')
-rw-r--r-- | app/helpers/issuables_helper.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index d8ba530f3f6..f3cc46216e5 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -3,6 +3,7 @@ module IssuablesHelper include GitlabRoutingHelper include IssuablesDescriptionTemplatesHelper + include ::Sidebars::Concerns::HasPill def sidebar_gutter_toggle_icon content_tag(:span, class: 'js-sidebar-toggle-container', data: { is_expanded: !sidebar_gutter_collapsed? }) do @@ -187,19 +188,18 @@ module IssuablesHelper end def issuables_state_counter_text(issuable_type, state, display_count) - titles = { - opened: "Open" - } - + titles = { opened: "Open" } state_title = titles[state] || state.to_s.humanize html = content_tag(:span, state_title) return html.html_safe unless display_count count = issuables_count_for_state(issuable_type, state) - if count != -1 - html << " " << content_tag(:span, number_with_delimiter(count), class: 'badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm') + html << " " << content_tag(:span, + format_count(issuable_type, count, Gitlab::IssuablesCountForState::THRESHOLD), + class: 'badge badge-muted badge-pill gl-badge gl-tab-counter-badge sm' + ) end html.html_safe @@ -256,7 +256,8 @@ module IssuablesHelper issueType: issuable.issue_type, zoomMeetingUrl: ZoomMeeting.canonical_meeting_url(issuable), sentryIssueIdentifier: SentryIssue.find_by(issue: issuable)&.sentry_issue_identifier, # rubocop:disable CodeReuse/ActiveRecord - iid: issuable.iid.to_s + iid: issuable.iid.to_s, + isHidden: issue_hidden?(issuable) } end @@ -283,7 +284,9 @@ module IssuablesHelper end def issuables_count_for_state(issuable_type, state) - Gitlab::IssuablesCountForState.new(finder)[state] + store_in_cache = parent.is_a?(Group) ? parent.cached_issues_state_count_enabled? : false + + Gitlab::IssuablesCountForState.new(finder, store_in_redis_cache: store_in_cache)[state] end def close_issuable_path(issuable) @@ -370,7 +373,7 @@ module IssuablesHelper is_collapsed: is_collapsed, track_label: "right_sidebar", track_property: "update_todo", - track_event: "click_button", + track_action: "click_button", track_value: "" } end @@ -437,6 +440,14 @@ module IssuablesHelper def parent @project || @group end + + def format_count(issuable_type, count, threshold) + if issuable_type == :issues && parent.is_a?(Group) && parent.cached_issues_state_count_enabled? + format_cached_count(threshold, count) + else + number_with_delimiter(count) + end + end end IssuablesHelper.prepend_mod_with('IssuablesHelper') |