Skip to content

The Unified and Autonomous Development Platform

Fix bug of @user in comment input

robin shen27e29ec39dd8
diff --git a/web/src/main/java/com/gitplex/server/web/component/comment/CommentInput.java b/web/src/main/java/com/gitplex/server/web/component/comment/CommentInput.java
index 851a7c7653..652994f12b 100644
--- a/web/src/main/java/com/gitplex/server/web/component/comment/CommentInput.java
+++ b/web/src/main/java/com/gitplex/server/web/component/comment/CommentInput.java
@@ -58,7 +58,8 @@ public abstract class CommentInput extends TextArea<String> {
for (Account user: queryUsers(userQuery, ATWHO_LIMIT)) {
Map<String, String> userMap = new HashMap<>();
userMap.put("name", user.getName());
- userMap.put("fullName", user.getFullName());
+ if (user.getFullName() != null)
+ userMap.put("fullName", user.getFullName());
if (user.getNoSpaceFullName() != null)
userMap.put("searchKey", user.getNoSpaceName() + " " + user.getNoSpaceFullName());
else
@@ -129,6 +130,7 @@ public abstract class CommentInput extends TextArea<String> {
Restrictions.ilike("noSpaceName", query, MatchMode.ANYWHERE),
Restrictions.ilike("noSpaceFullName", query, MatchMode.ANYWHERE)));
}
+ criteria.add(Restrictions.eq("organization", false));
criteria.addOrder(Order.asc("name"));
return GitPlex.getInstance(Dao.class).findRange(criteria, 0, count);
}
diff --git a/web/src/main/java/com/gitplex/server/web/component/comment/comment-input.js b/web/src/main/java/com/gitplex/server/web/component/comment/comment-input.js
index f290313fb8..4288c39ea2 100644
--- a/web/src/main/java/com/gitplex/server/web/component/comment/comment-input.js
+++ b/web/src/main/java/com/gitplex/server/web/component/comment/comment-input.js
@@ -19,7 +19,13 @@ gitplex.server.comment = function(inputId, atWhoLimit, callback) {
callback("userQuery", query);
}
},
- displayTpl: "<li><span class='avatar'><img src='${avatarUrl}'/></span> ${name} <small>${fullName}</small></li>",
+ displayTpl: function(dataItem) {
+ if (dataItem.fullName) {
+ return "<li><span class='avatar'><img src='${avatarUrl}'/></span> ${name} <small>${fullName}</small></li>";
+ } else {
+ return "<li><span class='avatar'><img src='${avatarUrl}'/></span> ${name}</li>";
+ }
+ },
limit: atWhoLimit
});