diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-14 18:10:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-14 18:10:05 +0300 |
commit | 654daa2ccbf58f9f36d94bfafcaea323e350ccd3 (patch) | |
tree | 7de886a951c6fe86db3b60fe36708b5656e8d85e /app | |
parent | a42fc481401fd6c4900b79125c446c7e4c1c572e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/cache_markdown_field.rb | 8 | ||||
-rw-r--r-- | app/models/note.rb | 4 | ||||
-rw-r--r-- | app/models/personal_snippet.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 2 |
4 files changed, 18 insertions, 0 deletions
diff --git a/app/models/concerns/cache_markdown_field.rb b/app/models/concerns/cache_markdown_field.rb index 04eb4659469..49fc780f372 100644 --- a/app/models/concerns/cache_markdown_field.rb +++ b/app/models/concerns/cache_markdown_field.rb @@ -39,6 +39,10 @@ module CacheMarkdownField context[:markdown_engine] = :common_mark + if Feature.enabled?(:personal_snippet_reference_filters, context[:author]) + context[:user] = self.parent_user + end + context end @@ -132,6 +136,10 @@ module CacheMarkdownField end end + def parent_user + nil + end + included do cattr_reader :cached_markdown_fields do Gitlab::MarkdownCache::FieldData.new diff --git a/app/models/note.rb b/app/models/note.rb index e06df816b2e..e1fc16818b3 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -559,6 +559,10 @@ class Note < ApplicationRecord (!system_note_with_references? || all_referenced_mentionables_allowed?(user)) && system_note_viewable_by?(user) end + def parent_user + noteable.author if for_personal_snippet? + end + private # Using this method followed by a call to `save` may result in ActiveRecord::RecordNotUnique exception diff --git a/app/models/personal_snippet.rb b/app/models/personal_snippet.rb index 197795dccfe..0915278fb65 100644 --- a/app/models/personal_snippet.rb +++ b/app/models/personal_snippet.rb @@ -3,6 +3,10 @@ class PersonalSnippet < Snippet include WithUploads + def parent_user + author + end + def skip_project_check? true end diff --git a/app/models/project.rb b/app/models/project.rb index cedb5378c67..5e1822f1a34 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -2596,6 +2596,8 @@ class Project < ApplicationRecord namespace != from.namespace when Namespace namespace != from + when User + true end end |