Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-10 00:08:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-10 00:08:48 +0300
commitf29dae9f106150cd85d4fb107f1eb3b0281e6968 (patch)
tree3f3707bb3aa554c50e83b95ed9f0f0ff066edb3f /app/models/design_management
parent42c8bf63670403d3f5cd23091bb56edde7e187c6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/design_management')
-rw-r--r--app/models/design_management/design.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/design_management/design.rb b/app/models/design_management/design.rb
index 4b4b29558bc..2f8232de592 100644
--- a/app/models/design_management/design.rb
+++ b/app/models/design_management/design.rb
@@ -11,12 +11,14 @@ module DesignManagement
include WhereComposite
include RelativePositioning
include Todoable
+ include Participable
belongs_to :project, inverse_of: :designs
belongs_to :issue
has_many :actions
has_many :versions, through: :actions, class_name: 'DesignManagement::Version', inverse_of: :designs
+ has_many :authors, -> { distinct }, through: :versions, class_name: 'User'
# This is a polymorphic association, so we can't count on FK's to delete the
# data
has_many :notes, as: :noteable, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
@@ -31,6 +33,9 @@ module DesignManagement
alias_attribute :title, :filename
+ participant :authors
+ participant :notes_with_associations
+
# Pre-fetching scope to include the data necessary to construct a
# reference using `to_reference`.
scope :for_reference, -> { includes(issue: [{ project: [:route, :namespace] }]) }
@@ -136,6 +141,12 @@ module DesignManagement
strong_memoize(:most_recent_action) { actions.ordered.last }
end
+ def participants(current_user = nil)
+ return [] unless Feature.enabled?(:design_management_design_notification_participants, project)
+
+ super
+ end
+
# A reference for a design is the issue reference, indexed by the filename
# with an optional infix when full.
#