Commit 295fbeb2 authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch '252137-sync-sticky-header-issue-status' into 'master'

Fix sticky header issue status not syncing

See merge request gitlab-org/gitlab!45895
parents 0dffbcb4 6a5a0950
...@@ -217,8 +217,8 @@ export default { ...@@ -217,8 +217,8 @@ export default {
defaultErrorMessage() { defaultErrorMessage() {
return sprintf(s__('Error updating %{issuableType}'), { issuableType: this.issuableType }); return sprintf(s__('Error updating %{issuableType}'), { issuableType: this.issuableType });
}, },
isOpenStatus() { isClosed() {
return this.issuableStatus === IssuableStatus.Open; return this.issuableStatus === IssuableStatus.Closed;
}, },
pinnedLinkClasses() { pinnedLinkClasses() {
return this.showTitleBorder return this.showTitleBorder
...@@ -226,13 +226,13 @@ export default { ...@@ -226,13 +226,13 @@ export default {
: ''; : '';
}, },
statusIcon() { statusIcon() {
return this.isOpenStatus ? 'issue-open-m' : 'mobile-issue-close'; return this.isClosed ? 'mobile-issue-close' : 'issue-open-m';
}, },
statusText() { statusText() {
return IssuableStatusText[this.issuableStatus]; return IssuableStatusText[this.issuableStatus];
}, },
shouldShowStickyHeader() { shouldShowStickyHeader() {
return this.isStickyHeaderShowing && this.issuableType === IssuableType.Issue; return this.issuableType === IssuableType.Issue;
}, },
}, },
created() { created() {
...@@ -432,10 +432,14 @@ export default { ...@@ -432,10 +432,14 @@ export default {
:show-inline-edit-button="showInlineEditButton" :show-inline-edit-button="showInlineEditButton"
/> />
<gl-intersection-observer @appear="hideStickyHeader" @disappear="showStickyHeader"> <gl-intersection-observer
v-if="shouldShowStickyHeader"
@appear="hideStickyHeader"
@disappear="showStickyHeader"
>
<transition name="issuable-header-slide"> <transition name="issuable-header-slide">
<div <div
v-if="shouldShowStickyHeader" v-if="isStickyHeaderShowing"
class="issue-sticky-header gl-fixed gl-z-index-3 gl-bg-white gl-border-1 gl-border-b-solid gl-border-b-gray-100 gl-py-3" class="issue-sticky-header gl-fixed gl-z-index-3 gl-bg-white gl-border-1 gl-border-b-solid gl-border-b-gray-100 gl-py-3"
data-testid="issue-sticky-header" data-testid="issue-sticky-header"
> >
...@@ -444,7 +448,7 @@ export default { ...@@ -444,7 +448,7 @@ export default {
> >
<p <p
class="issuable-status-box status-box gl-my-0" class="issuable-status-box status-box gl-my-0"
:class="[isOpenStatus ? 'status-box-open' : 'status-box-issue-closed']" :class="[isClosed ? 'status-box-issue-closed' : 'status-box-open']"
> >
<gl-icon :name="statusIcon" class="gl-display-block d-sm-none gl-h-6!" /> <gl-icon :name="statusIcon" class="gl-display-block d-sm-none gl-h-6!" />
<span class="gl-display-none d-sm-block">{{ statusText }}</span> <span class="gl-display-none d-sm-block">{{ statusText }}</span>
......
import { __ } from '~/locale'; import { __ } from '~/locale';
export const IssuableStatus = { export const IssuableStatus = {
Open: 'opened',
Closed: 'closed', Closed: 'closed',
Open: 'opened',
Reopened: 'reopened',
}; };
export const IssuableStatusText = { export const IssuableStatusText = {
[IssuableStatus.Open]: __('Open'),
[IssuableStatus.Closed]: __('Closed'), [IssuableStatus.Closed]: __('Closed'),
[IssuableStatus.Open]: __('Open'),
[IssuableStatus.Reopened]: __('Open'),
}; };
export const IssuableType = { export const IssuableType = {
......
import Vue from 'vue'; import Vue from 'vue';
import issuableApp from './components/app.vue'; import { mapGetters } from 'vuex';
import IssuableApp from './components/app.vue';
export default function initIssuableApp(issuableData) { export default function initIssuableApp(issuableData, store) {
return new Vue({ return new Vue({
el: document.getElementById('js-issuable-app'), el: document.getElementById('js-issuable-app'),
components: { store,
issuableApp, computed: {
...mapGetters(['getNoteableData']),
}, },
render(createElement) { render(createElement) {
return createElement('issuable-app', { return createElement(IssuableApp, {
props: issuableData, props: {
...issuableData,
issuableStatus: this.getNoteableData?.state,
},
}); });
}, },
}); });
......
...@@ -24,7 +24,7 @@ export default function() { ...@@ -24,7 +24,7 @@ export default function() {
initIncidentApp(issuableData); initIncidentApp(issuableData);
break; break;
case IssuableType.Issue: case IssuableType.Issue:
initIssueApp(issuableData); initIssueApp(issuableData, store);
break; break;
default: default:
break; break;
......
...@@ -274,7 +274,6 @@ module IssuablesHelper ...@@ -274,7 +274,6 @@ module IssuablesHelper
canUpdate: can?(current_user, :"update_#{issuable.to_ability_name}", issuable), canUpdate: can?(current_user, :"update_#{issuable.to_ability_name}", issuable),
canDestroy: can?(current_user, :"destroy_#{issuable.to_ability_name}", issuable), canDestroy: can?(current_user, :"destroy_#{issuable.to_ability_name}", issuable),
issuableRef: issuable.to_reference, issuableRef: issuable.to_reference,
issuableStatus: issuable.state,
markdownPreviewPath: preview_markdown_path(parent), markdownPreviewPath: preview_markdown_path(parent),
markdownDocsPath: help_page_path('user/markdown'), markdownDocsPath: help_page_path('user/markdown'),
lockVersion: issuable.lock_version, lockVersion: issuable.lock_version,
......
---
title: Fix sticky header issue status not syncing
merge_request: 45895
author:
type: fixed
...@@ -27,7 +27,6 @@ RSpec.describe IssuablesHelper do ...@@ -27,7 +27,6 @@ RSpec.describe IssuablesHelper do
canDestroy: true, canDestroy: true,
canAdmin: true, canAdmin: true,
issuableRef: "&#{epic.iid}", issuableRef: "&#{epic.iid}",
issuableStatus: "opened",
markdownPreviewPath: "/groups/#{@group.full_path}/preview_markdown", markdownPreviewPath: "/groups/#{@group.full_path}/preview_markdown",
markdownDocsPath: '/help/user/markdown', markdownDocsPath: '/help/user/markdown',
issuableTemplateNamesPath: '', issuableTemplateNamesPath: '',
......
...@@ -5,6 +5,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -5,6 +5,7 @@ import axios from '~/lib/utils/axios_utils';
import initIssuableApp from '~/issue_show/issue'; import initIssuableApp from '~/issue_show/issue';
import * as parseData from '~/issue_show/utils/parse_data'; import * as parseData from '~/issue_show/utils/parse_data';
import { appProps } from './mock_data'; import { appProps } from './mock_data';
import createStore from '~/notes/stores';
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock.onGet().reply(200); mock.onGet().reply(200);
...@@ -30,7 +31,7 @@ describe('Issue show index', () => { ...@@ -30,7 +31,7 @@ describe('Issue show index', () => {
}); });
const issuableData = parseData.parseIssuableData(); const issuableData = parseData.parseIssuableData();
initIssuableApp(issuableData); initIssuableApp(issuableData, createStore());
await waitForPromises(); await waitForPromises();
......
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