Defect #11288
closedacts_as_watchable - cannot reassign task to group
0%
Description
- Create new task assign to << Me >>
- Reassign created task to group
Call stack:ActiveRecord::AssociationTypeMismatch (User(#70026181156120) expected, got Group(#70026141917680)):
lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb:43:in `new'
lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb:43:in `add_watcher'
lib/redmine/hook.rb:61:in `send'
lib/redmine/hook.rb:61:in `call_hook'
lib/redmine/hook.rb:61:in `each'
lib/redmine/hook.rb:61:in `call_hook'
lib/redmine/hook.rb:58:in `tap'
lib/redmine/hook.rb:58:in `call_hook'
app/models/issue.rb:708:in `save_issue_with_child_records'
app/models/issue.rb:696:in `save_issue_with_child_records'
app/controllers/issues_controller.rb:182:in `update'
I use the 2.0.2 Redmine version so set in affected version.
Updated by Etienne Massip over 12 years ago
- Status changed from Resolved to New
- Resolution set to Cant reproduce
Can't reproduce on trunk.
Updated by # And over 12 years ago
How can I show, in which way it can be reproduced?
Environment:and@artvertep:/$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
and@artvertep:/$ rails -v
Rails 3.2.5
Updated by Etienne Massip over 12 years ago
Well the hook part in the call stack makes think of a plugin behavior, do you have any plugin installed?
If yes, could you please try to reproduce with no plugins installed?
Updated by # And over 12 years ago
Yes, your idea about plugin was right. When I uninstall redmine_auto_watch plugin reassign works.
Can you look on plugin, please - fix about 1 line? =)
Unfortunately, I`m no ruby programmer, and don`t understand Redmine data domain.
If you can - thanks, I really need plugin functionality.
Plugin (class) code:
# Hooks to attach to the Redmine Issues. class AutoWatchHook < Redmine::Hook::Listener def controller_issues_edit_before_save(context = { }) @issue = context[:issue] unless @issue.watched_by?(User.current) || @issue.author == User.current @issue.add_watcher(User.current) end unless @issue.watched_by?(@issue.assigned_to) || @issue.author == @issue.assigned_to @issue.add_watcher(@issue.assigned_to) end end end
I think trouble is in
@issue.add_watcher(@issue.assigned_to)
issue.assigned_to is Group, but User in issue.add_watcher() expected?
Updated by Mischa The Evil over 12 years ago
# And
wrote:
Yes, your idea about plugin was right. When I uninstall redmine_auto_watch plugin reassign works.
Can you look on plugin, please - fix about 1 line? =)
Try the change made in commit be93aad9913dfd5cdab40c7703151aa50b7ff5ee in a fork of the original plugin... As mentioned in the commit-message this should workaround/fix the issue you're experiencing...
Updated by # And over 12 years ago
- Status changed from New to Resolved
Thanks you Mischa The Evil very much.
Thanks guys!
Updated by Etienne Massip over 12 years ago
- Status changed from Resolved to Closed
- Resolution changed from Cant reproduce to Invalid
Updated by Mischa The Evil over 12 years ago
- Category deleted (
Core Plugins)
This wasn't related to the acts_as_watchable
core plugin, instead it was related to the third-party "redmine_auto_watch":https://github.com/mezza/redmine_auto_watch
plugin.