From 813246629e855ba5051b3d72cf53ef251ae4036e Mon Sep 17 00:00:00 2001 From: adufilie Date: Sat, 6 Aug 2011 23:36:19 -0400 Subject: [PATCH 1/3] Fixes issue #8716 by removing from parent before destroy --- app/models/issue.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/issue.rb b/app/models/issue.rb index ccd326552b0..fb3ecb1cb4d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -84,6 +84,7 @@ class Issue < ActiveRecord::Base before_create :default_assign before_save :close_duplicates, :update_done_ratio_from_issue_status after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal + before_destroy :remove_from_parent after_destroy :update_parent_attributes # Returns a SQL conditions string used to find all issues visible by the specified user @@ -790,6 +791,11 @@ def update_nested_set_attributes remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue) end + def remove_from_parent + self.parent_issue_id = nil + update_nested_set_attributes + end + def update_parent_attributes recalculate_attributes_for(parent_id) if parent_id end From 08e4d54e9f29dcce5bc2ea19099e4103c2612c2f Mon Sep 17 00:00:00 2001 From: Andy Dufilie Date: Tue, 9 Aug 2011 19:03:13 -0400 Subject: [PATCH 2/3] Fixed bug where (:set_issues_private==false && :set_own_issues_private==true) was not allowing an issue to become private upon creation. --- app/models/issue.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index fb3ecb1cb4d..f48a02d7549 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -281,7 +281,7 @@ def estimated_hours=(h) safe_attributes 'is_private', :if => lambda {|issue, user| user.allowed_to?(:set_issues_private, issue.project) || - (issue.author == user && user.allowed_to?(:set_own_issues_private, issue.project)) + ((issue.author == user || issue.author == nil) && user.allowed_to?(:set_own_issues_private, issue.project)) } # Safely sets attributes From 0f3524e1094bfd44372a1dddad883416a3dafe36 Mon Sep 17 00:00:00 2001 From: Andy Dufilie Date: Thu, 19 Jan 2012 15:13:55 -0500 Subject: [PATCH 3/3] Trackers with no issues are no longer shown on the overview page. This also solves the problem where trackers from subprojects would appear even if those trackers were not in use in the current project. --- app/views/projects/show.rhtml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index 97409441f00..35a94e341dd 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -28,12 +28,14 @@

<%=l(:label_issue_tracking)%>

    <% for tracker in @trackers %> -
  • <%= link_to h(tracker.name), :controller => 'issues', :action => 'index', :project_id => @project, + <% if @total_issues_by_tracker[tracker].to_i > 0 %> +
  • <%= link_to h(tracker.name), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1, "tracker_id" => tracker.id %>: <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, :total => @total_issues_by_tracker[tracker].to_i) %> -
  • + + <% end %> <% end %>