Commit 8b48f716 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch '196689-replace-underscore-with-lodash-notes' into 'master'

Replace underscore with lodash in notes

Closes #196689

See merge request gitlab-org/gitlab!24629
parents edb26408 775adc27
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import _ from 'underscore'; import { isEmpty } from 'lodash';
import Autosize from 'autosize'; import Autosize from 'autosize';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
...@@ -161,7 +161,7 @@ export default { ...@@ -161,7 +161,7 @@ export default {
'toggleStateButtonLoading', 'toggleStateButtonLoading',
]), ]),
setIsSubmitButtonDisabled(note, isSubmitting) { setIsSubmitButtonDisabled(note, isSubmitting) {
if (!_.isEmpty(note) && !isSubmitting) { if (!isEmpty(note) && !isSubmitting) {
this.isSubmitButtonDisabled = false; this.isSubmitButtonDisabled = false;
} else { } else {
this.isSubmitButtonDisabled = true; this.isSubmitButtonDisabled = true;
......
<script> <script>
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import _ from 'underscore'; import { escape } from 'lodash';
import { s__, __, sprintf } from '~/locale'; import { s__, __, sprintf } from '~/locale';
import { truncateSha } from '~/lib/utils/text_utility'; import { truncateSha } from '~/lib/utils/text_utility';
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
return this.notes.length > 1 ? this.lastNote.created_at : null; return this.notes.length > 1 ? this.lastNote.created_at : null;
}, },
headerText() { headerText() {
const linkStart = `<a href="${_.escape(this.discussion.discussion_path)}">`; const linkStart = `<a href="${escape(this.discussion.discussion_path)}">`;
const linkEnd = '</a>'; const linkEnd = '</a>';
const { commit_id: commitId } = this.discussion; const { commit_id: commitId } = this.discussion;
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from 'vuex';
import { escape } from 'underscore'; import { escape } from 'lodash';
import draftMixin from 'ee_else_ce/notes/mixins/draft'; import draftMixin from 'ee_else_ce/notes/mixins/draft';
import { truncateSha } from '~/lib/utils/text_utility'; import { truncateSha } from '~/lib/utils/text_utility';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
......
<script> <script>
import _ from 'underscore'; import { uniqBy } from 'lodash';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.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 TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
uniqueAuthors() { uniqueAuthors() {
const authors = this.replies.map(reply => reply.author || {}); const authors = this.replies.map(reply => reply.author || {});
return _.uniq(authors, author => author.username); return uniqBy(authors, author => author.username);
}, },
className() { className() {
return this.collapsed ? 'collapsed' : 'expanded'; return this.collapsed ? 'collapsed' : 'expanded';
......
import _ from 'underscore'; import { flattenDeep } from 'lodash';
import * as constants from '../constants'; import * as constants from '../constants';
import { collapseSystemNotes } from './collapse_utils'; import { collapseSystemNotes } from './collapse_utils';
...@@ -50,7 +50,7 @@ const isLastNote = (note, state) => ...@@ -50,7 +50,7 @@ const isLastNote = (note, state) =>
!note.system && state.userData && note.author && note.author.id === state.userData.id; !note.system && state.userData && note.author && note.author.id === state.userData.id;
export const getCurrentUserLastNote = state => export const getCurrentUserLastNote = state =>
_.flatten(reverseNotes(state.discussions).map(note => reverseNotes(note.notes))).find(el => flattenDeep(reverseNotes(state.discussions).map(note => reverseNotes(note.notes))).find(el =>
isLastNote(el, state), isLastNote(el, state),
); );
......
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