Commit f066c8fd authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'kp-add-upvote-downvote-counts-epics-list' into 'master'

Fix missing upvote/downvote counts on Epics list

See merge request gitlab-org/gitlab!79844
parents 0e114180 c3000afb
...@@ -121,7 +121,10 @@ export default { ...@@ -121,7 +121,10 @@ export default {
}, },
showIssuableMeta() { showIssuableMeta() {
return Boolean( return Boolean(
this.hasSlotContents('status') || this.showDiscussions || this.issuable.assignees, this.hasSlotContents('status') ||
this.hasSlotContents('statistics') ||
this.showDiscussions ||
this.issuable.assignees,
); );
}, },
issuableNotesLink() { issuableNotesLink() {
......
<script> <script>
import { GlButton, GlIcon } from '@gitlab/ui'; import { GlButton, GlIcon, GlTooltipDirective } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import EpicsFilteredSearchMixin from 'ee/roadmap/mixins/filtered_search_mixin'; import EpicsFilteredSearchMixin from 'ee/roadmap/mixins/filtered_search_mixin';
...@@ -30,6 +30,9 @@ export default { ...@@ -30,6 +30,9 @@ export default {
EpicsListEmptyState, EpicsListEmptyState,
EpicsListBulkEditSidebar, EpicsListBulkEditSidebar,
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [EpicsFilteredSearchMixin], mixins: [EpicsFilteredSearchMixin],
inject: [ inject: [
'canCreateEpic', 'canCreateEpic',
...@@ -299,6 +302,28 @@ export default { ...@@ -299,6 +302,28 @@ export default {
<gl-icon name="calendar" /> <gl-icon name="calendar" />
{{ epicTimeframe(issuable) }} {{ epicTimeframe(issuable) }}
</template> </template>
<template #statistics="{ issuable = {} }">
<li
v-if="issuable.upvotes"
v-gl-tooltip
class="issuable-upvotes gl-display-none gl-sm-display-block"
:title="__('Upvotes')"
data-testid="issuable-upvotes"
>
<gl-icon name="thumb-up" />
{{ issuable.upvotes }}
</li>
<li
v-if="issuable.downvotes"
v-gl-tooltip
class="issuable-downvotes gl-display-none gl-sm-display-block"
:title="__('Downvotes')"
data-testid="issuable-downvotes"
>
<gl-icon name="thumb-down" />
{{ issuable.downvotes }}
</li>
</template>
<template #empty-state> <template #empty-state>
<epics-list-empty-state :current-state="currentState" :epics-count="epicsCount" /> <epics-list-empty-state :current-state="currentState" :epics-count="epicsCount" />
</template> </template>
......
...@@ -45,6 +45,8 @@ query groupEpics( ...@@ -45,6 +45,8 @@ query groupEpics(
webUrl webUrl
userDiscussionsCount @include(if: $isSignedIn) userDiscussionsCount @include(if: $isSignedIn)
confidential confidential
upvotes
downvotes
group { group {
id id
fullPath fullPath
......
...@@ -24,6 +24,8 @@ RSpec.describe 'epics list', :js do ...@@ -24,6 +24,8 @@ RSpec.describe 'epics list', :js do
let!(:epic2) { create(:epic, group: group, start_date: '2020-12-15') } let!(:epic2) { create(:epic, group: group, start_date: '2020-12-15') }
let!(:epic3) { create(:epic, group: group, end_date: '2021-1-15') } let!(:epic3) { create(:epic, group: group, end_date: '2021-1-15') }
let!(:award_emoji_star) { create(:award_emoji, name: 'star', user: user, awardable: epic1) } let!(:award_emoji_star) { create(:award_emoji, name: 'star', user: user, awardable: epic1) }
let!(:award_emoji_upvote) { create(:award_emoji, :upvote, user: user, awardable: epic1) }
let!(:award_emoji_downvote) { create(:award_emoji, :downvote, user: user, awardable: epic2) }
shared_examples 'epic list' do shared_examples 'epic list' do
it 'renders epics list', :aggregate_failures do it 'renders epics list', :aggregate_failures do
...@@ -35,11 +37,16 @@ RSpec.describe 'epics list', :js do ...@@ -35,11 +37,16 @@ RSpec.describe 'epics list', :js do
end end
it 'renders epics item with metadata', :aggregate_failures do it 'renders epics item with metadata', :aggregate_failures do
page.within('.issuable-list .issue:first-of-type') do page.within(".issuable-list #issuable_#{epic2.id}.issue") do
expect(page).to have_link(epic2.title) expect(page).to have_link(epic2.title)
expect(page).to have_text("&#{epic2.iid}") expect(page).to have_text("&#{epic2.iid}")
expect(page).to have_selector('.issuable-meta [data-testid="issuable-downvotes"]')
expect(page).to have_text("created just now by #{epic2.author.name}") expect(page).to have_text("created just now by #{epic2.author.name}")
end end
page.within(".issuable-list #issuable_#{epic1.id}.issue") do
expect(page).to have_selector('.issuable-meta [data-testid="issuable-upvotes"]')
end
end end
it 'renders epic item timeframe', :aggregate_failures do it 'renders epic item timeframe', :aggregate_failures do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment