Commit 190f86b5 authored by Simon Knox's avatar Simon Knox

Merge branch 'sidebar-user-avatar' into 'master'

Update user avatar in settings sidebar realtime when a user updates the avatar

See merge request gitlab-org/gitlab!54135
parents 082f68e2 ad65ab3f
......@@ -95,6 +95,7 @@ export default class Profile {
updateHeaderAvatar() {
$('.header-user-avatar').attr('src', this.avatarGlCrop.dataURL);
$('.js-sidebar-user-avatar').attr('src', this.avatarGlCrop.dataURL);
}
setRepoRadio() {
......
......@@ -3,7 +3,7 @@
.context-header
= link_to profile_path, title: _('Profile Settings') do
.avatar-container.s40.settings-avatar
= image_tag avatar_icon_for_user(current_user, 40), class: "avatar s40 avatar-tile", alt: current_user.name
= image_tag avatar_icon_for_user(current_user, 40), class: "avatar s40 avatar-tile js-sidebar-user-avatar", alt: current_user.name, data: { testid: 'sidebar-user-avatar' }
.sidebar-context-title= _('User Settings')
%ul.sidebar-top-level-items
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
......
---
title: Update user avatar in sidebar realtime
merge_request: 54135
author: Yogi (@yo)
type: changed
......@@ -23,7 +23,7 @@ RSpec.describe 'User uploads avatar to profile' do
expect(user.reload.avatar.file).to exist
end
it 'their new avatar is immediately visible in the header', :js do
it 'their new avatar is immediately visible in the header and setting sidebar', :js do
find('.js-user-avatar-input', visible: false).set(avatar_file_path)
click_button 'Set new profile picture'
......@@ -33,5 +33,6 @@ RSpec.describe 'User uploads avatar to profile' do
data_uri = find('.avatar-image .avatar')['src']
expect(page.find('.header-user-avatar')['src']).to eq data_uri
expect(page.find('[data-testid="sidebar-user-avatar"]')['src']).to eq data_uri
end
end
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