Project

General

Profile

Actions

Defect #34805

closed

Activity tab in cross-project menu is sometimes broken

Added by Felix Schäfer about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
UI
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

When navigating to a page for a global object the "Activity" tab in the tab menu might link to /projects/:id/activity with the ID of the object instead of /activity. This is the wrong link and the link might be broken.

For example, when editing an issue query that is for all projects with the ID 123, the URL of the page is /queries/123/edit. In that case the "Activity" tab will implicitly use the ID of the query to construct the activity link and the "Activity" tab will link to /projects/123/activity. As the query is a query for all projects the tabs shown are for the :application_menu and the link should be to the global activity and not the specific activity of a project. Furthermore, a project with that ID might not exist so this might lead to an error page.

I hope this explanation was clear, if there is any doubt feel free to ask for a clarification.


Files

34805.diff (1.25 KB) 34805.diff Felix Schäfer, 2021-02-25 17:48
Actions #1

Updated by Felix Schäfer about 3 years ago

The following patch (also attached) fixes the issue and adds a test:

diff --git a/lib/redmine.rb b/lib/redmine.rb
index 2d4dd0f7d..142b60888 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -225,7 +225,7 @@ Redmine::MenuManager.map :application_menu do |menu|
   menu.push :projects, {:controller => 'projects', :action => 'index'},
             :permission => nil,
             :caption => :label_project_plural
-  menu.push :activity, {:controller => 'activities', :action => 'index'}
+  menu.push :activity, {:controller => 'activities', :action => 'index', :id => nil}
   menu.push(
     :issues,
     {:controller => 'issues', :action => 'index'},
diff --git a/test/integration/lib/redmine/menu_manager_test.rb b/test/integration/lib/redmine/menu_manager_test.rb
index 07fbcc332..318bc6129 100644
--- a/test/integration/lib/redmine/menu_manager_test.rb
+++ b/test/integration/lib/redmine/menu_manager_test.rb
@@ -126,6 +126,12 @@ class MenuManagerTest < Redmine::IntegrationTest
     end
   end

+  def test_cross_project_menu_should_link_to_global_activity
+    log_user('dlopper', 'foo')
+    get '/queries/3/edit'
+    assert_select 'a.activity[href=?]', '/activity'
+  end
+
   def test_project_menu_should_show_roadmap_if_subprojects_have_versions
     Version.delete_all
     # Create a version in the project "eCookbook Subproject 1" 
Actions #2

Updated by Go MAEDA about 3 years ago

  • Status changed from New to Confirmed
  • Target version set to 4.1.2

Setting the target version to 4.1.2.

Actions #3

Updated by Go MAEDA about 3 years ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you.

Actions #4

Updated by Go MAEDA about 3 years ago

  • Status changed from Resolved to Closed
  • Target version changed from 4.1.2 to 4.2.0
Actions

Also available in: Atom PDF