Commit 5cad4bd7 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ph/42724/removeAsyncMRWidgetFlag' into 'master'

Remove async merge request widget feature flag

Closes #42724

See merge request gitlab-org/gitlab!23594
parents ae2a6b64 2cee77dc
...@@ -4,6 +4,7 @@ import { mapActions, mapState, mapGetters } from 'vuex'; ...@@ -4,6 +4,7 @@ import { mapActions, mapState, mapGetters } from 'vuex';
import store from 'ee_else_ce/mr_notes/stores'; import store from 'ee_else_ce/mr_notes/stores';
import notesApp from '../notes/components/notes_app.vue'; import notesApp from '../notes/components/notes_app.vue';
import discussionKeyboardNavigator from '../notes/components/discussion_keyboard_navigator.vue'; import discussionKeyboardNavigator from '../notes/components/discussion_keyboard_navigator.vue';
import initWidget from '../vue_merge_request_widget';
export default () => { export default () => {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
...@@ -32,11 +33,22 @@ export default () => { ...@@ -32,11 +33,22 @@ export default () => {
...mapState({ ...mapState({
activeTab: state => state.page.activeTab, activeTab: state => state.page.activeTab,
}), }),
isShowTabActive() {
return this.activeTab === 'show';
},
}, },
watch: { watch: {
discussionTabCounter() { discussionTabCounter() {
this.updateDiscussionTabCounter(); this.updateDiscussionTabCounter();
}, },
isShowTabActive: {
handler(newVal) {
if (newVal) {
initWidget();
}
},
immediate: true,
},
}, },
created() { created() {
this.setActiveTab(window.mrTabs.getCurrentAction()); this.setActiveTab(window.mrTabs.getCurrentAction());
...@@ -69,7 +81,7 @@ export default () => { ...@@ -69,7 +81,7 @@ export default () => {
noteableData: this.noteableData, noteableData: this.noteableData,
notesData: this.notesData, notesData: this.notesData,
userData: this.currentUserData, userData: this.currentUserData,
shouldShow: this.activeTab === 'show', shouldShow: this.isShowTabActive,
helpPagePath: this.helpPagePath, helpPagePath: this.helpPagePath,
}, },
}), }),
......
...@@ -7,7 +7,6 @@ import initPipelines from '~/commit/pipelines/pipelines_bundle'; ...@@ -7,7 +7,6 @@ import initPipelines from '~/commit/pipelines/pipelines_bundle';
import initVueIssuableSidebarApp from '~/issuable_sidebar/sidebar_bundle'; import initVueIssuableSidebarApp from '~/issuable_sidebar/sidebar_bundle';
import initSourcegraph from '~/sourcegraph'; import initSourcegraph from '~/sourcegraph';
import initPopover from '~/mr_tabs_popover'; import initPopover from '~/mr_tabs_popover';
import initWidget from '../../../vue_merge_request_widget';
export default function() { export default function() {
new ZenMode(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new
...@@ -20,7 +19,6 @@ export default function() { ...@@ -20,7 +19,6 @@ export default function() {
new ShortcutsIssuable(true); // eslint-disable-line no-new new ShortcutsIssuable(true); // eslint-disable-line no-new
handleLocationHash(); handleLocationHash();
howToMerge(); howToMerge();
initWidget();
initSourcegraph(); initSourcegraph();
const tabHighlightEl = document.querySelector('.js-tabs-feature-highlight'); const tabHighlightEl = document.querySelector('.js-tabs-feature-highlight');
......
...@@ -5,6 +5,8 @@ import Translate from '../vue_shared/translate'; ...@@ -5,6 +5,8 @@ import Translate from '../vue_shared/translate';
Vue.use(Translate); Vue.use(Translate);
export default () => { export default () => {
if (gl.mrWidget) return;
gl.mrWidgetData.gitlabLogo = gon.gitlab_logo; gl.mrWidgetData.gitlabLogo = gon.gitlab_logo;
const vm = new Vue(MrWidgetOptions); const vm = new Vue(MrWidgetOptions);
......
...@@ -135,15 +135,11 @@ export default { ...@@ -135,15 +135,11 @@ export default {
}, },
}, },
mounted() { mounted() {
if (gon && gon.features && gon.features.asyncMrWidget) { MRWidgetService.fetchInitialData()
MRWidgetService.fetchInitialData() .then(({ data }) => this.initWidget(data))
.then(({ data }) => this.initWidget(data)) .catch(() =>
.catch(() => createFlash(__('Unable to load the merge request widget. Try reloading the page.')),
createFlash(__('Unable to load the merge request widget. Try reloading the page.')), );
);
} else {
this.initWidget();
}
}, },
beforeDestroy() { beforeDestroy() {
eventHub.$off('mr.discussion.updated', this.checkStatus); eventHub.$off('mr.discussion.updated', this.checkStatus);
......
...@@ -25,7 +25,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo ...@@ -25,7 +25,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action do before_action do
push_frontend_feature_flag(:vue_issuable_sidebar, @project.group) push_frontend_feature_flag(:vue_issuable_sidebar, @project.group)
push_frontend_feature_flag(:async_mr_widget, @project)
end end
around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions] around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions]
......
...@@ -67,14 +67,6 @@ class MergeRequestWidgetEntity < Grape::Entity ...@@ -67,14 +67,6 @@ class MergeRequestWidgetEntity < Grape::Entity
end end
end end
def as_json(options = {})
return super(options) if Feature.enabled?(:async_mr_widget)
super(options)
.merge(MergeRequestPollCachedWidgetEntity.new(object, **@options.opts_hash).as_json(options))
.merge(MergeRequestPollWidgetEntity.new(object, **@options.opts_hash).as_json(options))
end
private private
delegate :current_user, to: :request delegate :current_user, to: :request
......
---
title: Fetch merge request widget data asynchronous
merge_request: 23594
author:
type: changed
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