diff --git a/app/models/mapping.rb b/app/models/mapping.rb index a1ebdaf5..f8430bde 100644 --- a/app/models/mapping.rb +++ b/app/models/mapping.rb @@ -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 diff --git a/config/initializers/mailboxer.rb b/config/initializers/mailboxer.rb index baa5ea9d..b09caec2 100644 --- a/config/initializers/mailboxer.rb +++ b/config/initializers/mailboxer.rb @@ -16,7 +16,7 @@ MAP_INVITE_TO_EDIT = 'INVITE_TO_EDIT' # these ones are new # this one's a catch all for occurences on the map -MAP_ACTIVITY = 'MAP_ACTIVITY' +# MAP_ACTIVITY = 'MAP_ACTIVITY' # MAP_RECEIVED_TOPIC # MAP_LOST_TOPIC # MAP_TOPIC_MOVED diff --git a/db/migrate/20170209215819_create_follows.rb b/db/migrate/20170209215819_create_follows.rb index 2999a643..f1a41ca2 100644 --- a/db/migrate/20170209215819_create_follows.rb +++ b/db/migrate/20170209215819_create_follows.rb @@ -2,9 +2,6 @@ class CreateFollows < ActiveRecord::Migration[5.0] def change create_table :follows do |t| t.references :user, index: true - t.boolean :email, default: true - t.boolean :app, default: true - t.boolean :push, default: true t.references :followed, polymorphic: true, index: true t.timestamps end diff --git a/db/schema.rb b/db/schema.rb index f86eb43e..aff5b9e6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -82,9 +82,12 @@ ActiveRecord::Schema.define(version: 20170209215911) do create_table "follows", force: :cascade do |t| t.integer "user_id" +<<<<<<< HEAD t.boolean "email", default: true t.boolean "app", default: true t.boolean "push", default: true +======= +>>>>>>> develop t.string "followed_type" t.integer "followed_id" t.datetime "created_at", null: false diff --git a/frontend/src/components/Maps/MapCard.js b/frontend/src/components/Maps/MapCard.js index a6200549..1ed7e492 100644 --- a/frontend/src/components/Maps/MapCard.js +++ b/frontend/src/components/Maps/MapCard.js @@ -82,10 +82,11 @@ class MapCard extends Component { render = () => { const { map, mobile, juntoState, currentUser, onRequest, onStar } = this.props - const hasMap = juntoState.liveMaps[map.id] - const hasConversation = hasMap && find(values(hasMap), v => v === IN_CONVERSATION) + const hasMap = (juntoState.liveMaps[map.id] && values(juntoState.liveMaps[map.id]).length) || null + const realtimeMap = juntoState.liveMaps[map.id] + const hasConversation = hasMap && find(values(realtimeMap), v => v === IN_CONVERSATION) const hasMapper = hasMap && !hasConversation - const mapperList = hasMap && Object.keys(hasMap).map(id => juntoState.connectedPeople[id]) + const mapperList = hasMap && Object.keys(realtimeMap).map(id => juntoState.connectedPeople[id]) const n = map.get('name') const d = map.get('desc')