Sha256: d51f4517f422a0e51fabb40136edb4633464277375b13d08cf08280e69355ea2

Contents?: true

Size: 632 Bytes

Versions: 7

Compression:

Stored size: 632 Bytes

Contents

# frozen-string_literal: true

module Decidim
  module Comments
    class CommentByFollowedUserEvent < Decidim::Events::SimpleEvent
      include Decidim::Events::AuthorEvent

      delegate :author, to: :comment

      def resource_path
        resource_locator.path(url_params)
      end

      def resource_url
        resource_locator.url(url_params)
      end

      def resource_text
        comment.body
      end

      private

      def comment
        @comment ||= Decidim::Comments::Comment.find(extra[:comment_id])
      end

      def url_params
        { anchor: "comment_#{comment.id}" }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-comments-0.18.1 app/events/decidim/comments/comment_by_followed_user_event.rb
decidim-comments-0.17.2 app/events/decidim/comments/comment_by_followed_user_event.rb
decidim-comments-0.18.0 app/events/decidim/comments/comment_by_followed_user_event.rb
decidim-comments-0.17.1 app/events/decidim/comments/comment_by_followed_user_event.rb
decidim-comments-0.16.1 app/events/decidim/comments/comment_by_followed_user_event.rb
decidim-comments-0.17.0 app/events/decidim/comments/comment_by_followed_user_event.rb
decidim-comments-0.16.0 app/events/decidim/comments/comment_by_followed_user_event.rb