Sha256: 7bf57cf01dbe6264fd711edbf6bd92c01a920121f7bd09bd6467993decf78263
Contents?: true
Size: 813 Bytes
Versions: 37
Compression:
Stored size: 813 Bytes
Contents
# frozen_string_literal: true module Decidim module Comments class CommentVotedEvent < Decidim::Events::SimpleEvent include Decidim::Comments::CommentEvent i18n_attributes :upvotes i18n_attributes :downvotes def initialize(resource:, event_name:, user:, user_role: nil, extra: nil) resource = target_resource(resource) super end def upvotes extra[:upvotes] end def downvotes extra[:downvotes] end def perform_translation? false end private def resource_url_params { anchor: "comment_#{comment.id}" } end def target_resource(t_resource) t_resource.is_a?(Decidim::Comments::Comment) ? t_resource.root_commentable : t_resource end end end end
Version data entries
37 entries across 37 versions & 1 rubygems