Commit 9aee4d3e authored by viktomas's avatar viktomas

Change MR draft status notification from flash to tast

Use toast UI element to notify user about the changed draft status.

Changelog: changed
parent 2fe79453
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import $ from 'jquery'; import $ from 'jquery';
import createFlash from '~/flash'; import createFlash from '~/flash';
import toast from '~/vue_shared/plugins/global_toast';
import { __ } from '~/locale'; import { __ } from '~/locale';
import eventHub from '~/vue_merge_request_widget/event_hub'; import eventHub from '~/vue_merge_request_widget/event_hub';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
...@@ -136,10 +137,9 @@ MergeRequest.hideCloseButton = function () { ...@@ -136,10 +137,9 @@ MergeRequest.hideCloseButton = function () {
MergeRequest.toggleDraftStatus = function (title, isReady) { MergeRequest.toggleDraftStatus = function (title, isReady) {
if (isReady) { if (isReady) {
createFlash({ toast(__('Marked as ready. Merging is now allowed.'));
message: __('Marked as ready. Merging is now allowed.'), } else {
type: 'notice', toast(__('Marked as draft. Can only be merged when marked as ready.'));
});
} }
const titleEl = document.querySelector('.merge-request .detail-page-description .title'); const titleEl = document.querySelector('.merge-request .detail-page-description .title');
......
...@@ -3,6 +3,7 @@ import { GlButton } from '@gitlab/ui'; ...@@ -3,6 +3,7 @@ import { GlButton } from '@gitlab/ui';
import { produce } from 'immer'; import { produce } from 'immer';
import $ from 'jquery'; import $ from 'jquery';
import createFlash from '~/flash'; import createFlash from '~/flash';
import toast from '~/vue_shared/plugins/global_toast';
import { __ } from '~/locale'; import { __ } from '~/locale';
import MergeRequest from '~/merge_request'; import MergeRequest from '~/merge_request';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -123,10 +124,7 @@ export default { ...@@ -123,10 +124,7 @@ export default {
}, },
}, },
}) => { }) => {
createFlash({ toast(__('Marked as ready. Merging is now allowed.'));
message: __('Marked as ready. Merging is now allowed.'),
type: 'notice',
});
$('.merge-request .detail-page-description .title').text(title); $('.merge-request .detail-page-description .title').text(title);
}, },
) )
......
...@@ -20804,6 +20804,9 @@ msgstr "" ...@@ -20804,6 +20804,9 @@ msgstr ""
msgid "Marked For Deletion At - %{deletion_time}" msgid "Marked For Deletion At - %{deletion_time}"
msgstr "" msgstr ""
msgid "Marked as draft. Can only be merged when marked as ready."
msgstr ""
msgid "Marked as ready. Merging is now allowed." msgid "Marked as ready. Merging is now allowed."
msgstr "" msgstr ""
......
import Vue from 'vue'; import Vue from 'vue';
import createFlash from '~/flash';
import WorkInProgress from '~/vue_merge_request_widget/components/states/work_in_progress.vue'; import WorkInProgress from '~/vue_merge_request_widget/components/states/work_in_progress.vue';
import toast from '~/vue_shared/plugins/global_toast';
import eventHub from '~/vue_merge_request_widget/event_hub'; import eventHub from '~/vue_merge_request_widget/event_hub';
jest.mock('~/flash'); jest.mock('~/vue_shared/plugins/global_toast');
const createComponent = () => { const createComponent = () => {
const Component = Vue.extend(WorkInProgress); const Component = Vue.extend(WorkInProgress);
...@@ -63,10 +63,7 @@ describe('Wip', () => { ...@@ -63,10 +63,7 @@ describe('Wip', () => {
setImmediate(() => { setImmediate(() => {
expect(vm.isMakingRequest).toBeTruthy(); expect(vm.isMakingRequest).toBeTruthy();
expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj); expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj);
expect(createFlash).toHaveBeenCalledWith({ expect(toast).toHaveBeenCalledWith('Marked as ready. Merging is now allowed.');
message: 'Marked as ready. Merging is now allowed.',
type: 'notice',
});
done(); done();
}); });
}); });
......
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