neffets / redmine-stuff-to-do-plugin

The Stuff To Do plugin allows a user to order and prioritize the issues they are doing into a specific order.
https://projects.littlestreamsoftware.com/projects/show/redmine-stuff-to-do
Other
14 stars 11 forks source link

Shortcuts on Issue-Page #5

Closed tknaller closed 7 years ago

tknaller commented 7 years ago

Hello,

thank you very much for your active contribution to the plugin - your fork is by far the most sophisticated version :)

Though there is a bug: when using the commands on the right hand menu (remove from todo, do now, do later - i hope that is the correct translation as my redmine is in german) when viewing an issue following error occurs: Started GET "/stuff_to_do/delete?issue_id=447&user_id=5" for 10.2.0.183 at 2017-06-07 10:53:02 +0200 Processing by StuffToDoController#delete as HTML Parameters: {"issue_id"=>"447", "user_id"=>"5"} Current user: thomas.knaller (id=5) Completed 500 Internal Server Error in 13ms (ActiveRecord: 4.9ms)

NameError (undefined local variable or method _user_id' for #<Class:0x007f6fe2864058>): plugins/stuff_to_do_plugin/app/models/stuff_to_do.rb:229:inremove' plugins/stuff_to_do_plugin/app/controllers/stuff_to_do_controller.rb:29:in delete' lib/redmine/sudo_mode.rb:63:insudo_mode'

doesn't matter which command. I would really love to continue using your fork if you could fix this issue

greetings, thomas

tknaller commented 7 years ago

diff for fix:

diff --git a/app/models/stuff_to_do.rb b/app/models/stuff_to_do.rb
index c0737d6..fff25d7 100644
--- a/app/models/stuff_to_do.rb
+++ b/app/models/stuff_to_do.rb
@@ -226,12 +226,12 @@ class StuffToDo < ActiveRecord::Base
   end

   def self.remove(user_id, id)
-    removed_stuff_to_do = self.find_by(:user_id =>_user_id, :stuff_id => id)
+    removed_stuff_to_do = self.find_by(:user_id =>user_id, :stuff_id => id)
     removed_stuff_to_do.destroy
   end

   def self.add(user_id, id, to_front)
-    if (find_by(:user_id =>_user_id, :stuff_id => id).nil?) #make sure it's not already there
+    if (find_by(:user_id =>user_id, :stuff_id => id).nil?) #make sure it's not already there
       stuff_to_do = self.new
       stuff_to_do.stuff_id = id
       stuff_to_do.stuff_type = 'Issue'
neffets commented 7 years ago

Thanx for the patch, merged to master.