Sha256: 5c68e7a87924808fbc6674b1bf919d37b0b248686322eb00eb232992d35f7065
Contents?: true
Size: 1011 Bytes
Versions: 72
Compression:
Stored size: 1011 Bytes
Contents
# frozen_string_literal: true module Decidim module Comments class CommentSerializer < Decidim::Exporters::Serializer include Decidim::ResourceHelper # Serializes a comment def serialize { id: resource.id, created_at: resource.created_at, body: resource.body, author: { id: resource.author.id, name: resource.author.name }, alignment: resource.alignment, depth: resource.depth, user_group: { id: resource.user_group.try(:id), name: resource.user_group.try(:name) }, commentable_id: resource.decidim_commentable_id, commentable_type: resource.decidim_commentable_type, root_commentable_url: root_commentable_url } end private def root_commentable_url @root_commentable_url ||= Decidim::ResourceLocatorPresenter.new(resource.root_commentable).url end end end end
Version data entries
72 entries across 72 versions & 2 rubygems