Update mapping.rb

This commit is contained in:
Connor Turland 2017-02-11 00:14:00 -05:00 committed by GitHub
parent 8333d7343c
commit 6c3c9f8c7a

View file

@ -30,6 +30,8 @@ class Mapping < ApplicationRecord
def after_created
if mappable_type == 'Topic'
ActionCable.server.broadcast 'map_' + map.id.to_s, type: 'topicAdded', topic: mappable.filtered, mapping_id: id
meta = { 'x': xloc, 'y': yloc, 'mapping_id': id }
Events::TopicAddedToMap.publish!(mappable, map, user, meta)
elsif mappable_type == 'Synapse'
ActionCable.server.broadcast(
'map_' + map.id.to_s,
@ -39,17 +41,12 @@ class Mapping < ApplicationRecord
topic2: mappable.topic2.filtered,
mapping_id: id
)
Events::SynapseAddedToMap.publish!(mappable, map, user, nil)
end
end
def after_created_async
FollowService.follow(map, user, 'contributed')
if mappable_type == 'Topic'
meta = { 'x': xloc, 'y': yloc, 'mapping_id': id }
Events::TopicAddedToMap.publish!(mappable, map, user, meta)
elsif mappable_type == 'Synapse'
Events::SynapseAddedToMap.publish!(mappable, map, user, nil)
end
end
handle_asynchronously :after_created_async