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>2020-12-11 00:10:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-11 00:10:15 +0300
commite109a7799eb2c5598211c4cc1e0c83d5beb44018 (patch)
treed72aa61dbb5b04bb0f25232660591963bc1f03b8 /app/assets/javascripts/notes
parentcba8ff64401258aa68eebd7603d4022884ed0a45 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r--app/assets/javascripts/notes/components/comment_form.vue24
-rw-r--r--app/assets/javascripts/notes/components/note_form.vue2
-rw-r--r--app/assets/javascripts/notes/constants.js15
-rw-r--r--app/assets/javascripts/notes/stores/actions.js4
4 files changed, 28 insertions, 17 deletions
diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue
index b70e999c765..0363173f912 100644
--- a/app/assets/javascripts/notes/components/comment_form.vue
+++ b/app/assets/javascripts/notes/components/comment_form.vue
@@ -138,8 +138,8 @@ export default {
? __('merge request')
: __('issue');
},
- isMergeRequest() {
- return this.noteableType === constants.MERGE_REQUEST_NOTEABLE_TYPE;
+ isIssue() {
+ return this.noteableDisplayName === constants.ISSUE_NOTEABLE_TYPE;
},
trackingLabel() {
return slugifyWithUnderscore(`${this.commentButtonTitle} button`);
@@ -167,8 +167,8 @@ export default {
'stopPolling',
'restartPolling',
'removePlaceholderNotes',
- 'closeMergeRequest',
- 'reopenMergeRequest',
+ 'closeIssuable',
+ 'reopenIssuable',
'toggleIssueLocalState',
]),
setIsSubmitButtonDisabled(note, isSubmitting) {
@@ -229,22 +229,18 @@ export default {
}
},
toggleIssueState() {
- if (!this.isMergeRequest) {
+ if (this.isIssue) {
+ // We want to invoke the close/reopen logic in the issue header
+ // since that is where the blocked-by issues modal logic is also defined
eventHub.$emit('toggle.issuable.state');
return;
}
- const toggleMergeRequestState = this.isOpen
- ? this.closeMergeRequest
- : this.reopenMergeRequest;
+ const toggleState = this.isOpen ? this.closeIssuable : this.reopenIssuable;
- const errorMessage = this.isOpen
- ? __('Something went wrong while closing the merge request. Please try again later')
- : __('Something went wrong while reopening the merge request. Please try again later');
-
- toggleMergeRequestState()
+ toggleState()
.then(refreshUserMergeRequestCounts)
- .catch(() => Flash(errorMessage));
+ .catch(() => Flash(constants.toggleStateErrorMessage[this.noteableType][this.openState]));
},
discard(shouldClear = true) {
// `blur` is needed to clear slash commands autocomplete cache if event fired.
diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue
index 43f17c5d65c..84769bfc7c8 100644
--- a/app/assets/javascripts/notes/components/note_form.vue
+++ b/app/assets/javascripts/notes/components/note_form.vue
@@ -422,7 +422,7 @@ export default {
</button>
<button
v-if="discussion.resolvable"
- class="btn btn-nr btn-default gl-mr-3 js-comment-resolve-button"
+ class="btn btn-default gl-mr-3 js-comment-resolve-button"
@click.prevent="handleUpdate(true)"
>
{{ resolveButtonTitle }}
diff --git a/app/assets/javascripts/notes/constants.js b/app/assets/javascripts/notes/constants.js
index 7acf2ad57c8..cc14ea42a89 100644
--- a/app/assets/javascripts/notes/constants.js
+++ b/app/assets/javascripts/notes/constants.js
@@ -1,3 +1,5 @@
+import { __ } from '~/locale';
+
export const DISCUSSION_NOTE = 'DiscussionNote';
export const DIFF_NOTE = 'DiffNote';
export const DISCUSSION = 'discussion';
@@ -36,3 +38,16 @@ export const DISCUSSION_FILTER_TYPES = {
COMMENTS: 'comments',
HISTORY: 'history',
};
+
+export const toggleStateErrorMessage = {
+ Epic: {
+ [CLOSED]: __('Something went wrong while reopening the epic. Please try again later.'),
+ [OPENED]: __('Something went wrong while closing the epic. Please try again later.'),
+ [REOPENED]: __('Something went wrong while closing the epic. Please try again later.'),
+ },
+ MergeRequest: {
+ [CLOSED]: __('Something went wrong while reopening the merge request. Please try again later.'),
+ [OPENED]: __('Something went wrong while closing the merge request. Please try again later.'),
+ [REOPENED]: __('Something went wrong while closing the merge request. Please try again later.'),
+ },
+};
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js
index f62b17de10c..1fe5d6c2955 100644
--- a/app/assets/javascripts/notes/stores/actions.js
+++ b/app/assets/javascripts/notes/stores/actions.js
@@ -244,7 +244,7 @@ export const toggleResolveNote = ({ commit, dispatch }, { endpoint, isResolved,
});
};
-export const closeMergeRequest = ({ commit, dispatch, state }) => {
+export const closeIssuable = ({ commit, dispatch, state }) => {
dispatch('toggleStateButtonLoading', true);
return axios.put(state.notesData.closePath).then(({ data }) => {
commit(types.CLOSE_ISSUE);
@@ -253,7 +253,7 @@ export const closeMergeRequest = ({ commit, dispatch, state }) => {
});
};
-export const reopenMergeRequest = ({ commit, dispatch, state }) => {
+export const reopenIssuable = ({ commit, dispatch, state }) => {
dispatch('toggleStateButtonLoading', true);
return axios.put(state.notesData.reopenPath).then(({ data }) => {
commit(types.REOPEN_ISSUE);