Update mapping.rb
This commit is contained in:
parent
8333d7343c
commit
6c3c9f8c7a
1 changed files with 3 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue