Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not delete last Checklist item. #14

Open
atopcu opened this issue May 19, 2016 · 1 comment
Open

Can not delete last Checklist item. #14

atopcu opened this issue May 19, 2016 · 1 comment

Comments

@atopcu
Copy link
Contributor

atopcu commented May 19, 2016

Hi,

I am deleting all checklist items in issue edit mode. All checklist items come back after save the issue.
If I left one of them in same scenario, it is deleting all other, no problem.

Environment:
Redmine version 3.1.3.stable.15012
Ruby version 2.0.0-p481 (2014-05-08) [x86_64-linux]
Rails version 4.2.5
Environment production
Database adapter Mysql2

Have a nice day!

yoshida3669 pushed a commit to yoshida3669/redmine_issue_checklist that referenced this issue Mar 27, 2017
yoshida3669 added a commit to yoshida3669/redmine_issue_checklist that referenced this issue Apr 4, 2017
Add hidden parameters to delete checklists (Fix Restream#14)
@max-arnold
Copy link

We were able to fix this issue with this simple patch:

diff --git a/init.rb b/init.rb
index 2762b0d..f3c410a 100644
--- a/init.rb
+++ b/init.rb
@@ -21,7 +21,7 @@ Redmine::Plugin.register :redmine_issue_checklist do
     map.project_module :issue_tracking do |map|
       map.permission :view_checklists, {}
       map.permission :done_checklists, { issue_checklist: :done }
-      map.permission :edit_checklists, { issue_checklist: :delete, issue_checklist: :done }
+      map.permission :edit_checklists, { issue_checklist: [:delete, :done] }
     end
   end

diff --git a/lib/redmine_issue_checklist/hooks/model_issue_hook.rb b/lib/redmine_issue_checklist/hooks/model_issue_hook.rb
index 9ae0d54..0c7509d 100644
--- a/lib/redmine_issue_checklist/hooks/model_issue_hook.rb
+++ b/lib/redmine_issue_checklist/hooks/model_issue_hook.rb
@@ -37,7 +37,7 @@ module RedmineIssueChecklist
       def save_checklist_to_issue(context, create_journal)
         issue = context[:issue]
         checklist_items = context[:params] && context[:params][:check_list_items]
-        issue.update_checklist_items(checklist_items, create_journal) if issue && checklist_items
+        issue.update_checklist_items(checklist_items, create_journal) if issue
       end

     end

max-arnold added a commit to innoteq/redmine_issue_checklist that referenced this issue Apr 10, 2017
gonter added a commit to phaidra/redmine_issue_checklist that referenced this issue Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants