diff --git a/app/controllers/super_admin/dashboard_controller.rb b/app/controllers/super_admin/dashboard_controller.rb index b5f3d34eb..56d19d563 100644 --- a/app/controllers/super_admin/dashboard_controller.rb +++ b/app/controllers/super_admin/dashboard_controller.rb @@ -3,10 +3,9 @@ class SuperAdmin::DashboardController < SuperAdmin::ApplicationController def index @data = Conversation.unscoped.group_by_day(:created_at, range: 30.days.ago..2.seconds.ago).count.to_a - @accounts_count = number_with_delimiter(Account.all.length) - @users_count = number_with_delimiter(User.all.length) - @inboxes_count = number_with_delimiter(Inbox.all.length) - @conversations_count = number_with_delimiter(Conversation.all.length) - @messages_count = number_with_delimiter(Message.all.length) + @accounts_count = number_with_delimiter(Account.count) + @users_count = number_with_delimiter(User.count) + @inboxes_count = number_with_delimiter(Inbox.count) + @conversations_count = number_with_delimiter(Conversation.count) end end diff --git a/app/services/telegram/incoming_message_service.rb b/app/services/telegram/incoming_message_service.rb index 0e47f2813..ac1459887 100644 --- a/app/services/telegram/incoming_message_service.rb +++ b/app/services/telegram/incoming_message_service.rb @@ -1,8 +1,14 @@ +# Find the various telegram payload samples here: https://core.telegram.org/bots/webhooks#testing-your-bot-with-updates +# https://core.telegram.org/bots/api#available-types + class Telegram::IncomingMessageService include ::FileTypeHelper pattr_initialize [:inbox!, :params!] def perform + # chatwoot doesn't support group conversations at the moment + return unless private_message? + set_contact update_contact_avatar set_conversation @@ -20,6 +26,10 @@ class Telegram::IncomingMessageService private + def private_message? + params.dig(:message, :chat, :type) == 'private' + end + def account @account ||= inbox.account end diff --git a/app/views/super_admin/dashboard/index.html.erb b/app/views/super_admin/dashboard/index.html.erb index 967c00e55..0121a8a75 100644 --- a/app/views/super_admin/dashboard/index.html.erb +++ b/app/views/super_admin/dashboard/index.html.erb @@ -53,10 +53,6 @@ It renders the `_table` partial to display details about the resources.