プロジェクト

全般

プロフィール

Vote #66045

未完了

Broken support for Principal plugins

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
高め
担当者:
-
カテゴリ:
Plugin API_20
対象バージョン:
-
開始日:
2009/11/20
期日:
進捗率:

0%

予定工数:
category_id:
20
version_id:
0
issue_org_id:
4257
author_id:
5866
assigned_to_id:
0
comments:
11
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

I'm not sure when exactly it happens (it's worked sometime ago), but things becomes broken for Principal with empty plugin.

How to reproduce:

$ cat vendor/plugins/test_plugin/init.rb

require 'redmine'

require 'dispatcher'
Dispatcher.to_prepare :test_plugin do
  require_dependency 'principal'
end

Redmine::Plugin.register :test_plugin do
end

(no other files in vendor/test_plugin)
$ rake test:units
<...>
1) Failure:
test_roles_updated(GroupTest) [/test/unit/group_test.rb:57]:
<[1, 2]> expected but was
<[1]>.
2) Failure:
test_visible_scope_for_user(IssueTest) [/test/unit/issue_test.rb:94]:
 is not true.
478 tests, 2036 assertions, 2 failures, 0 errors

journals

Any ideas? Please help, it's showstoper for me.
--------------------------------------------------------------------------------
Jean-Philippe, any ideas?
--------------------------------------------------------------------------------
Ok, second failure was bisect down to r3039. No idea about first yet...
--------------------------------------------------------------------------------
Aleksey:

That's really odd. I have a few plugins that work with Users that are still working. Is this failing in just a test plugin or something you are working on?
--------------------------------------------------------------------------------
Eric, I'm working on plugin for some Redmine models. When I found this 2 broken tests, I started to remove code from my plugin – and it's ended with this bare skeleton.
--------------------------------------------------------------------------------
Had the same kind of problem recently with memberships. It seems Rails has some troubles reloading things correctly when some classes has been reloaded through engines. It may have something to do with STI (doesn't affect other classes from what I've seen).

For instance, with your test plugin, in @test/unit/group_test.rb@, line 57: <pre>
assert_equal [1, 2], user.reload.roles_for_project(project).collect(&:id).sort
#=> KO
assert_equal [1, 2], User.find(9).roles_for_project(project).collect(&:id).sort
#=> OK
</pre>

I tried to mark some classes as unloadable in the core, doesn't change anything...
--------------------------------------------------------------------------------
I continue to think it's a rails bug, but it's solved by forcing memberships reload in User model : <pre>
def reload(*args)
@name = nil
self.memberships.reload
super(*args)
end
</pre>

Any thought about integrating that into the core ? (note it also works when monkey patching User class this way in the plugin...)
--------------------------------------------------------------------------------
> Any thought about integrating that into the core ?

I'm for it, with a big FIXME comment.
Is it a know Rails bug?
--------------------------------------------------------------------------------
Alexey Palazhchenko wrote:
> Is it a know Rails bug?

Didn't find it on lighthouse. It seems inherited scopes (in our case @User#like@) are also lost when reloading...
--------------------------------------------------------------------------------
Assigned issue with no assignee back to New status.
--------------------------------------------------------------------------------


related_issues

relates,Closed,5434,Redmine 0.9.3 - HTTP500 when trying to filter users for adding to a group

Admin Redmine さんが約2年前に更新

  • カテゴリPlugin API_20 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0