2018-07-25 09:30:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 13:17:42 +00:00
|
|
|
class IssueAssignee < ApplicationRecord
|
2017-05-04 12:11:15 +00:00
|
|
|
belongs_to :issue
|
2020-06-23 15:08:41 +00:00
|
|
|
belongs_to :assignee, class_name: "User", foreign_key: :user_id, inverse_of: :issue_assignees
|
2020-01-29 00:08:58 +00:00
|
|
|
|
|
|
|
validates :assignee, uniqueness: { scope: :issue_id }
|
2020-06-23 15:08:41 +00:00
|
|
|
|
|
|
|
scope :in_projects, ->(project_ids) { joins(:issue).where("issues.project_id in (?)", project_ids) }
|
|
|
|
scope :on_issues, ->(issue_ids) { where(issue_id: issue_ids) }
|
2020-10-12 18:08:31 +00:00
|
|
|
scope :for_assignee, ->(user) { where(assignee: user) }
|
2017-05-04 12:11:15 +00:00
|
|
|
end
|
2019-09-13 13:26:31 +00:00
|
|
|
|
|
|
|
IssueAssignee.prepend_if_ee('EE::IssueAssignee')
|