diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-19 18:09:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-19 18:09:10 +0300 |
commit | 9c8e8b5ffc6e11d827fa42f2dce5f90c4dc19493 (patch) | |
tree | fef494515627439a22a06addc7ff5f57d418778a /app/models/note.rb | |
parent | 690c904b5e340f14c04f93ff688b647b46f7d1a2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index f2ddf0efe47..986a85acac6 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -111,6 +111,7 @@ class Note < ApplicationRecord end validate :does_not_exceed_notes_limit?, on: :create, unless: [:system?, :importing?] + validate :validate_created_after # @deprecated attachments are handled by the Upload model. # @@ -748,6 +749,13 @@ class Note < ApplicationRecord errors.add(:base, _('Maximum number of comments exceeded')) if noteable.notes.count >= Noteable::MAX_NOTES_LIMIT end + def validate_created_after + return unless created_at + return if created_at >= '1970-01-01' + + errors.add(:created_at, s_('Note|The created date provided is too far in the past.')) + end + def noteable_label_url_method for_merge_request? ? :project_merge_requests_url : :project_issues_url end |