Sha256: 6382d3363c3f216e159e303017b8c9e0aa0cf8dc7217fb0344250820fc0b2088

Contents?: true

Size: 788 Bytes

Versions: 16

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module Thredded
  class AtNotificationExtractor
    def initialize(post)
      @post = post
    end

    # @return [Array<Thredded.user_class>]
    def run
      view_context = Thredded::ApplicationController.new.view_context
      # Do not highlight @-mentions at first, because:
      # * When parsing, @-mentions within <a> tags will not be considered.
      # * We can't always generate the user URL here because request.host is not available.
      html = @post.filtered_content(view_context, users_provider: nil)
      Thredded::HtmlPipeline::AtMentionFilter.new(
        html,
        view_context: view_context,
        users_provider: ::Thredded::UsersProvider,
        users_provider_scope: @post.readers
      ).mentioned_users
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
thredded-1.1.0 app/commands/thredded/at_notification_extractor.rb
thredded-1.0.1 app/commands/thredded/at_notification_extractor.rb
thredded-1.0.0 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.16 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.15 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.14 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.13 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.12 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.11 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.10 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.9 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.8 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.7 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.6 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.5 app/commands/thredded/at_notification_extractor.rb
thredded-0.16.4 app/commands/thredded/at_notification_extractor.rb