diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a7efa469519505c4c97d413b346d1698338780c8..43e1ae035bfba097f949b4b31814f73f0037973a 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 5157dda7af645004997bfa76e7454d59b025f211..d067a6753a80a76529909494b3a629e070ee7e1d 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -1,4 +1,4 @@ -<h2><%= l(:label_activity) %></h2> +<h2><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, @author.to_s) %></h2> <p class="subtitle"><%= "#{l(:label_date_from)} #{format_date(@date_to - @days)} #{l(:label_date_to).downcase} #{format_date(@date_to-1)}" %></p> <div id="activity"> @@ -52,8 +52,9 @@ <p><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label></p> <%= hidden_field_tag 'with_subprojects', 0 %> <% end %> +<%= hidden_field_tag 'user_id', params[:user_id] %> <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p> <% end %> <% end %> -<% html_title(l(:label_activity)) -%> +<% html_title(l(:label_activity), @author) -%> diff --git a/lang/bg.yml b/lang/bg.yml index 17afe9eb411e235ec0e370aa7cbdd45db52f64cf..40a7b6c8cfc6e8e01a8bc3837adab772ab42ac36 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 4179aa441a0560ca8032360948c45c522c1fdc10..66805c45d5caf10b319c6cf107c2512657a2c7c5 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 189f47244b4911c2ef768ce0a3ca2e94b2279918..e458b31b80a729762fd1e636347f74917168abb5 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 d1b5697133b16048ac05f44d65fc71801b1765a7..d4bce1d50a9ec03ea068071868bc46c0492a2b37 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 b23edd9c34f98dcd2d2b2f2dbeba0943cac03b66..ee38db54e7b2e11bd19cdef6e398294d013feb92 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 80751f0abce062958ae25853cf4d3084e793a608..1d5a664432539194ce8970edd23540353e979eb5 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 74c3d496e358fc69b9475b150b48862f85c9a085..65d08b2cea45db659d2dda48e5088eab7aa8eaf9 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 b028fd1f5e0610fdbcc18849193718b19069f654..fb245412bbce86cfcfb83710cb54805affb7eecf 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 1c2bce3ca3b29b1d1a0f9a05bdb40adc5eef08da..730a43d264bbbd2b443529b87d27812bf411dfa0 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 e32259ba55bde39882b57f00cc08ed3ccad5f8ef..87d3b0851d5c4ca3408707dada1f305b93616375 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 61831cedb4bc73eb7994c91d6cff0e961ee77a5a..af91e1b4bf0933fa36371b3a05687abf55dd94c7 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 d40b487f7112d81cf300c5f7231fb2fe81072ba2..1ee5b72bb5d4a82140a94a3e8c3d55e9f7401ef8 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 8d106bf64374c9718d8bdc4356197150582eb10a..3e9240330570d6f2ccf21fb35df309bf8d54ee88 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 65a5f4434f8be31a95b5a1247799334fca11f42a..b3cc59793edebe6783e6b4d1c64eb54567e22fe6 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 535f0416b7e618a081bd08e5aaebb82b487993af..2e2018f477659b2741907e759c1ba349b25b8c01 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 f138fc89b015856f1e2419f9163d4551f5127e66..216f238f64b38907cdafd7d4f904fb04c7524795 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 db4a320d2ac2bd0c304ac7cb9e113277de56c1c1..6cde8edc62909eeedb5a4c86dc6bfce7bef2d6ee 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 64457b5fb2ca25dcd9adc455e04421344471ec70..01025a6869c5be801413b8ce20c7a658c222877f 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 b6fdf9d024c309b4d16e5be3508d60df1657d842..7083d96809e8c062852e6dc08c771f97714ba2c7 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 604f5dad1305832e679f54055d8b4a8e15cca609..1ada0675b45543f614b52d250c6db610208c0560 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 6527442e27a3ac467730c0ac1dfa6ed4807b56e6..f3a59b20d1b7063497256fa2c3ce0c56dd637fb8 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 24b580d49b14a75c52eb924947c8e93861009779..a96b5cadb3fe008fabe7a51f1f1af870cc4371b4 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 2237be5194ebcf11d1f9d083b95c155583bc71db..09a5f6b5cebc47d80924dbcf7ac4a5d220fde0cb 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 fdfa411d2467805ff7ef46e353e53a342e5b0a01..702dad7a295c5dd017a7d0be6bd880fd5b987ab1 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 b50fc0c42df437f063d870f75ab176b21ab6161b..8c9b6f6efe6de618e63452b93963c9782f5d1696 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 129982dfac4db45c3d36f87fd399fd466e00ffd2..3611b790cfa53c8e9b622793f43a4dbe99153302 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 ba9b4b6258a8e582a585c2fd29181de5157b14f9..8b6ccc6c9e71056f99b9484bce75ce224e09a89a 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 3934e9ad23ca079ca79150616c5489b86a885173..b84392c1670ef76f275c7e084c880a1ce4ccf6b5 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 d1885d9b4e5c0f278dfe678e323c00e90744fe65..ecdfba533291901fe03e41bd324f7d18b0197182 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 cdc54176c1c32382ee7ff0d1abcdb01ec2a18ffc..879e47ca38c4142fed862d3d0a4ff1f34ae6f0ca 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 6c0499010f12097b3f3e61a818634c5348800ec8..9159974c5ced0ac0ee7e7273c57c02b0c0b14913 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 b12caa441592d4904bfa91ca75bf7fd943169a91..1d0bd8a168dd575a06c9142028836fa388cfbc8d 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 1b36a9d6b714a4d1ab9191038e6de0113b9f35b1..d1810b3d4c2082c5fd6420502c9dc26242712e5e 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