Skip to content

Commit 83b5060

Browse files
authored
Merge pull request #7 from gtt-project/feature/support-zeitwerk
Support zeitwerk
2 parents 6b18e9f + 9215d6c commit 83b5060

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This plugin lets you add several privacy related options to Redmine projects
44

55
## Requirements
66

7-
- Redmine >= 3.4.0
7+
- Redmine >= 4.0.0
88

99
## Installation
1010

@@ -36,13 +36,17 @@ The GTT Project appreciates any [contributions](https://github.com/gtt-project/.
3636

3737
## Version History
3838

39+
- 2.0.0 Support Redmine 5.0 and drop Redmine <= 3.4 support
40+
- 1.3.2 Publish on GitHub
41+
3942
See [all releases](https://github.com/gtt-project/redmine_privacy/releases) with release notes.
4043

4144
## Authors
4245

4346
- [Jens Kraemer](https://github.com/jkraemer)
44-
- [Ko Nagase](https://github.com/sanak)
4547
- [Daniel Kastl](https://github.com/dkastl)
48+
- [Thibault Mutabazi](https://github.com/eyewritecode)
49+
- [Ko Nagase](https://github.com/sanak)
4650
- ... [and others](https://github.com/gtt-project/redmine_privacy/graphs/contributors)
4751

4852
## LICENSE

init.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
require 'redmine'
1+
require File.expand_path('../lib/redmine_privacy/view_hooks', __FILE__)
22

3-
Rails.configuration.to_prepare do
4-
RedminePrivacy.setup
3+
if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
4+
Rails.application.config.after_initialize do
5+
RedminePrivacy.setup
6+
end
7+
else
8+
require 'redmine_privacy'
9+
Rails.configuration.to_prepare do
10+
RedminePrivacy.setup
11+
end
512
end
613

714
Redmine::Plugin.register :redmine_privacy do
@@ -10,9 +17,9 @@
1017
author_url 'https://github.com/georepublic'
1118
url 'https://github.com/gtt-project/redmine_privacy'
1219
description 'Adds several privacy related options to Redmine'
13-
version '1.3.2'
20+
version '2.0.0'
1421

15-
requires_redmine version_or_higher: '3.4.0'
22+
requires_redmine version_or_higher: '4.0.0'
1623

1724
settings default: { }, partial: 'redmine_privacy/settings'
1825

lib/redmine_privacy.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,3 @@ def self.displayname_fallback
2828
User::USER_FORMATS.keys.first
2929
end
3030
end
31-
32-
require 'redmine_privacy/view_hooks'

lib/redmine_privacy/patches/projects_controller_patch.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ def self.apply
66
ProjectsController.prepend self unless ProjectsController < self
77
end
88

9-
10-
def respond_to(*_, &block)
11-
if params[:action] == 'show'
12-
# having no users effectively hides the project members box
13-
if Redmine::VERSION.to_a[0] >= 4 && Redmine::VERSION.to_a[1] >= 2
14-
@principals_by_role = []
15-
else
16-
@users_by_role = []
17-
end
9+
def show
10+
respond_to do |format|
11+
format.html {
12+
super
13+
# having no users effectively hides the project members box
14+
if Redmine::VERSION.to_s >= '4.2'
15+
@principals_by_role = []
16+
else
17+
@users_by_role = []
18+
end
19+
}
20+
format.any { super }
1821
end
19-
super(*_, &block)
2022
end
2123
end
2224
end

0 commit comments

Comments
 (0)