diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a7efa469..43e1ae03 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -227,10 +227,13 @@ class ProjectsController < ApplicationController @date_to ||= Date.today + 1 @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') + @author = (params[:user_id] ? User.find_active(params[:user_id]) : nil) - @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects) + @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, + :with_subprojects => @with_subprojects, + :author => @author) @activity.scope_select {|t| !params["show_#{t}"].nil?} - @activity.default_scope! if @activity.scope.empty? + @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? events = @activity.events(@date_from, @date_to) @@ -240,10 +243,18 @@ class ProjectsController < ApplicationController render :layout => false if request.xhr? } format.atom { - title = (@activity.scope.size == 1) ? l("label_#{@activity.scope.first.singularize}_plural") : l(:label_activity) + title = l(:label_activity) + if @author + title = @author.name + elsif @activity.scope.size == 1 + title = l("label_#{@activity.scope.first.singularize}_plural") + end render_feed(events, :title => "#{@project || Setting.app_title}: #{title}") } end + + rescue ActiveRecord::RecordNotFound + render_404 end private diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index 5157dda7..d067a675 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -1,4 +1,4 @@ -
<%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %>
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
<% end %> <% end %> -<% html_title(l(:label_activity)) -%> +<% html_title(l(:label_activity), @author) -%> diff --git a/lang/bg.yml b/lang/bg.yml index 17afe9eb..40a7b6c8 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -692,3 +692,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/ca.yml b/lang/ca.yml index 4179aa44..66805c45 100644 --- a/lang/ca.yml +++ b/lang/ca.yml @@ -693,3 +693,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/cs.yml b/lang/cs.yml index 189f4724..e458b31b 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -697,3 +697,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/da.yml b/lang/da.yml index d1b56971..d4bce1d5 100644 --- a/lang/da.yml +++ b/lang/da.yml @@ -693,3 +693,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/de.yml b/lang/de.yml index b23edd9c..ee38db54 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -694,3 +694,4 @@ default_activity_development: Entwicklung enumeration_issue_priorities: Ticket-Prioritäten enumeration_doc_categories: Dokumentenkategorien enumeration_activities: Aktivitäten (Zeiterfassung) +label_user_activity: "%s's activity" diff --git a/lang/en.yml b/lang/en.yml index 80751f0a..1d5a6644 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -344,6 +344,7 @@ label_last_updates_plural: %d last updated label_registered_on: Registered on label_activity: Activity label_overall_activity: Overall activity +label_user_activity: "%s's activity" label_new: New label_logged_as: Logged in as label_environment: Environment diff --git a/lang/es.yml b/lang/es.yml index 74c3d496..65d08b2c 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -677,3 +677,4 @@ text_user_mail_option: "En los proyectos no seleccionados, sólo recibirá notif text_user_wrote: '%s escribió:' text_wiki_destroy_confirmation: ¿Seguro que quiere borrar el wiki y todo su contenido? text_workflow_edit: Seleccionar un flujo de trabajo para actualizar +label_user_activity: "%s's activity" diff --git a/lang/fi.yml b/lang/fi.yml index b028fd1f..fb245412 100644 --- a/lang/fi.yml +++ b/lang/fi.yml @@ -692,3 +692,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/fr.yml b/lang/fr.yml index 1c2bce3c..730a43d2 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -170,7 +170,6 @@ field_start_page: Page de démarrage field_subproject: Sous-projet field_hours: Heures field_activity: Activité -label_overall_activity: Activité globale field_spent_on: Date field_identifier: Identifiant field_is_filter: Utilisé comme filtre @@ -344,6 +343,8 @@ label_last_updates: Dernière mise à jour label_last_updates_plural: %d dernières mises à jour label_registered_on: Inscrit le label_activity: Activité +label_overall_activity: Activité globale +label_user_activity: "Activité de %s" label_new: Nouveau label_logged_as: Connecté en tant que label_environment: Environnement diff --git a/lang/he.yml b/lang/he.yml index e32259ba..87d3b085 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -692,3 +692,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/hu.yml b/lang/hu.yml index 61831ced..af91e1b4 100644 --- a/lang/hu.yml +++ b/lang/hu.yml @@ -693,3 +693,4 @@ label_example: Példa text_repository_usernames_mapping: "Állítsd be a felhasználó összerendeléseket a Redmine, és a tároló logban található felhasználók között.\nAz azonos felhasználó nevek összerendelése automatikusan megtörténik." permission_edit_own_messages: Saját üzenetek szerkesztése permission_delete_own_messages: Saját üzenetek törlése +label_user_activity: "%s's activity" diff --git a/lang/it.yml b/lang/it.yml index d40b487f..1ee5b72b 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -692,3 +692,4 @@ label_example: Esempio text_repository_usernames_mapping: "Seleziona per aggiornare la corrispondenza tra gli utenti Redmine e quelli presenti nel log del repository.\nGli utenti Redmine e repository con lo stesso username o email sono mappati automaticamente." permission_edit_own_messages: Modifica propri messaggi permission_delete_own_messages: Elimina propri messaggi +label_user_activity: "%s's activity" diff --git a/lang/ja.yml b/lang/ja.yml index 8d106bf6..3e924033 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -693,3 +693,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/ko.yml b/lang/ko.yml index 65a5f443..b3cc5979 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -692,3 +692,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/lt.yml b/lang/lt.yml index 535f0416..2e2018f4 100644 --- a/lang/lt.yml +++ b/lang/lt.yml @@ -694,3 +694,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/nl.yml b/lang/nl.yml index f138fc89..216f238f 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -694,3 +694,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/no.yml b/lang/no.yml index db4a320d..6cde8edc 100644 --- a/lang/no.yml +++ b/lang/no.yml @@ -693,3 +693,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/pl.yml b/lang/pl.yml index 64457b5f..01025a68 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -711,3 +711,4 @@ text_user_wrote: '%s napisał:' text_wiki_destroy_confirmation: Jesteś pewien, że chcesz usunąć to wiki i całą jego zawartość ? text_workflow_edit: Zaznacz rolę i typ zagadnienia do edycji przepływu +label_user_activity: "%s's activity" diff --git a/lang/pt-br.yml b/lang/pt-br.yml index b6fdf9d0..7083d968 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -693,3 +693,4 @@ label_example: Exemplo text_repository_usernames_mapping: "Seleciona ou atualiza os usuários do Redmine mapeando para cada usuário encontrado no log do repositório.\nUsuários com o mesmo login ou email no Redmine e no repositório serão mapeados automaticamente." permission_edit_own_messages: Editar próprias mensagens permission_delete_own_messages: Excluir próprias mensagens +label_user_activity: "%s's activity" diff --git a/lang/pt.yml b/lang/pt.yml index 604f5dad..1ada0675 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -694,3 +694,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/ro.yml b/lang/ro.yml index 6527442e..f3a59b20 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -692,3 +692,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/ru.yml b/lang/ru.yml index 24b580d4..a96b5cad 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -725,3 +725,4 @@ text_user_mail_option: "Для невыбранных проектов, Вы б text_user_wrote: '%s написал(а):' text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все ее содержимое? text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний +label_user_activity: "%s's activity" diff --git a/lang/sk.yml b/lang/sk.yml index 2237be51..09a5f6b5 100644 --- a/lang/sk.yml +++ b/lang/sk.yml @@ -698,3 +698,4 @@ label_example: Príklad permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." +label_user_activity: "%s's activity" diff --git a/lang/sr.yml b/lang/sr.yml index fdfa411d..702dad7a 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -693,3 +693,4 @@ setting_gravatar_enabled: Use Gravatar user icons permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages text_repository_usernames_mapping: "Select or update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." +label_user_activity: "%s's activity" diff --git a/lang/sv.yml b/lang/sv.yml index b50fc0c4..8c9b6f6e 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -693,3 +693,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/th.yml b/lang/th.yml index 129982df..3611b790 100644 --- a/lang/th.yml +++ b/lang/th.yml @@ -695,3 +695,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/tr.yml b/lang/tr.yml index ba9b4b62..8b6ccc6c 100644 --- a/lang/tr.yml +++ b/lang/tr.yml @@ -693,3 +693,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/uk.yml b/lang/uk.yml index 3934e9ad..b84392c1 100644 --- a/lang/uk.yml +++ b/lang/uk.yml @@ -694,3 +694,4 @@ label_example: Example text_repository_usernames_mapping: "Select ou update the Redmine user mapped to each username found in the repository log.\nUsers with the same Redmine and repository username or email are automatically mapped." permission_edit_own_messages: Edit own messages permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/vn.yml b/lang/vn.yml index d1885d9b..ecdfba53 100644 --- a/lang/vn.yml +++ b/lang/vn.yml @@ -695,3 +695,4 @@ permission_delete_own_messages: Xóa bài viết cá nhân label_example: Ví dụ text_repository_usernames_mapping: "Chọn hoặc cập nhật ánh xạ người dùng hệ thống với người dùng trong kho lưu trữ.\nNhững trường hợp trùng hợp về tên và email sẽ được tự động ánh xạ." permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml index cdc54176..879e47ca 100644 --- a/lang/zh-tw.yml +++ b/lang/zh-tw.yml @@ -694,3 +694,4 @@ default_activity_development: 開發 enumeration_issue_priorities: 項目優先權 enumeration_doc_categories: 文件分類 enumeration_activities: 活動 (時間追蹤) +label_user_activity: "%s's activity" diff --git a/lang/zh.yml b/lang/zh.yml index 6c049901..9159974c 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -695,3 +695,4 @@ enumeration_issue_priorities: 问题优先级 enumeration_doc_categories: 文档类别 enumeration_activities: 活动(时间跟踪) permission_delete_own_messages: Delete own messages +label_user_activity: "%s's activity" diff --git a/lib/redmine/activity/fetcher.rb b/lib/redmine/activity/fetcher.rb index b12caa44..1d0bd8a1 100644 --- a/lib/redmine/activity/fetcher.rb +++ b/lib/redmine/activity/fetcher.rb @@ -48,8 +48,16 @@ module Redmine end # Sets the scope + # Argument can be :all, :default or an array of event types def scope=(s) - @scope = s & event_types + case s + when :all + @scope = event_types + when :default + default_scope! + else + @scope = s & event_types + end end # Resets the scope to the default scope diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 1b36a9d6..d1810b3d 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -203,6 +203,24 @@ class ProjectsControllerTest < Test::Unit::TestCase } end + def test_user_activity + get :activity, :user_id => 2 + assert_response :success + assert_template 'activity' + assert_not_nil assigns(:events_by_day) + + assert_tag :tag => "h3", + :content => /#{3.day.ago.to_date.day}/, + :sibling => { :tag => "dl", + :child => { :tag => "dt", + :attributes => { :class => /issue/ }, + :child => { :tag => "a", + :content => /#{Issue.find(1).subject}/, + } + } + } + end + def test_activity_atom_feed get :activity, :format => 'atom' assert_response :success