diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue')
-rw-r--r-- | app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue b/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue index b713b0f960c..20667e695ce 100644 --- a/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue +++ b/app/assets/javascripts/sidebar/components/assignees/collapsed_assignee_list.vue @@ -1,11 +1,30 @@ <script> import { GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { __, sprintf } from '~/locale'; +import { isUserBusy } from '~/set_status_modal/utils'; import CollapsedAssignee from './collapsed_assignee.vue'; const DEFAULT_MAX_COUNTER = 99; const DEFAULT_RENDER_COUNT = 5; +const generateCollapsedAssigneeTooltip = ({ renderUsers, allUsers, tooltipTitleMergeStatus }) => { + const names = renderUsers.map(({ name, availability }) => { + if (availability && isUserBusy(availability)) { + return sprintf(__('%{name} (Busy)'), { name }); + } + return name; + }); + + if (!allUsers.length) { + return __('Assignee(s)'); + } + if (allUsers.length > names.length) { + names.push(sprintf(__('+ %{amount} more'), { amount: allUsers.length - names.length })); + } + const text = names.join(', '); + return tooltipTitleMergeStatus ? `${text} (${tooltipTitleMergeStatus})` : text; +}; + export default { directives: { GlTooltip: GlTooltipDirective, @@ -74,19 +93,11 @@ export default { tooltipTitle() { const maxRender = Math.min(DEFAULT_RENDER_COUNT, this.users.length); const renderUsers = this.users.slice(0, maxRender); - const names = renderUsers.map((u) => u.name); - - if (!this.users.length) { - return __('Assignee(s)'); - } - - if (this.users.length > names.length) { - names.push(sprintf(__('+ %{amount} more'), { amount: this.users.length - names.length })); - } - - const text = names.join(', '); - - return this.tooltipTitleMergeStatus ? `${text} (${this.tooltipTitleMergeStatus})` : text; + return generateCollapsedAssigneeTooltip({ + renderUsers, + allUsers: this.users, + tooltipTitleMergeStatus: this.tooltipTitleMergeStatus, + }); }, tooltipOptions() { |