user: Remove verbose name expression in mention
@0296a9dc6e7eb81e7436186d956a8a4407fdbe79
--- app/models/User.java
+++ app/models/User.java
... | ... | @@ -991,4 +991,16 @@ |
991 | 991 |
public boolean isLocked() { |
992 | 992 |
return this.state == UserState.LOCKED || this.state == UserState.DELETED; |
993 | 993 |
} |
994 |
+ |
|
995 |
+ public String getPureNameOnly(){ |
|
996 |
+ String pureName = this.name; |
|
997 |
+ String [] spliters = { "[", "(" }; |
|
998 |
+ for(String spliter: spliters) { |
|
999 |
+ if(pureName.contains(spliter)){ |
|
1000 |
+ pureName = this.name.substring(0, this.name.indexOf(spliter)); |
|
1001 |
+ } |
|
1002 |
+ } |
|
1003 |
+ |
|
1004 |
+ return pureName; |
|
1005 |
+ } |
|
994 | 1006 |
} |
--- app/utils/AutoLinkRenderer.java
+++ app/utils/AutoLinkRenderer.java
... | ... | @@ -328,9 +328,9 @@ |
328 | 328 |
if( user.avatarUrl().equals(UserApp.DEFAULT_AVATAR_URL) ){ |
329 | 329 |
avatarImage = ""; |
330 | 330 |
} else { |
331 |
- avatarImage = "<img src='" + user.avatarUrl() + "' class='avatar-wrap smaller no-margin-no-padding vertical-top' alt='@" + user.loginId + "'> "; |
|
331 |
+ avatarImage = "<img src='" + user.avatarUrl() + "' class='avatar-wrap smaller no-margin-no-padding vertical-top' alt='@" + user.name + " " + user.loginId + "'> "; |
|
332 | 332 |
} |
333 |
- return new Link(RouteUtil.getUrl(user), "no-text-decoration", "<span data-toggle='popover' data-placement='top' data-trigger='hover' data-html='true' data-content=\"" + StringEscapeUtils.escapeHtml4(avatarImage + user.loginId) + "\">@" + user.name + "</span>"); |
|
333 |
+ return new Link(RouteUtil.getUrl(user), "no-text-decoration", "<span data-toggle='popover' data-placement='top' data-trigger='hover' data-html='true' data-content=\"" + StringEscapeUtils.escapeHtml4(avatarImage + user.name + " " + user.loginId) + "\">@" + user.getPureNameOnly() + "</span>"); |
|
334 | 334 |
} |
335 | 335 |
} |
336 | 336 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?