Patch #34595

Filter list of recent projects in the project jump box

Added by Holger Just 9 months ago. Updated 7 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Projects
Target version:4.1.2

Description

The attached patch makes sure that only currently visible projects are included in the project jump box, removing archived projects and projects the user is not allowed to view anymore.

The patch should apply cleanly on current trunk.

0001-Only-show-currently-visible-projects-in-the-project-.patch Magnifier (826 Bytes) Holger Just, 2021-01-14 20:30

0003-Add-a-test-for-34595.patch Magnifier (1.13 KB) Marius BALTEANU, 2021-03-15 23:51

0002-Fix-failing-tests.patch Magnifier (917 Bytes) Marius BALTEANU, 2021-03-15 23:51

0001-Apply-patch-from-34595.patch Magnifier (760 Bytes) Marius BALTEANU, 2021-03-15 23:51

Associated revisions

Revision 20735
Added by Go MAEDA 8 months ago

Only show currently visible projects in the project jump box (#34595).

Patch by Holger Just.

Revision 20736
Added by Go MAEDA 8 months ago

Reverts r20735

Revision 20803
Added by Go MAEDA 7 months ago

Only show currently visible projects in the project jump box (#34595).

Patch by Holger Just and Marius BALTEANU.

Revision 20804
Added by Go MAEDA 7 months ago

Merged r20803 from trunk to 4.1-stable (#34595).

History

#1 Updated by Marius BALTEANU 8 months ago

  • Target version set to 4.1.2

#2 Updated by Go MAEDA 8 months ago

  • Category set to Projects
  • Status changed from New to Resolved
  • Assignee set to Go MAEDA

Committed the fix. Thank you.

#3 Updated by Go MAEDA 8 months ago

  • Assignee deleted (Go MAEDA)

The patch lacks one dot after "visible". Here is an updated patch.

Index: lib/redmine/project_jump_box.rb
===================================================================
--- lib/redmine/project_jump_box.rb    (リビジョン 20737)
+++ lib/redmine/project_jump_box.rb    (作業コピー)
@@ -31,6 +31,7 @@
     def recently_used_projects
       project_ids = recently_used_project_ids
       Project.where(id: project_ids).
+        visible.
         index_by(&:id).
         values_at(*project_ids). # sort according to stored order
         compact

#4 Updated by Holger Just 8 months ago

Ah sorry :(

I extracted the patch from our internal Redmine version where we have other changes in this code area. Your updated patch should work.

#5 Updated by Go MAEDA 7 months ago

  • Status changed from Resolved to New

#6 Updated by Marius BALTEANU 7 months ago

Some tests fail:

root@d7a989d3c810:/work# ruby  test/unit/lib/redmine/project_jump_box_test.rb 
Run options: --seed 4246

# Running:

F

Failure:
Redmine::ProjectJumpBoxTest#test_should_limit_recently_used_projects [test/unit/lib/redmine/project_jump_box_test.rb:60]:
Expected: 1
  Actual: 0

bin/rails test test/unit/lib/redmine/project_jump_box_test.rb:53

.F

Failure:
Redmine::ProjectJumpBoxTest#test_should_record_recently_used_projects_order [test/unit/lib/redmine/project_jump_box_test.rb:70]:
Expected: 2
  Actual: 1

bin/rails test test/unit/lib/redmine/project_jump_box_test.rb:63

...F

Failure:
Redmine::ProjectJumpBoxTest#test_should_update_recents_list [test/unit/lib/redmine/project_jump_box_test.rb:134]:
Expected: 2
  Actual: 1

bin/rails test test/unit/lib/redmine/project_jump_box_test.rb:118

Finished in 0.402722s, 17.3817 runs/s, 64.5606 assertions/s.
7 runs, 26 assertions, 3 failures, 0 errors, 0 skips

The attached patches fix those failings tests and add a test to ensure that only visible projects are listed.

https://gitlab.com/redmine-org/redmine/-/pipelines/270899596

#7 Updated by Go MAEDA 7 months ago

  • Status changed from New to Closed

Committed the patch. Thank you.

Also available in: Atom PDF