issue project 为nil时的特殊处理

This commit is contained in:
呱呱呱 2023-11-16 10:46:00 +08:00
parent a303f3d01b
commit f9f0485e50
1 changed files with 6 additions and 2 deletions

View File

@ -187,7 +187,11 @@ class Issue < ApplicationRecord
end
def is_collaborators?
self.assigned_to_id.present? ? self.project.member?(self.assigned_to_id) : false
if self.assigned_to_id.present? && self.project.present?
self.project.member?(self.assigned_to_id)
else
false
end
end
def get_issue_tags_name
@ -229,7 +233,7 @@ class Issue < ApplicationRecord
end
def update_closed_issues_count_in_project!
self.project.decrement!(:closed_issues_count) if self.status_id == 5
self.project.decrement!(:closed_issues_count) if self.status_id == 5 && self.project.present?
end
def send_update_message_to_notice_system