mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Use correct data attribute to avoid unnecessary data base calls
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
vertical-align: -5px
|
||||
|
||||
&.avatar-default
|
||||
line-height: 20px
|
||||
font-size: 10px
|
||||
|
||||
.avatar-default
|
||||
|
||||
@@ -76,7 +76,7 @@ export class UserAvatarComponent implements AfterViewInit {
|
||||
|
||||
public showUserAvatar() {
|
||||
// When a user url is given,
|
||||
// we have to get the information from the database
|
||||
// we have to get the information from the database.
|
||||
if (this.user) {
|
||||
this.userID = WorkPackageResource.idFromLink(this.user);
|
||||
this.userCacheService
|
||||
@@ -136,7 +136,10 @@ export class UserAvatarComponent implements AfterViewInit {
|
||||
private isUserAGroup() {
|
||||
// When an ID or an avatar is given, it must be a user.
|
||||
// Otherwise we have to check the url
|
||||
return !this.userID && !this.userAvatar && this.user.includes('group');
|
||||
return !this.userID &&
|
||||
!this.userAvatar &&
|
||||
!!this.user &&
|
||||
this.user.includes('group');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ AvatarHelper.class_eval do
|
||||
content_tag 'user-avatar',
|
||||
'',
|
||||
'data-class-list': tag_options[:class],
|
||||
'data-user': ::API::V3::Utilities::PathHelper::ApiV3Path.user(user.id),
|
||||
'data-user-name': user.name,
|
||||
'data-use-fallback': 'true'
|
||||
end
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ describe AvatarHelper, type: :helper, with_settings: { protocol: 'http' } do
|
||||
|
||||
def default_expected_user_avatar_tag(user)
|
||||
tag_options = { 'data-use-fallback': "true",
|
||||
'data-user': ::API::V3::Utilities::PathHelper::ApiV3Path.user(user.id),
|
||||
'data-user-name': user.name,
|
||||
'data-class-list': 'avatar avatar-default' }
|
||||
|
||||
content_tag 'user-avatar', '', tag_options
|
||||
|
||||
Reference in New Issue
Block a user