aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb25
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb29
3 files changed, 31 insertions, 27 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
index fba5a4b286e..66407eb2395 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
@@ -18,6 +18,8 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+require 'set'
+
class IssueController < ApplicationController
helper SourceHelper
@@ -210,25 +212,20 @@ class IssueController < ApplicationController
@action_plan = Internal.issues.findActionPlan(@issue.actionPlanKey()) if @issue.actionPlanKey()
@comments = Internal.issues.findComments(issue_key)
- @users = {}
- add_user(@issue.assignee(), @users)
- add_user(@issue.reporter(), @users)
+ user_logins = Set.new
+ user_logins << @issue.assignee() if @issue.assignee()
+ user_logins << @issue.reporter() if @issue.reporter()
@comments .each do |comment|
- add_user(comment.userLogin(), @users)
+ user_logins << comment.userLogin() if comment.userLogin()
+ end
+ users = Internal.users_api.find({'logins', user_logins})
+ @users = {}
+ users.each do |u|
+ @users[u.login()] = u
end
resource = Project.by_key(@issue.componentKey())
@snapshot = resource.last_snapshot if resource.last_snapshot
end
- def add_user(user_login, users_by_login)
- if user_login
- user = users_by_login[user_login]
- unless user
- user = Internal.users_api.findByLogin(user_login)
- users_by_login[user_login] = user
- end
- end
- end
-
end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
index e73ad0ee049..cfd05042470 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
@@ -134,9 +134,9 @@ class IssuesController < ApplicationController
# SONAR-4654 pagination parameters should be remove when loading issues for bulk change
issues_query_params.delete('pageIndex')
if params[:id]
- @issues = Internal.issues.execute2(params[:id].to_i, issues_query_params)
+ @issues = Internal.issues.execute(params[:id].to_i, issues_query_params).issues()
else
- @issues = Internal.issues.execute2(issues_query_params)
+ @issues = Internal.issues.execute(issues_query_params).issues()
end
@projects = Set.new(@issues.map {|issue| issue.projectKey()})
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb
index 44543daccd3..9d98f417401 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb
@@ -7,15 +7,26 @@
search_options['pageSize'] = table_limit.to_i
if search_options['filter']
- issue_filter_result = Internal.issues.execute(search_options['filter'].to_i, search_options)
- results = issue_filter_result.result
+ results = Internal.issues.execute(search_options['filter'].to_i, search_options)
else
search_options['sort'] = 'UPDATE_DATE'
search_options['asc'] = 'FALSE'
- results = Api.issues.find(search_options)
+ results = Internal.issues.execute(search_options)
+ end
+ issues = results.issues()
+ paging = results.paging()
+
+ user_logins = Set.new
+ comments = Internal.issues.findCommentsByIssueKeys(issues.map {|i| i.key()})
+ comments.each do |c|
+ user_logins << c.userLogin()
+ end
+
+ users = Internal.users_api.find({'logins', user_logins})
+ users_by_login = {}
+ users.each do |u|
+ users_by_login[u.login()] = u
end
- issues = results.issues
- paging = results.paging
%>
<% if paging.total() == 0 %>
@@ -32,8 +43,7 @@
<tbody>
<%
issues.each do |issue|
- # TODO replace issue.comments by a call to the service to get comments
- last_comment = issue.comments.get(issue.comments.size - 1) if !issue.comments.isEmpty()
+ last_comment = comments.get(comments.size - 1) unless comments.isEmpty()
%>
<tr class="<%= cycle 'even', 'odd', :name => ('issues-widget-list-' + widget_id) -%>">
<td><i class="icon-severity-<%= issue.severity.downcase -%>"></i></td>
@@ -43,7 +53,7 @@
<% if last_comment && last_comment.userLogin() %>
<div class="comment-excerpt">
<img src="<%= ApplicationController.root_context -%>/images/reviews/comment.png"/>
- <% commentAuthor = results.user(last_comment.userLogin()) %>
+ <% commentAuthor = users_by_login[last_comment.userLogin()] %>
&nbsp;<b><%= h( commentAuthor.nil? ? last_comment.userLogin() : commentAuthor.name() ) -%> :</b>
<%= Internal.text.markdownToHtml(last_comment.markdownText) -%>
</div>
@@ -57,9 +67,6 @@
end
%>
</tbody>
- <% if results.maxResultsReached() %>
- <p class="notes"><%= message('issue_filter.widget.max_results_reached', :params => paging.total()) -%></p>
- <% end %>
<%
link_params = search_options.clone
link_params[:controller] = 'issue'