Module: DeprecatedAssignee

Extended by:
ActiveSupport::Concern
Included in:
MergeRequest
Defined in:
app/models/concerns/deprecated_assignee.rb

Overview

This module handles backward compatibility for import/export of merge requests after multiple assignees feature was introduced. Also, it handles the scenarios where the #26496 background migration hasn’t finished yet. Ideally, most of this code should be removed at #59457.

Instance Method Summary collapse

Instance Method Details

#assigneeObject



28
29
30
# File 'app/models/concerns/deprecated_assignee.rb', line 28

def assignee
  assignees.first
end

#assignee=(user) ⇒ Object



24
25
26
# File 'app/models/concerns/deprecated_assignee.rb', line 24

def assignee=(user)
  self.assignees = Array(user)
end

#assignee_idObject



32
33
34
# File 'app/models/concerns/deprecated_assignee.rb', line 32

def assignee_id
  assignee_ids.first
end

#assignee_id=(id) ⇒ Object



20
21
22
# File 'app/models/concerns/deprecated_assignee.rb', line 20

def assignee_id=(id)
  self.assignee_ids = Array(id)
end

#assignee_idsObject



36
37
38
39
40
41
42
43
# File 'app/models/concerns/deprecated_assignee.rb', line 36

def assignee_ids
  if Gitlab::Database.read_only? && pending_assignees_population?
    return Array(deprecated_assignee_id)
  end

  update_assignees_relation
  super
end

#assignee_ids=(ids) ⇒ Object



10
11
12
13
# File 'app/models/concerns/deprecated_assignee.rb', line 10

def assignee_ids=(ids)
  nullify_deprecated_assignee
  super
end

#assigneesObject



45
46
47
48
49
50
51
52
# File 'app/models/concerns/deprecated_assignee.rb', line 45

def assignees
  if Gitlab::Database.read_only? && pending_assignees_population?
    return User.where(id: deprecated_assignee_id)
  end

  update_assignees_relation
  super
end

#assignees=(users) ⇒ Object



15
16
17
18
# File 'app/models/concerns/deprecated_assignee.rb', line 15

def assignees=(users)
  nullify_deprecated_assignee
  super
end