diff --git a/app/controllers/api/v1/accounts/callbacks_controller.rb b/app/controllers/api/v1/accounts/callbacks_controller.rb index aa0524568..9fc05d531 100644 --- a/app/controllers/api/v1/accounts/callbacks_controller.rb +++ b/app/controllers/api/v1/accounts/callbacks_controller.rb @@ -15,7 +15,7 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController set_instagram_id(page_access_token, facebook_channel) set_avatar(@facebook_inbox, page_id) rescue StandardError => e - Rails.logger.info e + Sentry.capture_exception(e) end end @@ -55,8 +55,13 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController def update_fb_page(fb_page_id, access_token) fb_page = get_fb_page(fb_page_id) - fb_page&.update!(user_access_token: @user_access_token, page_access_token: access_token) - fb_page&.reauthorized! + ActiveRecord::Base.transaction do + fb_page&.update!(user_access_token: @user_access_token, page_access_token: access_token) + set_instagram_id(access_token, fb_page) + fb_page&.reauthorized! + rescue StandardError => e + Sentry.capture_exception(e) + end end def get_fb_page(fb_page_id) diff --git a/app/javascript/dashboard/assets/images/fb-badge.png b/app/javascript/dashboard/assets/images/fb-badge.png deleted file mode 100644 index 4d00add1e..000000000 Binary files a/app/javascript/dashboard/assets/images/fb-badge.png and /dev/null differ diff --git a/app/javascript/dashboard/assets/images/instagram_direct.png b/app/javascript/dashboard/assets/images/instagram_direct.png deleted file mode 100755 index ca40657b0..000000000 Binary files a/app/javascript/dashboard/assets/images/instagram_direct.png and /dev/null differ diff --git a/app/javascript/dashboard/assets/images/messenger_direct.png b/app/javascript/dashboard/assets/images/messenger_direct.png deleted file mode 100644 index 00b544a83..000000000 Binary files a/app/javascript/dashboard/assets/images/messenger_direct.png and /dev/null differ diff --git a/app/javascript/dashboard/assets/images/twitter-badge.png b/app/javascript/dashboard/assets/images/twitter-badge.png deleted file mode 100644 index 9dd805942..000000000 Binary files a/app/javascript/dashboard/assets/images/twitter-badge.png and /dev/null differ diff --git a/app/javascript/dashboard/assets/images/twitter-chat-badge.png b/app/javascript/dashboard/assets/images/twitter-chat-badge.png deleted file mode 100644 index 987ed3d07..000000000 Binary files a/app/javascript/dashboard/assets/images/twitter-chat-badge.png and /dev/null differ diff --git a/app/javascript/dashboard/assets/images/woot-logo.png b/app/javascript/dashboard/assets/images/woot-logo.png deleted file mode 100644 index baa2b095e..000000000 Binary files a/app/javascript/dashboard/assets/images/woot-logo.png and /dev/null differ diff --git a/app/javascript/dashboard/assets/images/woot-logo.svg b/app/javascript/dashboard/assets/images/woot-logo.svg deleted file mode 100644 index 438f2b4b0..000000000 --- a/app/javascript/dashboard/assets/images/woot-logo.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - on_white - Created with Sketch. - - \ No newline at end of file diff --git a/app/javascript/dashboard/components/widgets/Thumbnail.vue b/app/javascript/dashboard/components/widgets/Thumbnail.vue index 4d60219d9..eb1741bbc 100644 --- a/app/javascript/dashboard/components/widgets/Thumbnail.vue +++ b/app/javascript/dashboard/components/widgets/Thumbnail.vue @@ -19,56 +19,56 @@ id="badge" class="source-badge" :style="badgeStyle" - src="~dashboard/assets/images/instagram_direct.png" + src="/integrations/channels/badges/instagram-dm.png" />
@@ -119,10 +119,6 @@ export default { accountId: 'getCurrentAccountId', }), - chatExtraAttributes() { - return this.chat.additional_attributes; - }, - chatMetadata() { return this.chat.meta || {}; }, @@ -131,14 +127,6 @@ export default { return this.chatMetadata.assignee || {}; }, - chatBadge() { - if(this.chatExtraAttributes['type']){ - return this.chatExtraAttributes['type'] - } else { - return this.chatMetadata.channel - } - }, - currentContact() { return this.$store.getters['contacts/getContact']( this.chatMetadata.sender.id diff --git a/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue b/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue index bf95a5cef..bdb917695 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ConversationHeader.vue @@ -4,7 +4,7 @@ @@ -74,22 +74,10 @@ export default { currentChat: 'getSelectedChat', }), - chatExtraAttributes() { - return this.chat.additional_attributes; - }, - chatMetadata() { return this.chat.meta; }, - chatBadge() { - if(this.chatExtraAttributes['type']){ - return this.chatExtraAttributes['type'] - } else { - return this.chatMetadata.channel - } - }, - currentContact() { return this.$store.getters['contacts/getContact']( this.chat.meta.sender.id diff --git a/app/javascript/shared/mixins/inboxMixin.js b/app/javascript/shared/mixins/inboxMixin.js index 562dd2a3b..a2112ca80 100644 --- a/app/javascript/shared/mixins/inboxMixin.js +++ b/app/javascript/shared/mixins/inboxMixin.js @@ -47,23 +47,29 @@ export default { const { medium: medium = '' } = this.inbox; return this.isATwilioChannel && medium === 'whatsapp'; }, + chatAdditionalAttributes() { + const { additional_attributes: additionalAttributes } = this.chat || {}; + return additionalAttributes || {}; + }, isTwitterInboxTweet() { - return ( - this.chat && - this.chat.additional_attributes && - this.chat.additional_attributes.type === 'tweet' - ); + return this.chatAdditionalAttributes.type === 'tweet'; }, twilioBadge() { return `${this.isATwilioSMSChannel ? 'sms' : 'whatsapp'}`; }, twitterBadge() { - return `${this.isTwitterInboxTweet ? 'twitter-tweet' : 'twitter-chat'}`; + return `${this.isTwitterInboxTweet ? 'twitter-tweet' : 'twitter-dm'}`; + }, + facebookBadge() { + return this.chatAdditionalAttributes.type || 'facebook'; }, inboxBadge() { if (this.isATwitterInbox) { return this.twitterBadge; } + if (this.isAFacebookInbox) { + return this.facebookBadge; + } if (this.isATwilioChannel) { return this.twilioBadge; } diff --git a/app/services/facebook/send_on_facebook_service.rb b/app/services/facebook/send_on_facebook_service.rb index a0c75db92..12e416ef7 100644 --- a/app/services/facebook/send_on_facebook_service.rb +++ b/app/services/facebook/send_on_facebook_service.rb @@ -9,8 +9,9 @@ class Facebook::SendOnFacebookService < Base::SendOnChannelService send_message_to_facebook fb_text_message_params if message.content.present? send_message_to_facebook fb_attachment_message_params if message.attachments.present? rescue Facebook::Messenger::FacebookError => e - Rails.logger.info e - channel.authorization_error! + Sentry.capture_exception(e) + # TODO : handle specific errors or else page will get disconnected + # channel.authorization_error! end def send_message_to_facebook(delivery_params) diff --git a/app/services/instagram/send_on_instagram_service.rb b/app/services/instagram/send_on_instagram_service.rb index 17ba76cb1..c47b18188 100644 --- a/app/services/instagram/send_on_instagram_service.rb +++ b/app/services/instagram/send_on_instagram_service.rb @@ -18,7 +18,8 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService send_to_facebook_page message_params rescue StandardError => e Sentry.capture_exception(e) - channel.authorization_error! + # TODO : handle specific errors or else page will get disconnected + # channel.authorization_error! end def message_params diff --git a/db/schema.rb b/db/schema.rb index 283018559..7a954f94d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_09_23_132659) do +ActiveRecord::Schema.define(version: 2021_09_29_150415) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" @@ -61,6 +61,14 @@ ActiveRecord::Schema.define(version: 2021_09_23_132659) do t.index ["message_id", "message_checksum"], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true end + create_table "actions", force: :cascade do |t| + t.string "name", null: false + t.jsonb "execution_list", default: {}, null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["name"], name: "index_actions_on_name" + end + create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false @@ -300,7 +308,7 @@ ActiveRecord::Schema.define(version: 2021_09_23_132659) do t.datetime "agent_last_seen_at" t.jsonb "additional_attributes", default: {} t.bigint "contact_inbox_id" - t.uuid "uuid", default: -> { "gen_random_uuid()" }, null: false + t.uuid "uuid", default: -> { "public.gen_random_uuid()" }, null: false t.string "identifier" t.datetime "last_activity_at", default: -> { "CURRENT_TIMESTAMP" }, null: false t.bigint "team_id" diff --git a/public/integrations/channels/badges/instagram-dm.png b/public/integrations/channels/badges/instagram-dm.png new file mode 100644 index 000000000..185a92f45 Binary files /dev/null and b/public/integrations/channels/badges/instagram-dm.png differ diff --git a/public/integrations/channels/badges/line.png b/public/integrations/channels/badges/line.png new file mode 100644 index 000000000..1beeb4eb3 Binary files /dev/null and b/public/integrations/channels/badges/line.png differ diff --git a/public/integrations/channels/badges/messenger.png b/public/integrations/channels/badges/messenger.png new file mode 100644 index 000000000..4bddb68d8 Binary files /dev/null and b/public/integrations/channels/badges/messenger.png differ diff --git a/public/integrations/channels/badges/sms.png b/public/integrations/channels/badges/sms.png new file mode 100644 index 000000000..ac3fb56d2 Binary files /dev/null and b/public/integrations/channels/badges/sms.png differ diff --git a/public/integrations/channels/badges/telegram.png b/public/integrations/channels/badges/telegram.png new file mode 100644 index 000000000..511430872 Binary files /dev/null and b/public/integrations/channels/badges/telegram.png differ diff --git a/public/integrations/channels/badges/twitter-dm.png b/public/integrations/channels/badges/twitter-dm.png new file mode 100644 index 000000000..980115fbb Binary files /dev/null and b/public/integrations/channels/badges/twitter-dm.png differ diff --git a/public/integrations/channels/badges/twitter-tweet.png b/public/integrations/channels/badges/twitter-tweet.png new file mode 100644 index 000000000..7af6a02d9 Binary files /dev/null and b/public/integrations/channels/badges/twitter-tweet.png differ diff --git a/public/integrations/channels/badges/whatsapp.png b/public/integrations/channels/badges/whatsapp.png new file mode 100644 index 000000000..589fc7a30 Binary files /dev/null and b/public/integrations/channels/badges/whatsapp.png differ