Skip to content

Commit 75990f8

Browse files
committed
Restrict faye broadcast messages to only the necessary fields
1 parent 43bb7aa commit 75990f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/models/activity_observer.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def after_save(activity)
1111
def message_broadcast_data(activity)
1212
faye_channel = "/channels/#{activity.channel.to_param}"
1313
broadcast_data = activity.attributes.merge({
14-
:user => activity.user.attributes,
14+
:user => activity.user.as_json(:only => [:id, :ido_id, :email, :first_name, :last_name, :gravatar_hash, :active, :locale]),
1515
:channel => activity.channel.attributes
1616
})
1717
[faye_channel, broadcast_data]
@@ -22,7 +22,7 @@ def upload_broadcast_data(activity)
2222
broadcast_data = {
2323
:event => "attachment#upload",
2424
:entity => activity.attributes.merge({
25-
:user => activity.user.attributes,
25+
:user => activity.user.as_json(:only => [:id, :ido_id, :email, :first_name, :last_name, :gravatar_hash, :active, :locale]),
2626
:channel => activity.channel.attributes
2727
}),
2828
:extra => {

0 commit comments

Comments
 (0)