Skip to content

Commit

Permalink
updated to compatibility with redmine 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nodecarter committed Jan 16, 2013
1 parent 82b1b84 commit f1379c8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -14,4 +14,9 @@ Follow the plugin installation procedure at http://www.redmine.org/wiki/redmine/

## Testing

rake test:engines:all PLUGIN=redmine_non_member_watcher
RAILS_ENV=test rake redmine:plugins:test NAME=redmine_non_member_watcher

## Compatibility

This version supports only redmine 2.x. See [redmine-1.x](https://github.com/Undev/redmine_non_member_watcher/tree/redmine-1.x) branch for Redmine 1.x.

4 changes: 2 additions & 2 deletions init.rb
Expand Up @@ -52,10 +52,10 @@
name 'Redmine Non Member Watcher plugin'
author 'danil.tashkinov@gmail.com'
description 'Redmine plugin that adds new system role "Non member watcher"'
version '0.0.7'
version '0.1.0'
url 'https://github.com/Undev/redmine_non_member_watcher'
author_url 'https://github.com/Undev'
requires_redmine :version_or_higher => '1.4.0'
requires_redmine :version_or_higher => '2.0.0'

project_module :issue_tracking do |map|
map.permission :receive_email_notifications, {}, :require => :member_non_watcher
Expand Down
11 changes: 6 additions & 5 deletions lib/redmine_non_member_watcher/role_patch.rb
Expand Up @@ -68,11 +68,12 @@ def self.redefine_issues_visibility(base)
base.const_set :ISSUES_VISIBILITY_OPTIONS, new_issues_visibility_options

# find validation callback with the old list and disable it
# todo: can't find the best way to redefine callback
Role.validate_callback_chain.each do |callback|
if callback.options[:in] == old_validation_opts
callback.instance_eval { @method = proc { |*args| true } }
end
filters = Role._validate_callbacks.select do |c|
c.options[:in] == old_validation_opts
end.map(&:filter)

filters.each do |filter|
Role.skip_callback(:validate, :before, filter)
end

# define callback with new list
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
@@ -1,5 +1,5 @@
# Load the normal Rails helper
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')

# Ensure that we are using the temporary fixture path
# Engines::Testing.set_fixture_path
Expand Down
Expand Up @@ -11,7 +11,7 @@ def test_defined_new_visibility_option
def test_validate_new_visibility_option
role = Role.non_member_watcher
role.issues_visibility = 'watch'
assert_valid role
assert_true role.valid?
end

context "#non_member_watcher" do
Expand Down

0 comments on commit f1379c8

Please sign in to comment.