Project

General

Profile

Actions

Defect #11288

closed

acts_as_watchable - cannot reassign task to group

Added by # And over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

To reproduce:
  1. Create new task assign to << Me >>
  2. 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.

Actions #1

Updated by Etienne Massip over 12 years ago

  • Status changed from Resolved to New
  • Resolution set to Cant reproduce

Can't reproduce on trunk.

Actions #2

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

Actions #3

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?

Actions #4

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?

Actions #5

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...

Actions #6

Updated by # And over 12 years ago

  • Status changed from New to Resolved

Thanks you Mischa The Evil very much.
Thanks guys!

Actions #7

Updated by Etienne Massip over 12 years ago

  • Status changed from Resolved to Closed
  • Resolution changed from Cant reproduce to Invalid
Actions #8

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.

Actions

Also available in: Atom PDF