Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-23 21:11:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-23 21:11:55 +0300
commit0eb05ee0ea5d4e88a1cae604f7ff92507f16d4b0 (patch)
treed63a079b11cb16c6a196de48858e299ffbabd12d /app/assets/javascripts/batch_comments
parente01e71a98f4c2d3492d99993d67e7277a2ead698 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/batch_comments')
-rw-r--r--app/assets/javascripts/batch_comments/components/review_bar.vue28
-rw-r--r--app/assets/javascripts/batch_comments/i18n.js3
-rw-r--r--app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js5
3 files changed, 0 insertions, 36 deletions
diff --git a/app/assets/javascripts/batch_comments/components/review_bar.vue b/app/assets/javascripts/batch_comments/components/review_bar.vue
index 111b670596b..3cd1a2525e9 100644
--- a/app/assets/javascripts/batch_comments/components/review_bar.vue
+++ b/app/assets/javascripts/batch_comments/components/review_bar.vue
@@ -2,20 +2,10 @@
import { mapActions, mapGetters } from 'vuex';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { REVIEW_BAR_VISIBLE_CLASS_NAME } from '../constants';
-import { PREVENT_LEAVING_PENDING_REVIEW } from '../i18n';
import PreviewDropdown from './preview_dropdown.vue';
import PublishButton from './publish_button.vue';
import SubmitDropdown from './submit_dropdown.vue';
-function closeInterrupt(event) {
- event.preventDefault();
-
- // This is the correct way to write backwards-compatible beforeunload listeners
- // https://developer.chrome.com/blog/page-lifecycle-api/#the-beforeunload-event
- /* eslint-disable-next-line no-return-assign, no-param-reassign */
- return (event.returnValue = PREVENT_LEAVING_PENDING_REVIEW);
-}
-
export default {
components: {
PreviewDropdown,
@@ -35,26 +25,8 @@ export default {
},
mounted() {
document.body.classList.add(REVIEW_BAR_VISIBLE_CLASS_NAME);
- /*
- * This stuff is a lot trickier than it looks.
- *
- * Mandatory reading: https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
- * Some notable sentences:
- * - "[...] browsers may not display prompts created in beforeunload event handlers unless the
- * page has been interacted with, or may even not display them at all."
- * - "Especially on mobile, the beforeunload event is not reliably fired."
- * - "The beforeunload event is not compatible with the back/forward cache (bfcache) [...]
- * It is recommended that developers listen for beforeunload only in this scenario, and only
- * when they actually have unsaved changes, so as to minimize the effect on performance."
- *
- * Please ensure that this is really not working before you modify it, because there are a LOT
- * of scenarios where browser behavior will make it _seem_ like it's not working, but it actually
- * is under the right combination of contexts.
- */
- window.addEventListener('beforeunload', closeInterrupt, { capture: true });
},
beforeDestroy() {
- window.removeEventListener('beforeunload', closeInterrupt, { capture: true });
document.body.classList.remove(REVIEW_BAR_VISIBLE_CLASS_NAME);
},
methods: {
diff --git a/app/assets/javascripts/batch_comments/i18n.js b/app/assets/javascripts/batch_comments/i18n.js
deleted file mode 100644
index 6cdbf00f9ca..00000000000
--- a/app/assets/javascripts/batch_comments/i18n.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import { __ } from '~/locale';
-
-export const PREVENT_LEAVING_PENDING_REVIEW = __('There are unsubmitted review comments.');
diff --git a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
index 863d2a99972..a44b9827fe9 100644
--- a/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
+++ b/app/assets/javascripts/batch_comments/stores/modules/batch_comments/actions.js
@@ -1,12 +1,9 @@
import { isEmpty } from 'lodash';
-
import createFlash from '~/flash';
import { scrollToElement } from '~/lib/utils/common_utils';
import { __ } from '~/locale';
-
import { CHANGES_TAB, DISCUSSION_TAB, SHOW_TAB } from '../../../constants';
import service from '../../../services/drafts_service';
-
import * as types from './mutation_types';
export const saveDraft = ({ dispatch }, draft) =>
@@ -18,7 +15,6 @@ export const addDraftToDiscussion = ({ commit }, { endpoint, data }) =>
.then((res) => res.data)
.then((res) => {
commit(types.ADD_NEW_DRAFT, res);
-
return res;
})
.catch(() => {
@@ -33,7 +29,6 @@ export const createNewDraft = ({ commit }, { endpoint, data }) =>
.then((res) => res.data)
.then((res) => {
commit(types.ADD_NEW_DRAFT, res);
-
return res;
})
.catch(() => {