diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/assets/javascripts/notes | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/assets/javascripts/notes')
18 files changed, 77 insertions, 79 deletions
diff --git a/app/assets/javascripts/notes/components/diff_discussion_header.vue b/app/assets/javascripts/notes/components/diff_discussion_header.vue index 0ce1eb8191a..45d97f278dc 100644 --- a/app/assets/javascripts/notes/components/diff_discussion_header.vue +++ b/app/assets/javascripts/notes/components/diff_discussion_header.vue @@ -6,7 +6,7 @@ import { mapActions } from 'vuex'; import { truncateSha } from '~/lib/utils/text_utility'; import { s__, __, sprintf } from '~/locale'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import noteEditedText from './note_edited_text.vue'; import noteHeader from './note_header.vue'; diff --git a/app/assets/javascripts/notes/components/diff_with_note.vue b/app/assets/javascripts/notes/components/diff_with_note.vue index b4f7ba5f960..e2b0c7fee32 100644 --- a/app/assets/javascripts/notes/components/diff_with_note.vue +++ b/app/assets/javascripts/notes/components/diff_with_note.vue @@ -9,7 +9,7 @@ import ImageDiffOverlay from '~/diffs/components/image_diff_overlay.vue'; import { getDiffMode } from '~/diffs/store/utils'; import { diffViewerModes } from '~/ide/constants'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; -import { isCollapsed } from '../../diffs/utils/diff_file'; +import { isCollapsed } from '~/diffs/utils/diff_file'; const FIRST_CHAR_REGEX = /^(\+|-| )/; diff --git a/app/assets/javascripts/notes/components/discussion_filter.vue b/app/assets/javascripts/notes/components/discussion_filter.vue index d5a7fc36ace..15887c2738d 100644 --- a/app/assets/javascripts/notes/components/discussion_filter.vue +++ b/app/assets/javascripts/notes/components/discussion_filter.vue @@ -1,7 +1,7 @@ <script> import { GlDropdown, GlDropdownItem, GlDropdownDivider } from '@gitlab/ui'; import { mapGetters, mapActions } from 'vuex'; -import { getLocationHash, doesHashExistInUrl } from '../../lib/utils/url_utility'; +import { getLocationHash, doesHashExistInUrl } from '~/lib/utils/url_utility'; import { DISCUSSION_FILTERS_DEFAULT_VALUE, HISTORY_ONLY_FILTER_VALUE, diff --git a/app/assets/javascripts/notes/components/note_actions.vue b/app/assets/javascripts/notes/components/note_actions.vue index e2a2edd7344..1bd2f879e6c 100644 --- a/app/assets/javascripts/notes/components/note_actions.vue +++ b/app/assets/javascripts/notes/components/note_actions.vue @@ -9,7 +9,7 @@ import { __, sprintf } from '~/locale'; import eventHub from '~/sidebar/event_hub'; import UserAccessRoleBadge from '~/vue_shared/components/user_access_role_badge.vue'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import { splitCamelCase } from '../../lib/utils/text_utility'; +import { splitCamelCase } from '~/lib/utils/text_utility'; import ReplyButton from './note_actions/reply_button.vue'; export default { @@ -292,40 +292,18 @@ export default { class="line-resolve-btn note-action-button" @click="onResolve" /> - <template v-if="canAwardEmoji"> - <emoji-picker - v-if="glFeatures.improvedEmojiPicker" - toggle-class="note-action-button note-emoji-button gl-text-gray-600 gl-m-3 gl-p-0! gl-shadow-none! gl-bg-transparent!" - @click="setAwardEmoji" - > - <template #button-content> - <gl-icon class="link-highlight award-control-icon-neutral gl-m-0!" name="slight-smile" /> - <gl-icon class="link-highlight award-control-icon-positive gl-m-0!" name="smiley" /> - <gl-icon class="link-highlight award-control-icon-super-positive gl-m-0!" name="smile" /> - </template> - </emoji-picker> - <gl-button - v-else - v-gl-tooltip - :class="{ 'js-user-authored': isAuthoredByCurrentUser }" - class="note-action-button note-emoji-button add-reaction-button js-add-award js-note-emoji" - category="tertiary" - variant="default" - :title="$options.i18n.addReactionLabel" - :aria-label="$options.i18n.addReactionLabel" - data-position="right" - > - <span class="reaction-control-icon reaction-control-icon-neutral"> - <gl-icon name="slight-smile" /> - </span> - <span class="reaction-control-icon reaction-control-icon-positive"> - <gl-icon name="smiley" /> - </span> - <span class="reaction-control-icon reaction-control-icon-super-positive"> - <gl-icon name="smile" /> - </span> - </gl-button> - </template> + <emoji-picker + v-if="canAwardEmoji" + toggle-class="note-action-button note-emoji-button gl-text-gray-600 gl-m-3 gl-p-0! gl-shadow-none! gl-bg-transparent!" + data-testid="note-emoji-button" + @click="setAwardEmoji" + > + <template #button-content> + <gl-icon class="link-highlight award-control-icon-neutral gl-m-0!" name="slight-smile" /> + <gl-icon class="link-highlight award-control-icon-positive gl-m-0!" name="smiley" /> + <gl-icon class="link-highlight award-control-icon-super-positive gl-m-0!" name="smile" /> + </template> + </emoji-picker> <reply-button v-if="showReply" ref="replyButton" diff --git a/app/assets/javascripts/notes/components/note_body.vue b/app/assets/javascripts/notes/components/note_body.vue index f465ad23a06..fe17a061c0a 100644 --- a/app/assets/javascripts/notes/components/note_body.vue +++ b/app/assets/javascripts/notes/components/note_body.vue @@ -57,14 +57,15 @@ export default { computed: { ...mapGetters(['getDiscussion', 'suggestionsCount', 'getSuggestionsFilePaths']), ...mapGetters('diffs', ['suggestionCommitMessage']), + ...mapState({ + batchSuggestionsInfo: (state) => state.notes.batchSuggestionsInfo, + failedToLoadMetadata: (state) => state.page.failedToLoadMetadata, + }), discussion() { if (!this.note.isDraft) return {}; return this.getDiscussion(this.note.discussion_id); }, - ...mapState({ - batchSuggestionsInfo: (state) => state.notes.batchSuggestionsInfo, - }), noteBody() { return this.note.note; }, @@ -165,6 +166,7 @@ export default { :line-type="lineType" :help-page-path="helpPagePath" :default-commit-message="commitMessage" + :failed-to-load-metadata="failedToLoadMetadata" @apply="applySuggestion" @applyBatch="applySuggestionBatch" @addToBatch="addSuggestionToBatch" @@ -174,7 +176,6 @@ export default { <note-form v-if="isEditing" ref="noteForm" - :is-editing="isEditing" :note-body="noteBody" :note-id="note.id" :line="line" diff --git a/app/assets/javascripts/notes/components/note_edited_text.vue b/app/assets/javascripts/notes/components/note_edited_text.vue index 7c052320c98..03cbdf45ddd 100644 --- a/app/assets/javascripts/notes/components/note_edited_text.vue +++ b/app/assets/javascripts/notes/components/note_edited_text.vue @@ -1,6 +1,6 @@ <script> /* eslint-disable @gitlab/vue-require-i18n-strings */ -import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue'; +import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; export default { name: 'EditedNoteText', diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index ee22c118e11..c1e763d81ee 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -41,10 +41,6 @@ export default { required: false, default: () => ({}), }, - isEditing: { - type: Boolean, - required: true, - }, lineCode: { type: String, required: false, @@ -184,7 +180,7 @@ export default { return this.getNotesDataByProp('markdownDocsPath'); }, quickActionsDocsPath() { - return !this.isEditing ? this.getNotesDataByProp('quickActionsDocsPath') : undefined; + return this.getNotesDataByProp('quickActionsDocsPath'); }, currentUserId() { return this.getUserDataByProp('id'); @@ -348,7 +344,7 @@ export default { ref="textarea" v-model="updatedNoteBody" :disabled="isSubmitting" - :data-supports-quick-actions="!isEditing" + data-supports-quick-actions="true" name="note[note]" class="note-textarea js-gfm-input js-note-text js-autosize markdown-area js-vue-issue-note-form" data-qa-selector="reply_field" diff --git a/app/assets/javascripts/notes/components/note_header.vue b/app/assets/javascripts/notes/components/note_header.vue index 71d767c3b95..11b427b9346 100644 --- a/app/assets/javascripts/notes/components/note_header.vue +++ b/app/assets/javascripts/notes/components/note_header.vue @@ -6,9 +6,11 @@ import { GlSafeHtmlDirective as SafeHtml, } from '@gitlab/ui'; import { mapActions } from 'vuex'; -import { __ } from '~/locale'; +import { __, s__ } from '~/locale'; import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; -import UserNameWithStatus from '../../sidebar/components/assignees/user_name_with_status.vue'; +import UserNameWithStatus from '~/sidebar/components/assignees/user_name_with_status.vue'; + +import { NOTEABLE_TYPE_MAPPING } from '../constants'; export default { safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] }, @@ -45,6 +47,11 @@ export default { required: false, default: null, }, + noteableType: { + type: String, + required: false, + default: '', + }, includeToggle: { type: Boolean, required: false, @@ -103,6 +110,15 @@ export default { authorName() { return this.author.name; }, + noteConfidentialityTooltip() { + if ( + this.noteableType === NOTEABLE_TYPE_MAPPING.Issue || + this.noteableType === NOTEABLE_TYPE_MAPPING.MergeRequest + ) { + return s__('Notes|This comment is confidential and only visible to project members'); + } + return s__('Notes|This comment is confidential and only visible to group members'); + }, }, mounted() { this.emojiTitle = this.emojiElement ? this.emojiElement.getAttribute('title') : ''; @@ -226,7 +242,7 @@ export default { data-testid="confidentialIndicator" name="eye-slash" :size="16" - :title="s__('Notes|This comment is confidential and only visible to project members')" + :title="noteConfidentialityTooltip" class="gl-ml-1 gl-text-orange-700 align-middle" /> <slot name="extra-controls"></slot> diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index c4602363da1..000eb3bdff3 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -10,7 +10,7 @@ import { ignoreWhilePending } from '~/lib/utils/ignore_while_pending'; import { s__, __ } from '~/locale'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import eventHub from '../event_hub'; import noteable from '../mixins/noteable'; import resolvable from '../mixins/resolvable'; @@ -307,7 +307,6 @@ export default { v-if="isReplying" ref="noteForm" :discussion="discussion" - :is-editing="false" :line="diffLine" save-button-title="Comment" :autosave-key="autosaveKey" diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index a271ac91f6e..a2fbb242222 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -10,8 +10,8 @@ import httpStatusCodes from '~/lib/utils/http_status'; import { ignoreWhilePending } from '~/lib/utils/ignore_while_pending'; import { truncateSha } from '~/lib/utils/text_utility'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; -import { __, s__, sprintf } from '../../locale'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import { __, s__, sprintf } from '~/locale'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import eventHub from '../event_hub'; import noteable from '../mixins/noteable'; import resolvable from '../mixins/resolvable'; @@ -357,7 +357,13 @@ export default { }) { if (shouldConfirm && isDirty) { const msg = __('Are you sure you want to cancel editing this comment?'); - const confirmed = await confirmAction(msg); + const confirmed = await confirmAction(msg, { + primaryBtnText: __('Cancel editing'), + primaryBtnVariant: 'danger', + secondaryBtnVariant: 'default', + secondaryBtnText: __('Continue editing'), + hideCancel: true, + }); if (!confirmed) return; } this.$refs.noteBody.resetAutoSave(); @@ -432,6 +438,7 @@ export default { :created-at="note.created_at" :note-id="note.id" :is-confidential="note.confidential" + :noteable-type="noteableType" > <template #note-header-info> <slot name="note-header-info"></slot> diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue index c4924cd41f5..7d8d23335e0 100644 --- a/app/assets/javascripts/notes/components/notes_app.vue +++ b/app/assets/javascripts/notes/components/notes_app.vue @@ -7,12 +7,12 @@ import initUserPopovers from '~/user_popovers'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; import OrderedLayout from '~/vue_shared/components/ordered_layout.vue'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import draftNote from '../../batch_comments/components/draft_note.vue'; -import { getLocationHash, doesHashExistInUrl } from '../../lib/utils/url_utility'; -import placeholderNote from '../../vue_shared/components/notes/placeholder_note.vue'; -import placeholderSystemNote from '../../vue_shared/components/notes/placeholder_system_note.vue'; -import skeletonLoadingContainer from '../../vue_shared/components/notes/skeleton_note.vue'; -import systemNote from '../../vue_shared/components/notes/system_note.vue'; +import draftNote from '~/batch_comments/components/draft_note.vue'; +import { getLocationHash, doesHashExistInUrl } from '~/lib/utils/url_utility'; +import placeholderNote from '~/vue_shared/components/notes/placeholder_note.vue'; +import placeholderSystemNote from '~/vue_shared/components/notes/placeholder_system_note.vue'; +import skeletonLoadingContainer from '~/vue_shared/components/notes/skeleton_note.vue'; +import systemNote from '~/vue_shared/components/notes/system_note.vue'; import * as constants from '../constants'; import eventHub from '../event_hub'; import commentForm from './comment_form.vue'; diff --git a/app/assets/javascripts/notes/components/sort_discussion.vue b/app/assets/javascripts/notes/components/sort_discussion.vue index 92c39fbb9f0..bcc5d12b7c8 100644 --- a/app/assets/javascripts/notes/components/sort_discussion.vue +++ b/app/assets/javascripts/notes/components/sort_discussion.vue @@ -57,6 +57,7 @@ export default { :value="sortDirection" :storage-key="storageKey" :persist="persistSortOrder" + as-string @input="setDiscussionSortDirection({ direction: $event })" /> <gl-dropdown :text="dropdownText" class="js-dropdown-text full-width-mobile"> diff --git a/app/assets/javascripts/notes/components/timeline_toggle.vue b/app/assets/javascripts/notes/components/timeline_toggle.vue index 87d22e5b986..e4d89f54652 100644 --- a/app/assets/javascripts/notes/components/timeline_toggle.vue +++ b/app/assets/javascripts/notes/components/timeline_toggle.vue @@ -7,8 +7,8 @@ import { COMMENTS_ONLY_FILTER_VALUE, DESC } from '../constants'; import notesEventHub from '../event_hub'; import { trackToggleTimelineView } from '../utils'; -export const timelineEnabledTooltip = s__('Timeline|Turn timeline view off'); -export const timelineDisabledTooltip = s__('Timeline|Turn timeline view on'); +export const timelineEnabledTooltip = s__('Timeline|Turn recent updates view off'); +export const timelineDisabledTooltip = s__('Timeline|Turn recent updates view on'); export default { components: { @@ -49,7 +49,7 @@ export default { <gl-button v-gl-tooltip v-track-event="trackToggleTimelineView(timelineEnabled)" - icon="comments" + icon="history" :selected="timelineEnabled" :title="tooltip" :aria-label="tooltip" diff --git a/app/assets/javascripts/notes/components/toggle_replies_widget.vue b/app/assets/javascripts/notes/components/toggle_replies_widget.vue index 01e3f84d00e..65b3fd6f8b3 100644 --- a/app/assets/javascripts/notes/components/toggle_replies_widget.vue +++ b/app/assets/javascripts/notes/components/toggle_replies_widget.vue @@ -57,7 +57,7 @@ export default { :link-href="author.path" :img-alt="author.name" :img-src="author.avatar_url" - :img-size="26" + :img-size="24" :tooltip-text="author.name" tooltip-placement="bottom" /> diff --git a/app/assets/javascripts/notes/mixins/autosave.js b/app/assets/javascripts/notes/mixins/autosave.js index d670d0bd4c5..61cb4ab2a10 100644 --- a/app/assets/javascripts/notes/mixins/autosave.js +++ b/app/assets/javascripts/notes/mixins/autosave.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import { s__ } from '~/locale'; -import Autosave from '../../autosave'; -import { capitalizeFirstCharacter } from '../../lib/utils/text_utility'; +import Autosave from '~/autosave'; +import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; export default { methods: { diff --git a/app/assets/javascripts/notes/mixins/discussion_navigation.js b/app/assets/javascripts/notes/mixins/discussion_navigation.js index 93236b05100..754a534e055 100644 --- a/app/assets/javascripts/notes/mixins/discussion_navigation.js +++ b/app/assets/javascripts/notes/mixins/discussion_navigation.js @@ -1,6 +1,6 @@ import { mapGetters, mapActions, mapState } from 'vuex'; import { scrollToElementWithContext, scrollToElement } from '~/lib/utils/common_utils'; -import { updateHistory } from '../../lib/utils/url_utility'; +import { updateHistory } from '~/lib/utils/url_utility'; import eventHub from '../event_hub'; /** diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index 50b05ea9d69..204e704e504 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -9,14 +9,14 @@ import { __, sprintf } from '~/locale'; import { confidentialWidget } from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue'; import updateIssueLockMutation from '~/sidebar/components/lock/mutations/update_issue_lock.mutation.graphql'; import updateMergeRequestLockMutation from '~/sidebar/components/lock/mutations/update_merge_request_lock.mutation.graphql'; -import loadAwardsHandler from '../../awards_handler'; -import { isInViewport, scrollToElement, isInMRPage } from '../../lib/utils/common_utils'; -import Poll from '../../lib/utils/poll'; -import { create } from '../../lib/utils/recurrence'; -import { mergeUrlParams } from '../../lib/utils/url_utility'; -import sidebarTimeTrackingEventHub from '../../sidebar/event_hub'; -import TaskList from '../../task_list'; -import mrWidgetEventHub from '../../vue_merge_request_widget/event_hub'; +import loadAwardsHandler from '~/awards_handler'; +import { isInViewport, scrollToElement, isInMRPage } from '~/lib/utils/common_utils'; +import Poll from '~/lib/utils/poll'; +import { create } from '~/lib/utils/recurrence'; +import { mergeUrlParams } from '~/lib/utils/url_utility'; +import sidebarTimeTrackingEventHub from '~/sidebar/event_hub'; +import TaskList from '~/task_list'; +import mrWidgetEventHub from '~/vue_merge_request_widget/event_hub'; import * as constants from '../constants'; import eventHub from '../event_hub'; import * as types from './mutation_types'; diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js index ba19ecd0c04..5cc2c673391 100644 --- a/app/assets/javascripts/notes/stores/mutations.js +++ b/app/assets/javascripts/notes/stores/mutations.js @@ -1,5 +1,5 @@ import { isEqual } from 'lodash'; -import { isInMRPage } from '../../lib/utils/common_utils'; +import { isInMRPage } from '~/lib/utils/common_utils'; import * as constants from '../constants'; import * as types from './mutation_types'; import * as utils from './utils'; |