chore: Update dependencies (#1173)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
class Messages::Facebook::MessageBuilder
|
||||
attr_reader :response
|
||||
|
||||
def initialize(response, inbox, outgoing_echo = false)
|
||||
def initialize(response, inbox, outgoing_echo: false)
|
||||
@response = response
|
||||
@inbox = inbox
|
||||
@outgoing_echo = outgoing_echo
|
||||
|
||||
@@ -41,9 +41,10 @@ class Api::V1::Accounts::ConversationsController < Api::V1::Accounts::BaseContro
|
||||
end
|
||||
|
||||
def toggle_typing_status
|
||||
if params[:typing_status] == 'on'
|
||||
case params[:typing_status]
|
||||
when 'on'
|
||||
trigger_typing_event(CONVERSATION_TYPING_ON)
|
||||
elsif params[:typing_status] == 'off'
|
||||
when 'off'
|
||||
trigger_typing_event(CONVERSATION_TYPING_OFF)
|
||||
end
|
||||
head :ok
|
||||
|
||||
@@ -12,7 +12,7 @@ class Api::V1::Accounts::InboxMembersController < Api::V1::Accounts::BaseControl
|
||||
end
|
||||
|
||||
def show
|
||||
@agents = Current.account.users.where(id: @inbox.members.pluck(:user_id))
|
||||
@agents = Current.account.users.where(id: @inbox.members.select(:user_id))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -91,7 +91,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
|
||||
:welcome_tagline,
|
||||
:webhook_url,
|
||||
:email,
|
||||
selected_feature_flags: []
|
||||
{ selected_feature_flags: [] }
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,9 +26,10 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
||||
def toggle_typing
|
||||
head :ok && return if conversation.nil?
|
||||
|
||||
if permitted_params[:typing_status] == 'on'
|
||||
case permitted_params[:typing_status]
|
||||
when 'on'
|
||||
trigger_typing_event(CONVERSATION_TYPING_ON)
|
||||
elsif permitted_params[:typing_status] == 'off'
|
||||
when 'off'
|
||||
trigger_typing_event(CONVERSATION_TYPING_OFF)
|
||||
end
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class Api::V1::Widget::MessagesController < Api::V1::Widget::BaseController
|
||||
end
|
||||
|
||||
def message_update_params
|
||||
params.permit(message: [submitted_values: [:name, :title, :value]])
|
||||
params.permit(message: [{ submitted_values: [:name, :title, :value] }])
|
||||
end
|
||||
|
||||
def permitted_params
|
||||
|
||||
@@ -25,6 +25,6 @@ class DeviseOverrides::ConfirmationsController < Devise::ConfirmationsController
|
||||
user.reset_password_token = enc
|
||||
user.reset_password_sent_at = Time.now.utc
|
||||
user.save(validate: false)
|
||||
'/app/auth/password/edit?config=default&redirect_url=&reset_password_token=' + raw
|
||||
"/app/auth/password/edit?config=default&redirect_url=&reset_password_token=#{raw}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class Twitter::CallbacksController < Twitter::BaseController
|
||||
end
|
||||
|
||||
def account
|
||||
@account ||= Account.find_by!(id: account_id)
|
||||
@account ||= Account.find(account_id)
|
||||
end
|
||||
|
||||
def twitter_app_redirect_url
|
||||
|
||||
@@ -9,11 +9,10 @@ class AsyncDispatcher < BaseDispatcher
|
||||
end
|
||||
|
||||
def listeners
|
||||
listeners = [
|
||||
[
|
||||
EventListener.instance,
|
||||
WebhookListener.instance,
|
||||
InstallationWebhookListener.instance, HookListener.instance
|
||||
]
|
||||
listeners
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,9 +67,10 @@ class ConversationFinder
|
||||
end
|
||||
|
||||
def filter_by_assignee_type
|
||||
if @assignee_type == 'me'
|
||||
case @assignee_type
|
||||
when 'me'
|
||||
@conversations = @conversations.assigned_to(current_user)
|
||||
elsif @assignee_type == 'unassigned'
|
||||
when 'unassigned'
|
||||
@conversations = @conversations.unassigned
|
||||
end
|
||||
@conversations
|
||||
|
||||
@@ -4,11 +4,12 @@ class SendReplyJob < ApplicationJob
|
||||
def perform(message_id)
|
||||
message = Message.find(message_id)
|
||||
channel_name = message.conversation.inbox.channel.class.to_s
|
||||
if channel_name == 'Channel::FacebookPage'
|
||||
case channel_name
|
||||
when 'Channel::FacebookPage'
|
||||
::Facebook::SendOnFacebookService.new(message: message).perform
|
||||
elsif channel_name == 'Channel::TwitterProfile'
|
||||
when 'Channel::TwitterProfile'
|
||||
::Twitter::SendOnTwitterService.new(message: message).perform
|
||||
elsif channel_name == 'Channel::TwilioSms'
|
||||
when 'Channel::TwilioSms'
|
||||
::Twilio::SendOnTwilioService.new(message: message).perform
|
||||
end
|
||||
end
|
||||
|
||||
@@ -120,8 +120,7 @@ class ActionCableListener < BaseListener
|
||||
def user_tokens(account, agents)
|
||||
agent_tokens = agents.pluck(:pubsub_token)
|
||||
admin_tokens = account.administrators.pluck(:pubsub_token)
|
||||
pubsub_tokens = (agent_tokens + admin_tokens).uniq
|
||||
pubsub_tokens
|
||||
(agent_tokens + admin_tokens).uniq
|
||||
end
|
||||
|
||||
def contact_token(contact, message)
|
||||
|
||||
@@ -63,7 +63,7 @@ class Channel::TwitterProfile < ApplicationRecord
|
||||
def unsubscribe
|
||||
### Fix unsubscription with new endpoint
|
||||
unsubscribe_response = twitter_client.remove_subscription(user_id: profile_id)
|
||||
Rails.logger.info 'TWITTER_UNSUBSCRIBE: ' + unsubscribe_response.body.to_s
|
||||
Rails.logger.info "TWITTER_UNSUBSCRIBE: #{unsubscribe_response.body}"
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
end
|
||||
|
||||
@@ -54,7 +54,7 @@ module Featurable
|
||||
config = InstallationConfig.find_by(name: 'ACCOUNT_LEVEL_FEATURE_DEFAULTS')
|
||||
return true if config.blank?
|
||||
|
||||
features_to_enabled = config.value.select { |f| f[:enabled] }.map { |f| f[:name] }
|
||||
features_to_enabled = config.value.select { |f| f[:enabled] }.pluck(:name)
|
||||
enable_features(*features_to_enabled)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,13 +48,13 @@ class Conversation < ApplicationRecord
|
||||
|
||||
has_many :messages, dependent: :destroy, autosave: true
|
||||
|
||||
before_create :set_display_id, unless: :display_id?
|
||||
before_create :set_bot_conversation
|
||||
after_create_commit :notify_conversation_creation
|
||||
after_save :run_round_robin
|
||||
before_create :set_display_id, unless: :display_id?
|
||||
# wanted to change this to after_update commit. But it ended up creating a loop
|
||||
# reinvestigate in future and identity the implications
|
||||
after_update :notify_status_change, :create_activity
|
||||
after_create_commit :notify_conversation_creation
|
||||
after_save :run_round_robin
|
||||
|
||||
acts_as_taggable_on :labels
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class Integrations::App
|
||||
def enabled?(account)
|
||||
case params[:id]
|
||||
when 'slack'
|
||||
account.hooks.where(app_id: id).exists?
|
||||
account.hooks.exists?(app_id: id)
|
||||
else
|
||||
true
|
||||
end
|
||||
|
||||
@@ -71,8 +71,9 @@ class Notification < ApplicationRecord
|
||||
|
||||
def process_notification_delivery
|
||||
Notification::PushNotificationJob.perform_later(self)
|
||||
|
||||
# Queuing after 2 minutes so that we won't send emails for read notifications
|
||||
Notification::EmailNotificationJob.set(wait: 2.minutes).perform_later(self)
|
||||
# Should we do something about the case where user subscribed to both push and email ?
|
||||
# In future, we could probably add condition here to enqueue the job for 30 seconds later
|
||||
# when push enabled and then check in email job whether notification has been read already.
|
||||
Notification::EmailNotificationJob.perform_later(self)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,8 +127,7 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def serializable_hash(options = nil)
|
||||
serialized_user = super(options).merge(confirmed: confirmed?)
|
||||
serialized_user
|
||||
super(options).merge(confirmed: confirmed?)
|
||||
end
|
||||
|
||||
def push_event_data
|
||||
|
||||
@@ -2,7 +2,7 @@ class ApplicationPolicy
|
||||
attr_reader :user_context, :user, :record, :account, :account_user
|
||||
|
||||
def initialize(user_context, record)
|
||||
@user_context = user_context = user_context
|
||||
@user_context = user_context
|
||||
@user = user_context[:user]
|
||||
@account = user_context[:account]
|
||||
@account_user = user_context[:account_user]
|
||||
@@ -14,7 +14,7 @@ class ApplicationPolicy
|
||||
end
|
||||
|
||||
def show?
|
||||
scope.where(id: record.id).exists?
|
||||
scope.exists?(id: record.id)
|
||||
end
|
||||
|
||||
def create?
|
||||
@@ -45,7 +45,7 @@ class ApplicationPolicy
|
||||
attr_reader :user_context, :user, :scope, :account, :account_user
|
||||
|
||||
def initialize(user_context, scope)
|
||||
@user_context = user_context = user_context
|
||||
@user_context = user_context
|
||||
@user = user_context[:user]
|
||||
@account = user_context[:account]
|
||||
@account_user = user_context[:account_user]
|
||||
|
||||
@@ -88,10 +88,10 @@ class MailPresenter < SimpleDelegator
|
||||
return sender_agnostic_regexes if @account.nil? || account_support_email.blank?
|
||||
|
||||
[
|
||||
Regexp.new("From:\s*" + Regexp.escape(account_support_email), Regexp::IGNORECASE),
|
||||
Regexp.new('<' + Regexp.escape(account_support_email) + '>', Regexp::IGNORECASE),
|
||||
Regexp.new(Regexp.escape(account_support_email) + "\s+wrote:", Regexp::IGNORECASE),
|
||||
Regexp.new('On(.*)' + Regexp.escape(account_support_email) + '(.*)wrote:', Regexp::IGNORECASE)
|
||||
Regexp.new("From:\s* #{Regexp.escape(account_support_email)}", Regexp::IGNORECASE),
|
||||
Regexp.new("<#{Regexp.escape(account_support_email)}>", Regexp::IGNORECASE),
|
||||
Regexp.new("#{Regexp.escape(account_support_email)}\s+wrote:", Regexp::IGNORECASE),
|
||||
Regexp.new("On(.*)#{Regexp.escape(account_support_email)}(.*)wrote:", Regexp::IGNORECASE)
|
||||
] + sender_agnostic_regexes
|
||||
end
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class Twitter::SendOnTwitterService < Base::SendOnChannelService
|
||||
tweet_data = response.body
|
||||
message.update!(source_id: tweet_data['id_str'])
|
||||
else
|
||||
Rails.logger.info 'TWITTER_TWEET_REPLY_ERROR' + response.body
|
||||
Rails.logger.info "TWITTER_TWEET_REPLY_ERROR #{response.body}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ class Twitter::WebhookSubscribeService
|
||||
delegate :twitter_client, to: :channel
|
||||
|
||||
def inbox
|
||||
Inbox.find_by!(id: inbox_id)
|
||||
Inbox.find(inbox_id)
|
||||
end
|
||||
|
||||
def twitter_url
|
||||
@@ -38,12 +38,12 @@ class Twitter::WebhookSubscribeService
|
||||
|
||||
def unregister_webhook(webhook)
|
||||
unregister_response = twitter_client.unregister_webhook(id: webhook.try(:[], 'id'))
|
||||
Rails.logger.info 'TWITTER_UNREGISTER_WEBHOOK: ' + unregister_response.body.to_s
|
||||
Rails.logger.info "TWITTER_UNREGISTER_WEBHOOK: #{unregister_response.body}"
|
||||
end
|
||||
|
||||
def register_webhook
|
||||
register_response = twitter_client.register_webhook(url: twitter_url)
|
||||
Rails.logger.info 'TWITTER_UNREGISTER_WEBHOOK: ' + register_response.body.to_s
|
||||
Rails.logger.info "TWITTER_UNREGISTER_WEBHOOK: #{register_response.body}"
|
||||
end
|
||||
|
||||
def subscription?
|
||||
|
||||
@@ -36,7 +36,7 @@ as defined by the routes in the `admin/` namespace
|
||||
<i class="<%= sidebar_icons[resource.resource.to_sym] %>"></i>
|
||||
<%= link_to(
|
||||
display_resource_name(resource),
|
||||
[namespace, resource_index_route_key(resource)],
|
||||
resource_index_route(resource)
|
||||
) if valid_action? :index, resource %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user