pheelay / redmine_anonymous_watchers

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

Unable to remove watcher #1

Closed peterbeck closed 10 years ago

peterbeck commented 10 years ago

The plugin works fine (Debian Wheezy 7.4 with Redmine 2.3.1, Ruby 1.9.3, Rails 3.2.13) and mails to anonymous watchers are sent. But there are two (one to be honest) issues:

the redmine log (not very useful in my opinion) when trying to remove watchers:

Started POST "/watchers?mail=peter.beck%40domain.com&object_id=988&object_type=issue" for 217.173.226.23 at 2014-02-17 12:55:34 +0100
Processing by WatchersController#create as JS
  Parameters: {"mail"=>"peter.beck@domain.com", "object_id"=>"988", "object_type"=>"issue"}
WARNING: Can't verify CSRF token authenticity
  Current user: peter (id=3)
  Rendered watchers/_new.html.erb (10.0ms)
  Rendered plugins/redmine_anonymous_watchers/app/views/watchers/_new.html.erb (11.7ms)
  Rendered watchers/_watchers.html.erb (3.0ms)
  Rendered plugins/redmine_anonymous_watchers/app/views/watchers/_watchers.html.erb (5.3ms)
  Rendered watchers/create.js.erb (18.2ms)
Completed 200 OK in 163ms (Views: 18.3ms | ActiveRecord: 68.5ms)

Is that a known issue / limitation or is there any workaround available ?

Cheers Peter

pheelay commented 10 years ago

Hi Peter, Thank you for the feedback. Glad to have other people testing this too.

I have noticed the same on the watchers list to the right hand side of tickets. I checked this and found that the patch is indeed adding real users' email addresses into the anonymous_watchers table. I am wondering if the patch behaves the same in older releases?

There are 2 issues here which I'm looking into:

  1. Users with real accounts are added to anonymous_watchers table
  2. Unable to delete anonymous watchers.

Thanks again for the input! Phil

pheelay commented 10 years ago

I've just committed some changes that should fix both of those issues. Let me know how you get on!

peterbeck commented 10 years ago

Hi Phil,

I'm glad your working on this plugin - for me it's one of the best plugins for Redmine and I was missing this feature a lot. I've just pulled your changes and I love your work - you made my day. I can confirm - both issues are solved now. Great work.

Regards Peter

pheelay commented 10 years ago

Thanks Peter! Glad it's working for you too! Similar situation here... I need to accept emails from any address but having Redmine create an account for every user quickly gets out of hand in this day and age, with spam, non-relevant addresses etc. Shame the author appears to have abandoned the plugin. Ruby is very new to me so learning as I go.

If your Redmine usage is similar to our own, you might be interested in testing another plugin I just uploaded: https://github.com/pheelay/redmine_target_client_project If an incoming email comes from a recognised user, then the plugin will create the ticket in a project that user is a member of, rather than the default specified on mail handler/command line.

Take care! Phil

peterbeck commented 10 years ago

Hi Phil,

Somehow it's a shame it's not included in core Redmine... but anyway, your plugin just works great ;-)

Your Target Client Project seems also very interesting and seems to optimize the workflow. just cloning to 'plugins/redmine_target_client_project' and running rake redmine:plugins:migrate is everything that needs to be done, correct ? seems to work this way.

by the way: shall I ask these questions in the target_client_project as it does not belong to this project ?

Thanks Peter

pheelay commented 10 years ago

Yes, that's it. Place the redmine_target_client_project in the plugins directory beside anonymous_watchers and run rake redmine:plugins:migrate. It works in background only (there is no configuration options or additions to the user interface).

It only make sense really when each user is assigned to only 1 project. Suggest testing first although it's only 1 added line of code so can't it doing damage. No database changes, so can be completely removed by just deleting the directory.

Regards Phil

peterbeck commented 10 years ago

This is also a great extension to Redmine and seems to do what it should. Again, great work. But we do have some users assigned to multiple projects. Do you think about extending the plugin to select the default project when there are multiple projects assigned to a user ? shall a create an issue ?

Sláinte Peter

peterbeck commented 10 years ago

by the way: I've added the plugin to my puppet module. here's the interesting part

  define anonymous_watchers($ensure="present") {
    include foo_redmine::plugin

    case $ensure {
      default: { err("unknown ensure value ${ensure}") }
      present: {
        exec{"clone_anonymous_watchers":
          command   => "git clone https://github.com/pheelay/redmine_anonymous_watchers.git /var/www/redmine/plugins/redmine_anonymous_watchers",
          require   => File["/usr/src/redmine-${foo_redmine::version}"],
          creates   => "/var/www/redmine/plugins/redmine_anonymous_watchers",
          notify    => [Exec["rake_plugin"],Service["apache2"]],
        }   
      }   
      absent: {
        exec{"remove_anon_watchers":
          command => "rake redmine:plugins:migrate NAME=redmine_anonymous_watchers VERSION=0 RAILS_ENV=production",
          notify  => [Exec["remove_anon_watchers_files"],Service["apache2"]],
          onlyif  => "ls /var/www/redmine/plugins/redmine_charts2",
        }   
        exec{"remove_anon_watchers_files":
          command => "rm -r /var/www/redmine/plugins/redmine_anonymous_watchers",
          onlyif  => "ls /var/www/redmine/plugins/redmine_anonymous_watchers",
          require => Exec["remove_anon_watchers"],
        }   
      }   
    }
pheelay commented 10 years ago

I may, eventually, add features to that module but it's unlikely in the short term. For now, it does what we need. If I was investing time, I would rather get anonymous_watchers working on Redmine 2.4.x