Class: Gitlab::BackgroundMigration::UserMentions::Models::Note

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
CacheMarkdownField, EachBatch, Concerns::IsolatedMentionable
Defined in:
lib/gitlab/background_migration/user_mentions/models/note.rb

Constant Summary

Constants included from CacheMarkdownField

CacheMarkdownField::INVALIDATED_BY

Instance Method Summary collapse

Methods included from CacheMarkdownField

#attribute_invalidated?, #banzai_render_context, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #local_version, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #updated_cached_html_for

Methods included from Concerns::IsolatedMentionable

#all_references, #array_to_sql, #build_mention_values, #extractors

Instance Method Details

#for_commit?Boolean

Returns:

  • (Boolean)

51
52
53
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 51

def for_commit?
  noteable_type == "Commit"
end

#for_epic?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 35

def for_epic?
  noteable && noteable_type == 'Epic'
end

#for_personal_snippet?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 23

def for_personal_snippet?
  noteable && noteable.class.name == 'PersonalSnippet'
end

#for_project_noteable?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 27

def for_project_noteable?
  !for_personal_snippet? && !for_epic?
end

#noteableObject


47
48
49
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 47

def noteable
  super unless for_commit?
end

#skip_project_check?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 31

def skip_project_check?
  !for_project_noteable?
end

#user_mention_note_idObject


43
44
45
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 43

def user_mention_note_id
  id
end

#user_mention_resource_idObject


39
40
41
# File 'lib/gitlab/background_migration/user_mentions/models/note.rb', line 39

def user_mention_resource_id
  noteable_id || commit_id
end