diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-08-19 11:13:04 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-08-19 11:22:30 +0200 |
commit | 2b4920d26b7a72f47a4c44689f71fa77621a6260 (patch) | |
tree | 9522a45583411b55d530978c1e43b8ccfe2ca8ba /server/sonar-web | |
parent | 2f2e45e676f3939fcbfe986c40a8b2b60454d79d (diff) | |
download | sonarqube-2b4920d26b7a72f47a4c44689f71fa77621a6260.tar.gz sonarqube-2b4920d26b7a72f47a4c44689f71fa77621a6260.zip |
fix displaying of issue comments
Diffstat (limited to 'server/sonar-web')
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}} {{userName}} + <div class="issue-comment-author" title="{{authorName}}"> + {{#ifShowAvatars}}{{avatarHelper authorEmail 16}}{{else}} + <i class="icon-comment icon-half-transparent"></i>{{/ifShowAvatars}} {{authorName}} </div> <div class="issue-comment-text markdown">{{{show html htmlText}}}</div> <div class="issue-comment-age">({{fromNow createdAt}})</div> |