Commit 9279183a authored by Jacques Erasmus's avatar Jacques Erasmus

Merge branch '84402-remove-avatar-from-comment-forms' into 'master'

Remove avatar from note form and comment form

See merge request gitlab-org/gitlab!52180
parents 56189dac 998f6957
...@@ -2,14 +2,12 @@ ...@@ -2,14 +2,12 @@
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import NoteSignedOutWidget from '~/notes/components/note_signed_out_widget.vue'; import NoteSignedOutWidget from '~/notes/components/note_signed_out_widget.vue';
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue'; import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
export default { export default {
name: 'DiffDiscussionReply', name: 'DiffDiscussionReply',
components: { components: {
NoteSignedOutWidget, NoteSignedOutWidget,
ReplyPlaceholder, ReplyPlaceholder,
UserAvatarLink,
}, },
props: { props: {
hasForm: { hasForm: {
...@@ -36,13 +34,6 @@ export default { ...@@ -36,13 +34,6 @@ export default {
<template v-if="userCanReply"> <template v-if="userCanReply">
<slot v-if="hasForm" name="form"></slot> <slot v-if="hasForm" name="form"></slot>
<template v-else-if="renderReplyPlaceholder"> <template v-else-if="renderReplyPlaceholder">
<user-avatar-link
:link-href="currentUser.path"
:img-src="currentUser.avatar_url"
:img-alt="currentUser.name"
:img-size="40"
class="d-none d-sm-block"
/>
<reply-placeholder <reply-placeholder
:button-text="__('Start a new discussion...')" :button-text="__('Start a new discussion...')"
@onClick="$emit('showNewDiscussionForm')" @onClick="$emit('showNewDiscussionForm')"
......
...@@ -6,7 +6,6 @@ import { s__ } from '~/locale'; ...@@ -6,7 +6,6 @@ import { s__ } from '~/locale';
import noteForm from '../../notes/components/note_form.vue'; import noteForm from '../../notes/components/note_form.vue';
import MultilineCommentForm from '../../notes/components/multiline_comment_form.vue'; import MultilineCommentForm from '../../notes/components/multiline_comment_form.vue';
import autosave from '../../notes/mixins/autosave'; import autosave from '../../notes/mixins/autosave';
import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import { DIFF_NOTE_TYPE, INLINE_DIFF_LINES_KEY, PARALLEL_DIFF_VIEW_TYPE } from '../constants'; import { DIFF_NOTE_TYPE, INLINE_DIFF_LINES_KEY, PARALLEL_DIFF_VIEW_TYPE } from '../constants';
import { import {
commentLineOptions, commentLineOptions,
...@@ -16,7 +15,6 @@ import { ...@@ -16,7 +15,6 @@ import {
export default { export default {
components: { components: {
noteForm, noteForm,
userAvatarLink,
MultilineCommentForm, MultilineCommentForm,
}, },
mixins: [autosave, diffLineNoteFormMixin, glFeatureFlagsMixin()], mixins: [autosave, diffLineNoteFormMixin, glFeatureFlagsMixin()],
...@@ -174,14 +172,6 @@ export default { ...@@ -174,14 +172,6 @@ export default {
:comment-line-options="commentLineOptions" :comment-line-options="commentLineOptions"
/> />
</div> </div>
<user-avatar-link
v-if="author"
:link-href="author.path"
:img-src="author.avatar_url"
:img-alt="author.name"
:img-size="40"
class="d-none d-sm-block"
/>
<note-form <note-form
ref="noteForm" ref="noteForm"
:is-editing="true" :is-editing="true"
......
...@@ -904,18 +904,7 @@ export default class Notes { ...@@ -904,18 +904,7 @@ export default class Notes {
// DiffNote // DiffNote
form.find('#note_position').val(dataHolder.attr('data-position')); form.find('#note_position').val(dataHolder.attr('data-position'));
form form.append('</div>').find('.js-close-discussion-note-form').show().removeClass('hide');
.prepend(
`<a href="${escape(
gon.current_username,
)}" class="user-avatar-link d-none d-sm-block"><img class="avatar s40" src="${encodeURI(
gon.current_user_avatar_url || gon.default_avatar_url,
)}" alt="${escape(gon.current_user_fullname)}" /></a>`,
)
.append('</div>')
.find('.js-close-discussion-note-form')
.show()
.removeClass('hide');
form.find('.js-note-target-close').remove(); form.find('.js-note-target-close').remove();
form.find('.js-note-new-discussion').remove(); form.find('.js-note-new-discussion').remove();
this.setupNoteForm(form); this.setupNoteForm(form);
......
...@@ -18,7 +18,6 @@ import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests ...@@ -18,7 +18,6 @@ import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests
import * as constants from '../constants'; import * as constants from '../constants';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import markdownField from '~/vue_shared/components/markdown/field.vue'; import markdownField from '~/vue_shared/components/markdown/field.vue';
import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import noteSignedOutWidget from './note_signed_out_widget.vue'; import noteSignedOutWidget from './note_signed_out_widget.vue';
import discussionLockedWidget from './discussion_locked_widget.vue'; import discussionLockedWidget from './discussion_locked_widget.vue';
...@@ -31,7 +30,6 @@ export default { ...@@ -31,7 +30,6 @@ export default {
noteSignedOutWidget, noteSignedOutWidget,
discussionLockedWidget, discussionLockedWidget,
markdownField, markdownField,
userAvatarLink,
GlButton, GlButton,
TimelineEntryItem, TimelineEntryItem,
GlIcon, GlIcon,
...@@ -301,15 +299,6 @@ export default { ...@@ -301,15 +299,6 @@ export default {
<ul v-else-if="canCreateNote" class="notes notes-form timeline"> <ul v-else-if="canCreateNote" class="notes notes-form timeline">
<timeline-entry-item class="note-form"> <timeline-entry-item class="note-form">
<div class="flash-container error-alert timeline-content"></div> <div class="flash-container error-alert timeline-content"></div>
<div class="timeline-icon d-none d-md-block">
<user-avatar-link
v-if="author"
:link-href="author.path"
:img-src="author.avatar_url"
:img-alt="author.name"
:img-size="40"
/>
</div>
<div class="timeline-content timeline-content-form"> <div class="timeline-content timeline-content-form">
<form ref="commentForm" class="new-note common-note-form gfm-form js-main-target-form"> <form ref="commentForm" class="new-note common-note-form gfm-form js-main-target-form">
<comment-field-layout <comment-field-layout
......
...@@ -267,14 +267,6 @@ export default { ...@@ -267,14 +267,6 @@ export default {
:class="{ 'is-replying': isReplying }" :class="{ 'is-replying': isReplying }"
class="discussion-reply-holder gl-border-t-0! clearfix" class="discussion-reply-holder gl-border-t-0! clearfix"
> >
<user-avatar-link
v-if="!isReplying && userCanReply"
:link-href="currentUser.path"
:img-src="currentUser.avatar_url"
:img-alt="currentUser.name"
:img-size="40"
class="d-none d-sm-block"
/>
<discussion-actions <discussion-actions
v-if="!isReplying && userCanReply" v-if="!isReplying && userCanReply"
:discussion="discussion" :discussion="discussion"
...@@ -285,27 +277,18 @@ export default { ...@@ -285,27 +277,18 @@ export default {
@showReplyForm="showReplyForm" @showReplyForm="showReplyForm"
@resolve="resolveHandler" @resolve="resolveHandler"
/> />
<div v-if="isReplying" class="avatar-note-form-holder"> <note-form
<user-avatar-link v-if="isReplying"
v-if="currentUser" ref="noteForm"
:link-href="currentUser.path" :discussion="discussion"
:img-src="currentUser.avatar_url" :is-editing="false"
:img-alt="currentUser.name" :line="diffLine"
:img-size="40" save-button-title="Comment"
class="d-none d-sm-block" :autosave-key="autosaveKey"
/> @handleFormUpdateAddToReview="addReplyToReview"
<note-form @handleFormUpdate="saveReply"
ref="noteForm" @cancelForm="cancelReplyForm"
:discussion="discussion" />
:is-editing="false"
:line="diffLine"
save-button-title="Comment"
:autosave-key="autosaveKey"
@handleFormUpdateAddToReview="addReplyToReview"
@handleFormUpdate="saveReply"
@cancelForm="cancelReplyForm"
/>
</div>
<note-signed-out-widget v-if="!isLoggedIn" /> <note-signed-out-widget v-if="!isLoggedIn" />
</div> </div>
</template> </template>
......
...@@ -1136,10 +1136,6 @@ table.code { ...@@ -1136,10 +1136,6 @@ table.code {
display: block; display: block;
} }
} }
.note-edit-form {
margin-left: $note-icon-gutter-width;
}
} }
.discussion-body .image .frame { .discussion-body .image .frame {
......
...@@ -444,12 +444,6 @@ span.idiff { ...@@ -444,12 +444,6 @@ span.idiff {
.user-avatar-link.new-comment { .user-avatar-link.new-comment {
position: absolute; position: absolute;
margin: 40px $gl-padding 0 116px; margin: 40px $gl-padding 0 116px;
~ .note-edit-form form.edit-note {
@include media-breakpoint-up(sm) {
margin-left: $note-icon-gutter-width;
}
}
} }
} }
......
...@@ -627,7 +627,6 @@ $search-input-xl-width: 320px; ...@@ -627,7 +627,6 @@ $search-input-xl-width: 320px;
$note-disabled-comment-color: #b2b2b2; $note-disabled-comment-color: #b2b2b2;
$note-targe3-outside: #fffff0; $note-targe3-outside: #fffff0;
$note-targe3-inside: #ffffd3; $note-targe3-inside: #ffffd3;
$note-icon-gutter-width: 55px;
/* /*
* Identicon * Identicon
......
...@@ -203,15 +203,9 @@ ul.related-merge-requests > li { ...@@ -203,15 +203,9 @@ ul.related-merge-requests > li {
} }
} }
.discussion-reply-holder { .discussion-reply-holder,
.avatar-note-form-holder .note-edit-form { .note-edit-form {
display: block; display: block;
margin-left: $note-icon-gutter-width;
@include media-breakpoint-down(xs) {
margin-left: 0;
}
}
} }
.issue-sort-dropdown { .issue-sort-dropdown {
......
...@@ -212,8 +212,12 @@ table { ...@@ -212,8 +212,12 @@ table {
} }
} }
.note-edit-form { // Snippets are the only non-vue form left
.snippets.note-edit-form {
display: none; display: none;
}
.note-edit-form {
font-size: 14px; font-size: 14px;
.md-area { .md-area {
......
$system-note-icon-size: 32px; $system-note-icon-size: 32px;
$system-note-svg-size: 16px; $system-note-svg-size: 16px;
$note-form-margin-left: 72px;
@mixin vertical-line($left) { @mixin vertical-line($left) {
&::before { &::before {
...@@ -54,16 +53,6 @@ $note-form-margin-left: 72px; ...@@ -54,16 +53,6 @@ $note-form-margin-left: 72px;
&.note-form { &.note-form {
margin-left: 0; margin-left: 0;
@include notes-media('min', map-get($grid-breakpoints, md)) {
margin-left: $note-form-margin-left;
}
.timeline-icon {
@include notes-media('min', map-get($grid-breakpoints, sm)) {
margin-left: -$note-icon-gutter-width;
}
}
.timeline-content { .timeline-content {
margin-left: 0; margin-left: 0;
} }
...@@ -529,21 +518,6 @@ $note-form-margin-left: 72px; ...@@ -529,21 +518,6 @@ $note-form-margin-left: 72px;
.code-commit .notes-content, .code-commit .notes-content,
.diff-viewer > .image ~ .note-container { .diff-viewer > .image ~ .note-container {
background-color: $white; background-color: $white;
.avatar-note-form-holder {
.user-avatar-link img {
margin: 13px $gl-padding $gl-padding;
}
form,
~ .discussion-form-container {
padding: $gl-padding;
@include media-breakpoint-up(sm) {
margin-left: $note-icon-gutter-width;
}
}
}
} }
.diff-viewer > .image ~ .note-container form.new-note { .diff-viewer > .image ~ .note-container form.new-note {
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
.discussion-reply-holder .discussion-reply-holder
- if can_create_note? - if can_create_note?
%a.user-avatar-link.d-none.d-sm-block{ href: user_path(current_user) }
= image_tag avatar_icon_for_user(current_user), alt: current_user.to_reference, class: 'avatar s40'
.discussion-with-resolve-btn .discussion-with-resolve-btn
= link_to_reply_discussion(discussion) = link_to_reply_discussion(discussion)
- elsif !current_user - elsif !current_user
......
.note-edit-form .snippets.note-edit-form
= form_tag '#', method: :put, class: 'edit-note common-note-form js-quick-submit' do = form_tag '#', method: :put, class: 'edit-note common-note-form js-quick-submit' do
= hidden_field_tag :target_id, '', class: 'js-form-target-id' = hidden_field_tag :target_id, '', class: 'js-form-target-id'
= hidden_field_tag :target_type, '', class: 'js-form-target-type' = hidden_field_tag :target_type, '', class: 'js-form-target-type'
......
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
.timeline-entry-inner .timeline-entry-inner
.flash-container.timeline-content .flash-container.timeline-content
.timeline-icon.d-none.d-md-block
%a.author-link{ href: user_path(current_user) }
= image_tag avatar_icon_for_user(current_user), alt: current_user.to_reference, class: 'avatar s40'
.timeline-content.timeline-content-form .timeline-content.timeline-content-form
= render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete = render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete
- elsif !current_user - elsif !current_user
......
---
title: Remove Avatar from Comment Forms
merge_request: 52180
author: Lee Tickett @leetickett
type: other
...@@ -9,7 +9,6 @@ import CommentForm from '~/notes/components/comment_form.vue'; ...@@ -9,7 +9,6 @@ import CommentForm from '~/notes/components/comment_form.vue';
import * as constants from '~/notes/constants'; import * as constants from '~/notes/constants';
import eventHub from '~/notes/event_hub'; import eventHub from '~/notes/event_hub';
import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests'; import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import { loggedOutnoteableData, notesDataMock, userDataMock, noteableDataMock } from '../mock_data'; import { loggedOutnoteableData, notesDataMock, userDataMock, noteableDataMock } from '../mock_data';
jest.mock('autosize'); jest.mock('autosize');
...@@ -64,14 +63,6 @@ describe('issue_comment_form component', () => { ...@@ -64,14 +63,6 @@ describe('issue_comment_form component', () => {
}); });
describe('user is logged in', () => { describe('user is logged in', () => {
describe('avatar', () => {
it('should render user avatar with link', () => {
mountComponent({ mountFunction: mount });
expect(wrapper.find(UserAvatarLink).attributes('href')).toBe(userDataMock.path);
});
});
describe('handleSave', () => { describe('handleSave', () => {
it('should request to save note when note is entered', () => { it('should request to save note when note is entered', () => {
mountComponent({ mountFunction: mount, initialData: { note: 'hello world' } }); mountComponent({ mountFunction: mount, initialData: { note: 'hello world' } });
......
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