diff options
Diffstat (limited to 'app/models/members')
-rw-r--r-- | app/models/members/project_member.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index 8dae3bb2ef2..0ced9c31581 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -3,9 +3,9 @@ class ProjectMember < Member include Gitlab::ShellAdapter + has_many :todos, through: :user belongs_to :project, class_name: 'Project', foreign_key: 'source_id' - # Make sure project member points only to project as it source default_value_for :source_type, SOURCE_TYPE validates_format_of :source_type, with: /\AProject\z/ @@ -15,6 +15,8 @@ class ProjectMember < Member scope :in_projects, ->(projects) { where(source_id: projects.pluck(:id)) } scope :with_user, ->(user) { where(user_id: user.id) } + before_destroy { todos.each(&:destroy) } + class << self # Add users to project teams with passed access option |