Sha256: 183d075e9fb51e66d89c79fb1b475ba847181e5863cdd7e57148e49724d2ab19
Contents?: true
Size: 849 Bytes
Versions: 19
Compression:
Stored size: 849 Bytes
Contents
# frozen_string_literal: true module Decidim module Messaging # A form object to be used when users want to message another user. class ConversationForm < Decidim::Form mimic :conversation attribute :body, Decidim::Attributes::CleanString attribute :recipient_id, Integer validates :body, :recipient, presence: true, length: { maximum: Decidim.config.maximum_conversation_message_length } validate :check_recipient def recipient @recipient ||= Decidim::UserBaseEntity .includes(:following_follows) .where.not(id: context.sender.id) .where(organization: context.sender.organization) .where(id: recipient_id) end def check_recipient !@recipient.empty? end end end end
Version data entries
19 entries across 19 versions & 1 rubygems