Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ad65ab3f
Commit
ad65ab3f
authored
Feb 19, 2021
by
Yogi
Committed by
Simon Knox
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update user avatar in settings sidebar realtime when a user updates the avatar
parent
442a14ef
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
2 deletions
+9
-2
app/assets/javascripts/profile/profile.js
app/assets/javascripts/profile/profile.js
+1
-0
app/views/layouts/nav/sidebar/_profile.html.haml
app/views/layouts/nav/sidebar/_profile.html.haml
+1
-1
changelogs/unreleased/sidebar-user-avatar.yml
changelogs/unreleased/sidebar-user-avatar.yml
+5
-0
spec/features/uploads/user_uploads_avatar_to_profile_spec.rb
spec/features/uploads/user_uploads_avatar_to_profile_spec.rb
+2
-1
No files found.
app/assets/javascripts/profile/profile.js
View file @
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
()
{
...
...
app/views/layouts/nav/sidebar/_profile.html.haml
View file @
ad65ab3f
...
...
@@ -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
...
...
changelogs/unreleased/sidebar-user-avatar.yml
0 → 100644
View file @
ad65ab3f
---
title
:
Update user avatar in sidebar realtime
merge_request
:
54135
author
:
Yogi (@yo)
type
:
changed
spec/features/uploads/user_uploads_avatar_to_profile_spec.rb
View file @
ad65ab3f
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment