pheelay / redmine_anonymous_watchers

Redmine Anonymous Watchers plug-in
4 stars 5 forks source link

View error Redmine 2.5.0 #3

Open sercoin opened 10 years ago

sercoin commented 10 years ago

Hi,

I'm using Redmine 2.5.0 and I get this error;

ActionView::Template::Error (undefined local variable or method `users' for #<#<Class:0x64e3048>:0x6ec9910>):
    17:                  :project_id => @project) }')" %>
    18: 
    19:   <div id="users_for_watcher">
    20:     <%= principals_check_box_tags('watcher[user_ids][]', users) %>
    21:   </div>
    22: 
    23:   <p class="buttons">
  app/views/watchers/_new.html.erb:20:in `block in _app_views_watchers__new_html_erb__657758961_53960688'
  app/views/watchers/_new.html.erb:7:in `_app_views_watchers__new_html_erb__657758961_53960688'
  app/views/watchers/new.js.erb:1:in `_app_views_watchers_new_js_erb__578889469_53052156'

Is there any solution for that?

Regards

pheelay commented 10 years ago

Hi there, Unfortunately, there were changes in Redmine 2.4 that are currently not compatible with this plugin. I imagine the same will be true for Redmine 2.5 and later. I'm using Redmine 2.3. I plan to work on later versions at some point, but unfortunately won't have the time in the near future. Phil

sercoin commented 10 years ago

Hi,

I solve this problem.But I face with another. If we fix the new problem I think this plugin can work with 2.5.0.

Solution for fisrt error is simply change

<%= principals_check_box_tags('watcher[user_ids][]', users) %>

to

<%= principals_check_box_tags('watcher[user_ids][]', (watched ? watched.addable_watcher_users : User.active.all(:limit => 100)) ) %>

And new error is;

ArgumentError (wrong number of arguments (3 for 1)):
  app/models/mailer.rb:423:in `initialize'
  app/models/mailer.rb:446:in `method_missing'
  app/models/mailer.rb:86:in `block (2 levels) in deliver_issue_edit'
  app/models/issue.rb:826:in `each_notification'
  app/models/mailer.rb:85:in `block in deliver_issue_edit'
  app/models/journal.rb:77:in `block in each_notification'
  app/models/journal.rb:75:in `each'
  app/models/journal.rb:75:in `each_notification'
  app/models/mailer.rb:84:in `deliver_issue_edit'
  app/models/journal.rb:190:in `send_notification'
  app/models/journal.rb:54:in `save'
  app/models/issue.rb:1515:in `create_journal'
  app/models/issue.rb:165:in `create_or_update'
  app/controllers/issues_controller.rb:478:in `block in save_issue_with_child_records'
  app/controllers/issues_controller.rb:466:in `save_issue_with_child_records'
  app/controllers/issues_controller.rb:188:in `update'

I get new error when I try to send mail to anonymous_watchers.

I hope you can help.

Regards

prolifico commented 10 years ago

I get this same error (wrong number of arguments (3 for 1)) using Redmine 2.4.5.stable.13171

It also seems that your fork is not compatible with the most recent version of the nokogiri gem (Gemfile includes "gem nokogiri > 1.6.0") which conflicts with newer installations (nokogiri currently is up to 1.6.2). After installing an older nokogiri (1.5.11), I was able to use your fork, but got the same HTTP 500 error about the wrong number of arguments.

sercoin commented 10 years ago

I think you response watchable_type, watchable_id and mail address to mail recipient request when journal creating. If you send only mail address, problem will solve probably. I hope you will fix it soon.

yakatz commented 10 years ago

I was able to get it to add watchers in Redmine 2.5, but it appears that it can't remove them. I will continue to troubleshoot.

sercoin commented 10 years ago

I fix the delete error.

..\plugins\redmine_anonymous_watchers\lib\redmine_anonymous_watchers\watchers_helper_patch.rb
in this file change

:method => 'post'

with

:method => 'delete'

in "watchers_list_with_anonymous(object)"

and ..\plugins\redmine_anonymous_watchers\lib\redmine_anonymous_watchers\watchers_controller_patch.rb
in this file remove this part

 if request.post?

in "destroy_with_anonymous"

There is only mail problem left. I'm looking for solution for that too.

sercoin commented 10 years ago

I fix wrong number of arguments (3 for 1) error. Just adding to and cc to issue_edit_with_anonymous_watchers

Right now I need cc.map(&:mail) << AnonymousWatchers.new(:mail) command work. I can't find the command which is get email address. Can you correct this command?

def issue_edit_with_anonymous_watchers(journal, to, cc)
   #@subscription_recipients = journal.project.issues_recipients
   cc.map(&:mail) << AnonymousWatchers.new(:mail)
   issue_edit_without_anonymous_watchers(journal, to, cc)
end
codeTemplar commented 9 years ago

Anyone have this plugin working with redmine 2.5.x?! i realy need it. i managed to make it work (add and remove emails) but when i edit the issue it is not sending emails to the users. I checked the headers befor the emails are sent and there are no anonymous emails. for some reason this function:

def watcher_mails  
    anonymous_watchers.map(&:mail).compact
end

returns nothing on saving the issue. but returns emails when refreshing the page

codeTemplar commented 9 years ago

Nevermind. Solved it. changed mailer_patch.rb. in function issue_edit_with_anonymous_watchers change @subscription_recipients = journal.project.issues_recipients to @subscription_recipients = journal.watcher_recipients

codeTemplar commented 9 years ago

There is a typo in mailer_patch.rb in function issue_add_with_anonymous_watchers. change @subscription_recipients = issue.project.issue_recipients to @subscription_recipients = issue.project.issues_recipients. note the extra s on issues_recipients