Commit b86b409f authored by James Fleming's avatar James Fleming Committed by Jonne Haß

Strong parameters for Conversation

parent 509a4072
......@@ -34,13 +34,14 @@ class ConversationsController < ApplicationController
person_ids = Contact.where(:id => params[:contact_ids].split(',')).map(&:person_id)
end
params[:conversation][:participant_ids] = [*person_ids] | [current_user.person_id]
params[:conversation][:author] = current_user.person
message_text = params[:conversation].delete(:text)
params[:conversation][:messages_attributes] = [ {:author => current_user.person, :text => message_text }]
@conversation = Conversation.new
@conversation.subject = params[:conversation][:subject]
@conversation.participant_ids = [*person_ids] | [current_user.person_id]
@conversation.author = current_user.person
message_text = params[:conversation][:text]
@conversation.messages_attributes = [ {:author => current_user.person, :text => message_text }]
@response = {}
@conversation = Conversation.new(params[:conversation])
if person_ids.present? && @conversation.save
Postzord::Dispatcher.build(current_user, @conversation).post
@response[:success] = true
......
class Conversation < ActiveRecord::Base
include Diaspora::Federated::Base
include Diaspora::Guid
include ActiveModel::ForbiddenAttributesProtection
xml_attr :subject
xml_attr :created_at
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment