mirror of
https://github.com/nextcloud/server.git
synced 2026-03-02 05:20:46 -05:00
Unify appearance of avatars for undefined and unknown users
When calling the jQuery avatar plugin with a user that did not exist
(that is, users for which "/avatar/{user}/{size}" return a JSON response
with an empty "displayname" value) "?" on a grey background was shown.
However, if the jQuery avatar plugin was called with an undefined
JavaScript value then "?" was shown on a bluish background. This commit
unifies both cases to use the grey background.
The unit tests were also modified to ensure that the grey background is
used in both cases.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
e43400eddb
commit
ff71dd07a6
2 changed files with 5 additions and 0 deletions
|
|
@ -73,6 +73,7 @@
|
|||
user = this.data('user');
|
||||
} else {
|
||||
this.imageplaceholder('?');
|
||||
this.css('background-color', '#b9b9b9');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,12 @@ describe('jquery.avatar tests', function() {
|
|||
|
||||
it('undefined user', function() {
|
||||
spyOn($div, 'imageplaceholder');
|
||||
spyOn($div, 'css');
|
||||
|
||||
$div.avatar();
|
||||
|
||||
expect($div.imageplaceholder).toHaveBeenCalledWith('?');
|
||||
expect($div.css).toHaveBeenCalledWith('background-color', '#b9b9b9');
|
||||
});
|
||||
|
||||
describe('no avatar', function() {
|
||||
|
|
@ -86,6 +88,7 @@ describe('jquery.avatar tests', function() {
|
|||
|
||||
it('show placeholder for non existing user', function() {
|
||||
spyOn($div, 'imageplaceholder');
|
||||
spyOn($div, 'css');
|
||||
$div.avatar('foo');
|
||||
|
||||
fakeServer.requests[0].respond(
|
||||
|
|
@ -97,6 +100,7 @@ describe('jquery.avatar tests', function() {
|
|||
);
|
||||
|
||||
expect($div.imageplaceholder).toHaveBeenCalledWith('foo', '?');
|
||||
expect($div.css).toHaveBeenCalledWith('background-color', '#b9b9b9');
|
||||
});
|
||||
|
||||
it('show no placeholder', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue