diff options
Diffstat (limited to 'app/models/design_management/design.rb')
-rw-r--r-- | app/models/design_management/design.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/design_management/design.rb b/app/models/design_management/design.rb index 317399e780a..cb6d4e72c80 100644 --- a/app/models/design_management/design.rb +++ b/app/models/design_management/design.rb @@ -13,6 +13,9 @@ module DesignManagement include RelativePositioning include Todoable include Participable + include CacheMarkdownField + + cache_markdown_field :description belongs_to :project, inverse_of: :designs belongs_to :issue @@ -34,6 +37,7 @@ module DesignManagement validates :project, :filename, presence: true validates :issue, presence: true, unless: :importing? validates :filename, uniqueness: { scope: :issue_id }, length: { maximum: 255 } + validates :description, length: { maximum: Gitlab::Database::MAX_TEXT_SIZE_LIMIT } validate :validate_file_is_image alias_attribute :title, :filename @@ -43,7 +47,7 @@ module DesignManagement # Pre-fetching scope to include the data necessary to construct a # reference using `to_reference`. - scope :for_reference, -> { includes(issue: [{ project: [:route, :namespace] }]) } + scope :for_reference, -> { includes(issue: [{ namespace: :project }, { project: [:route, :namespace] }]) } # A design can be uniquely identified by issue_id and filename # Takes one or more sets of composite IDs of the form: @@ -174,7 +178,7 @@ module DesignManagement (?<url_filename> #{valid_char}+ \. #{ext}) }x - super(path_segment, filename_pattern) + compose_link_reference_pattern(path_segment, filename_pattern) end end @@ -182,10 +186,6 @@ module DesignManagement File.join(DesignManagement.designs_directory, "issue-#{issue.iid}", design.filename) end - def description - '' - end - def new_design? strong_memoize(:new_design) { actions.none? } end |