diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index 7746ec2f6..cf70bdfd7 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -32,13 +32,15 @@ class ActivitiesController < ApplicationController @date_to ||= User.current.today + 1 @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') - if params[:user_id].present? - @author = User.visible.active.find(params[:user_id]) + @authors = [] + if params[:user_ids].present? + @authors = User.visible.active.where(:id => params[:user_ids]) + raise ActiveRecord::RecordNotFound if @authors.empty? end @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects, - :author => @author) + :authors => @authors) pref = User.current.pref @activity.scope_select {|t| !params["show_#{t}"].nil?} if @activity.scope.present? @@ -47,7 +49,7 @@ class ActivitiesController < ApplicationController pref.save end else - if @author.nil? + if @authors.empty? scope = pref.activity_scope & @activity.event_types @activity.scope = scope.present? ? scope : :default else @@ -62,7 +64,7 @@ class ActivitiesController < ApplicationController @activity.events(@date_from, @date_to) end - if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, events.size, User.current, current_language]) + if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @authors.first, @authors.size, events.first, events.size, User.current, current_language]) respond_to do |format| format.html do @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @@ -70,8 +72,8 @@ class ActivitiesController < ApplicationController end format.atom do title = l(:label_activity) - if @author - title = @author.name + if @authors.any? + title = @authors.map(&:name).join(", ") elsif @activity.scope.size == 1 title = l("label_#{@activity.scope.first.singularize}_plural") end diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 83f67b1b8..1aa5edf5d 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -1,4 +1,4 @@ -

<%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %>

+

<%= @authors.empty? ? l(:label_activity) : l(:label_user_activity, @authors.map{|a| link_to_user(a)}.join(',')).html_safe %>

<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>

@@ -38,7 +38,8 @@

<%= l(:label_user) %> - <%= select_tag('user_id', activity_authors_options_for_select(@project, params[:user_id]), include_blank: true) %> + <%= select_tag('user_ids[]', activity_authors_options_for_select(@project, params[:user_ids]), include_blank: true, multiple: (params[:user_ids]&.count.to_i > 1)) %> +