Module: NotifierHelper

Includes:
PostsHelper
Defined in:
app/helpers/notifier_helper.rb

Instance Method Summary collapse

Methods included from PostsHelper

#post_iframe_url, #post_page_title

Instance Method Details

#comment_message(comment, opts = {}) ⇒ String

Returns The formatted comment.

Parameters:

  • comment (Comment)

    The comment to process.

  • opts (Hash) (defaults to: {})

    Optional hash. Accepts :html parameter.

Returns:

  • (String)

    The formatted comment.



17
18
19
20
21
22
23
# File 'app/helpers/notifier_helper.rb', line 17

def comment_message(comment, opts={})
  if comment.post.public?
    opts[:html] ? comment.message.markdownified_for_mail : comment.message.plain_text_without_markdown
  else
    I18n.translate "notifier.a_limited_post_comment"
  end
end

#post_message(post, opts = {}) ⇒ String

Returns The formatted post.

Parameters:

  • post (Post)

    The post object.

  • opts (Hash) (defaults to: {})

    Optional hash. Accepts :html parameter.

Returns:

  • (String)

    The formatted post.



9
10
11
12
# File 'app/helpers/notifier_helper.rb', line 9

def post_message(post, opts={})
  rendered = opts[:html] ? post.message&.markdownified_for_mail : post.message&.plain_text_without_markdown
  rendered.presence || post_page_title(post)
end