aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-08-19 11:13:04 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-08-19 11:22:30 +0200
commit2b4920d26b7a72f47a4c44689f71fa77621a6260 (patch)
tree9522a45583411b55d530978c1e43b8ccfe2ca8ba /server/sonar-web
parent2f2e45e676f3939fcbfe986c40a8b2b60454d79d (diff)
downloadsonarqube-2b4920d26b7a72f47a4c44689f71fa77621a6260.tar.gz
sonarqube-2b4920d26b7a72f47a4c44689f71fa77621a6260.zip
fix displaying of issue comments
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/models/issues.js15
-rw-r--r--server/sonar-web/src/main/js/components/issue/collections/issues.js15
-rw-r--r--server/sonar-web/src/main/js/components/issue/models/issue.js15
-rw-r--r--server/sonar-web/src/main/js/components/issue/templates/issue.hbs6
4 files changed, 48 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/models/issues.js b/server/sonar-web/src/main/js/apps/issues/models/issues.js
index cc617bd6eca..aca2e2ac2bf 100644
--- a/server/sonar-web/src/main/js/apps/issues/models/issues.js
+++ b/server/sonar-web/src/main/js/apps/issues/models/issues.js
@@ -25,6 +25,20 @@ define([
return issue;
},
+ _injectCommentsRelational: function (issue, users) {
+ if (issue.comments) {
+ var that = this;
+ var newComments = issue.comments.map(function (comment) {
+ var newComment = _.extend({}, comment, { author: comment.login });
+ delete newComment.login;
+ newComment = that._injectRelational(newComment, users, 'author', 'login');
+ return newComment;
+ });
+ issue = _.extend({}, issue, { comments: newComments });
+ }
+ return issue;
+ },
+
_prepareClosed: function (issue) {
if (issue.status === 'CLOSED') {
issue.secondaryLocations = [];
@@ -45,6 +59,7 @@ define([
issue = that._injectRelational(issue, r.users, 'assignee', 'login');
issue = that._injectRelational(issue, r.users, 'reporter', 'login');
issue = that._injectRelational(issue, r.actionPlans, 'actionPlan', 'key');
+ issue = that._injectCommentsRelational(issue, r.users);
issue = that._prepareClosed(issue);
return issue;
});
diff --git a/server/sonar-web/src/main/js/components/issue/collections/issues.js b/server/sonar-web/src/main/js/components/issue/collections/issues.js
index e3cdca48a9e..f40f9a30246 100644
--- a/server/sonar-web/src/main/js/components/issue/collections/issues.js
+++ b/server/sonar-web/src/main/js/components/issue/collections/issues.js
@@ -25,6 +25,20 @@ define([
return issue;
},
+ _injectCommentsRelational: function (issue, users) {
+ if (issue.comments) {
+ var that = this;
+ var newComments = issue.comments.map(function (comment) {
+ var newComment = _.extend({}, comment, { author: comment.login });
+ delete newComment.login;
+ newComment = that._injectRelational(newComment, users, 'author', 'login');
+ return newComment;
+ });
+ issue = _.extend({}, issue, { comments: newComments });
+ }
+ return issue;
+ },
+
_prepareClosed: function (issue) {
if (issue.status === 'CLOSED') {
issue.secondaryLocations = [];
@@ -52,6 +66,7 @@ define([
issue = that._injectRelational(issue, r.users, 'assignee', 'login');
issue = that._injectRelational(issue, r.users, 'reporter', 'login');
issue = that._injectRelational(issue, r.actionPlans, 'actionPlan', 'key');
+ issue = that._injectCommentsRelational(issue, r.users);
issue = that._prepareClosed(issue);
return issue;
});
diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js
index c29abed0973..62f74ceb507 100644
--- a/server/sonar-web/src/main/js/components/issue/models/issue.js
+++ b/server/sonar-web/src/main/js/components/issue/models/issue.js
@@ -28,6 +28,7 @@ define(function () {
issue = this._injectRelational(issue, r.users, 'assignee', 'login');
issue = this._injectRelational(issue, r.users, 'reporter', 'login');
issue = this._injectRelational(issue, r.actionPlans, 'actionPlan', 'key');
+ issue = this._injectCommentsRelational(issue, r.users);
issue = this._prepareClosed(issue);
return issue;
} else {
@@ -51,6 +52,20 @@ define(function () {
return issue;
},
+ _injectCommentsRelational: function (issue, users) {
+ if (issue.comments) {
+ var that = this;
+ var newComments = issue.comments.map(function (comment) {
+ var newComment = _.extend({}, comment, { author: comment.login });
+ delete newComment.login;
+ newComment = that._injectRelational(newComment, users, 'author', 'login');
+ return newComment;
+ });
+ issue = _.extend({}, issue, { comments: newComments });
+ }
+ return issue;
+ },
+
_prepareClosed: function (issue) {
if (issue.status === 'CLOSED') {
issue.secondaryLocations = [];
diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
index 7b12f2db96e..61a03ecb248 100644
--- a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
+++ b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
@@ -142,9 +142,9 @@
<div class="issue-comments">
{{#each comments}}
<div class="issue-comment" data-comment-key="{{key}}">
- <div class="issue-comment-author" title="{{userName}}">
- {{#ifShowAvatars}}{{avatarHelper email 16}}{{else}}
- <i class="icon-comment icon-half-transparent"></i>{{/ifShowAvatars}}&nbsp;{{userName}}
+ <div class="issue-comment-author" title="{{authorName}}">
+ {{#ifShowAvatars}}{{avatarHelper authorEmail 16}}{{else}}
+ <i class="icon-comment icon-half-transparent"></i>{{/ifShowAvatars}}&nbsp;{{authorName}}
</div>
<div class="issue-comment-text markdown">{{{show html htmlText}}}</div>
<div class="issue-comment-age">({{fromNow createdAt}})</div>