Class: NotePresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Includes:
ActionView::Helpers::SanitizeHelper, MarkupHelper
Defined in:
app/presenters/note_presenter.rb

Overview

rubocop:disable Gitlab/NamespacedClass – Note is not namespaced

Instance Method Summary collapse

Methods included from MarkupHelper

#cross_project_reference, #first_line_in_markdown, #link_to_html, #link_to_markdown, #link_to_markdown_field, #markdown, #markdown_field, #markup, #render_wiki_content

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#external_authorObject



26
27
28
29
30
31
32
33
34
# File 'app/presenters/note_presenter.rb', line 26

def external_author
  return unless object.&.external_author

  if can?(current_user, :read_external_emails, object)
    object..external_author
  else
    Gitlab::Utils::Email.obfuscated_email(object..external_author, deform: true)
  end
end

#noteObject



10
11
12
# File 'app/presenters/note_presenter.rb', line 10

def note
  obfuscate_participants_emails_in_system_note(object.note)
end

#note_first_line_htmlObject



21
22
23
24
# File 'app/presenters/note_presenter.rb', line 21

def note_first_line_html
  text = first_line_in_markdown(object, :note, 125)
  obfuscate_participants_emails_in_system_note(text)
end

#note_htmlObject



15
16
17
18
19
# File 'app/presenters/note_presenter.rb', line 15

def note_html
  # Always use `markdown_field` because it removes references based on the current user context.
  text = markdown_field(object, :note)
  obfuscate_participants_emails_in_system_note(text)
end