Class: Gitlab::Import::MentionsConverter
- Inherits:
-
Object
- Object
- Gitlab::Import::MentionsConverter
- Includes:
- UserFromMention
- Defined in:
- lib/gitlab/import/mentions_converter.rb
Constant Summary collapse
- BITBUCKET_MENTIONS_REGEX =
Captures anything in brackets after an @ but does not capture the @. It allows mentions like @1111:11-11 to be captured even though it doesn’t match User.reference_pattern
/(?<=@)(\{.+?\})/
- GITLAB_MENTIONS_REGEX =
User.reference_pattern
- MENTION_PLACEHOLDER =
'~GITLAB_MENTION_PLACEHOLDER~'
Constants included from UserFromMention
UserFromMention::SOURCE_USERNAME_CACHE_KEY, UserFromMention::SOURCE_USER_CACHE_KEY, UserFromMention::USER_MAPPABLE_TYPES
Instance Attribute Summary collapse
-
#importer ⇒ Object
readonly
Returns the value of attribute importer.
-
#project_creator ⇒ Object
readonly
Returns the value of attribute project_creator.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
Instance Method Summary collapse
- #convert(text) ⇒ Object
-
#initialize(importer, project) ⇒ MentionsConverter
constructor
A new instance of MentionsConverter.
Methods included from UserFromMention
#cache_multiple, #source_user_cache_key, #source_user_cache_value, #user_from_cache
Constructor Details
#initialize(importer, project) ⇒ MentionsConverter
Returns a new instance of MentionsConverter.
16 17 18 19 20 |
# File 'lib/gitlab/import/mentions_converter.rb', line 16 def initialize(importer, project) @importer = importer @project_id = project.id @project_creator = project.creator end |
Instance Attribute Details
#importer ⇒ Object (readonly)
Returns the value of attribute importer.
14 15 16 |
# File 'lib/gitlab/import/mentions_converter.rb', line 14 def importer @importer end |
#project_creator ⇒ Object (readonly)
Returns the value of attribute project_creator.
14 15 16 |
# File 'lib/gitlab/import/mentions_converter.rb', line 14 def project_creator @project_creator end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
14 15 16 |
# File 'lib/gitlab/import/mentions_converter.rb', line 14 def project_id @project_id end |
Instance Method Details
#convert(text) ⇒ Object
22 23 24 |
# File 'lib/gitlab/import/mentions_converter.rb', line 22 def convert(text) replace_mentions(text.dup) end |