Compare commits

...

12 commits

Author SHA1 Message Date
Sojan Jose
4e2d8422d0
Merge branch 'develop' into feat/upgrade_ruby 2022-12-19 15:48:57 +05:30
Sojan Jose
fcdb4c7d25
chore: remove space 2022-12-08 19:31:05 +03:00
Sojan
c4eb0a41e7 chore: remove change in yarnlock 2022-12-08 19:26:10 +03:00
Sojan
d26c56d4c9 fix: webpush error 2022-12-08 19:22:16 +03:00
Sojan
5cd472bb9f chore: fix rubocop 2022-12-08 18:40:37 +03:00
Sojan
ba3b70ea30 fix: rubocop 2022-12-08 18:31:51 +03:00
Sojan
f8dc22602e chore: revert gem updates 2022-12-08 18:13:36 +03:00
Sojan
d87aeabe28 Merge branch 'develop' into feat/upgrade_ruby 2022-12-08 17:52:51 +03:00
Vishnu Narayanan
d84a47f699
chore: update docker base image to 3.1.2-alpine 2022-10-05 14:32:09 +05:30
Vishnu Narayanan
547b3fa490
chore: add net-smtp gem 2022-10-05 14:29:19 +05:30
Vishnu Narayanan
59786f2eef
chore: upgrade circleci and gh action to use ruby 3.1.2 2022-10-05 13:24:53 +05:30
Vishnu Narayanan
ec5b507f07
chore: upgrade ruby to 3.1.2 2022-10-05 12:29:47 +05:30
17 changed files with 68 additions and 37 deletions

View file

@ -7,7 +7,7 @@ defaults: &defaults
working_directory: ~/build
docker:
# specify the version you desire here
- image: cimg/ruby:3.0.4-browsers
- image: cimg/ruby:3.1.2-browsers
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images

View file

@ -47,7 +47,6 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.4 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: yarn

View file

@ -86,6 +86,10 @@ Style/ClassAndModuleChildren:
- 'config/application.rb'
Style/MapToHash:
Enabled: false
Style/HashSyntax:
Enabled: true
EnforcedStyle: no_mixed_keys
EnforcedShorthandSyntax: never
RSpec/NestedGroups:
Enabled: true
Max: 4

View file

@ -1 +1 @@
3.0.4
3.1.2

14
Gemfile
View file

@ -1,6 +1,6 @@
source 'https://rubygems.org'
ruby '3.0.4'
ruby '3.1.2'
##-- base gems for rails --##
gem 'rack-cors', require: 'rack/cors'
@ -105,7 +105,12 @@ gem 'sidekiq-cron', '~> 1.3'
##-- Push notification service --##
gem 'fcm'
gem 'webpush'
# Ref: https://github.com/mastodon/mastodon/pull/18449
# ref: https://github.com/zaru/webpush/pull/106
# lets switch to web-push gem once the above PR is merged
# https://github.com/zaru/webpush/pull/106#issuecomment-1342925261
gem 'webpush', git: 'https://github.com/ClearlyClaire/webpush.git', ref: 'f14a4d52e201128b1b00245d11b6de80d6cfdcd9'
##-- geocoding / parse location from ip --##
# http://www.rubygeocoder.com/
@ -135,6 +140,11 @@ gem 'stripe'
## to populate db with sample data
gem 'faker'
# Can remove this in rails 7
gem 'net-imap', require: false
gem 'net-pop', require: false
gem 'net-smtp', require: false
group :production, :staging do
# we dont want request timing out in development while using byebug
gem 'rack-timeout'

View file

@ -1,3 +1,12 @@
GIT
remote: https://github.com/ClearlyClaire/webpush.git
revision: f14a4d52e201128b1b00245d11b6de80d6cfdcd9
ref: f14a4d52e201128b1b00245d11b6de80d6cfdcd9
specs:
webpush (0.3.8)
hkdf (~> 0.2)
jwt (~> 2.0)
GIT
remote: https://github.com/chatwoot/devise-secure_password
revision: d777b04f12652d576b1272b8f39857e3e0b3fc26
@ -358,7 +367,7 @@ GEM
hana (~> 1.3)
regexp_parser (~> 2.0)
uri_template (~> 0.7)
jwt (2.4.1)
jwt (2.5.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.2)
@ -424,6 +433,14 @@ GEM
multipart-post (2.2.3)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-imap (0.3.1)
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
netrc (0.11.0)
newrelic_rpm (8.9.0)
nio4r (2.5.8)
@ -640,6 +657,7 @@ GEM
time_diff (0.3.0)
activesupport
i18n
timeout (0.3.1)
trailblazer-option (0.1.2)
twilio-ruby (5.68.0)
faraday (>= 0.9, < 3.0)
@ -679,9 +697,6 @@ GEM
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webpush (1.1.0)
hkdf (~> 0.2)
jwt (~> 2.0)
webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
@ -755,6 +770,9 @@ DEPENDENCIES
listen
maxminddb
mock_redis
net-imap
net-pop
net-smtp
newrelic_rpm
pg
pg_search
@ -805,7 +823,7 @@ DEPENDENCIES
working_hours
RUBY VERSION
ruby 3.0.4p208
ruby 3.1.2p20
BUNDLED WITH
2.3.16
2.3.26

View file

@ -3,25 +3,25 @@ module SwitchLocale
private
def switch_locale(&action)
def switch_locale(&)
# priority is for locale set in query string (mostly for widget/from js sdk)
locale ||= locale_from_params
# if locale is not set in account, let's use DEFAULT_LOCALE env variable
locale ||= locale_from_env_variable
set_locale(locale, &action)
set_locale(locale, &)
end
def switch_locale_using_account_locale(&action)
def switch_locale_using_account_locale(&)
locale = locale_from_account(@current_account)
set_locale(locale, &action)
set_locale(locale, &)
end
def set_locale(locale, &action)
def set_locale(locale, &)
# if locale is empty, use default_locale
locale ||= I18n.default_locale
# Ensure locale won't bleed into other requests
# https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests
I18n.with_locale(locale, &action)
I18n.with_locale(locale, &)
end
def locale_from_params

View file

@ -69,11 +69,11 @@ class ApplicationMailer < ActionMailer::Base
Current.account = account if account.present?
end
def switch_locale(&action)
def switch_locale(&)
locale ||= locale_from_account(Current.account)
locale ||= I18n.default_locale
# ensure locale won't bleed into other requests
# https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests
I18n.with_locale(locale, &action)
I18n.with_locale(locale, &)
end
end

View file

@ -33,7 +33,7 @@ class DashboardApp < ApplicationRecord
'required' => %w[url type],
'properties' => {
'type' => { 'enum': ['frame'] },
'url' => { 'type': 'string', 'format' => 'uri' }
'url' => { :type => 'string', 'format' => 'uri' }
}
},
'additionalProperties' => false,

View file

@ -78,7 +78,7 @@ class Whatsapp::Providers::WhatsappCloudService < Whatsapp::Providers::BaseServi
"#{phone_id_path}/messages",
headers: api_headers,
body: {
messaging_product: 'whatsapp',
:messaging_product => 'whatsapp',
'to' => phone_number,
'type' => type,
type.to_s => type_content

View file

@ -1,5 +1,5 @@
# pre-build stage
FROM ruby:3.0.4-alpine AS pre-builder
FROM ruby:3.1.2-alpine AS pre-builder
# ARG default to production settings
# For development docker-compose file overrides ARGS
@ -65,7 +65,7 @@ RUN rm -rf /gems/ruby/3.0.0/cache/*.gem \
&& find /gems/ruby/3.0.0/gems/ \( -name "*.c" -o -name "*.o" \) -delete
# final build stage
FROM ruby:3.0.4-alpine
FROM ruby:3.1.2-alpine
ARG BUNDLE_WITHOUT="development:test"
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}

View file

@ -278,7 +278,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do
{ 'action_name' => 'snooze_conversation' },
{ 'action_name' => 'assign_agent', 'action_params' => [user_1.id] },
{ 'action_name' => 'send_message', 'action_params' => ['Send this message.'] },
{ 'action_name' => 'add_private_note', 'action_params': ['We are sending greeting message to customer.'] }
{ 'action_name' => 'add_private_note', :action_params => ['We are sending greeting message to customer.'] }
])
end

View file

@ -8,7 +8,7 @@ FactoryBot.define do
'type' => 'message_create',
'id' => '123',
'message_create' => {
target: { 'recipient_id' => '1' },
:target => { 'recipient_id' => '1' },
'sender_id' => '2',
'source_app_id' => '268278',
'message_data' => {

View file

@ -4,7 +4,7 @@ RSpec.describe Webhooks::LineEventsJob, type: :job do
subject(:job) { described_class.perform_later(params: params) }
let!(:line_channel) { create(:channel_line) }
let!(:params) { { line_channel_id: line_channel.line_channel_id, 'line' => { test: 'test' } } }
let!(:params) { { :line_channel_id => line_channel.line_channel_id, 'line' => { test: 'test' } } }
let(:post_body) { params.to_json }
let(:signature) { Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), line_channel.line_channel_secret, post_body)) }

View file

@ -4,7 +4,7 @@ RSpec.describe Webhooks::TelegramEventsJob, type: :job do
subject(:job) { described_class.perform_later(params) }
let!(:telegram_channel) { create(:channel_telegram) }
let!(:params) { { bot_token: telegram_channel.bot_token, 'telegram' => { test: 'test' } } }
let!(:params) { { :bot_token => telegram_channel.bot_token, 'telegram' => { test: 'test' } } }
it 'enqueues the job' do
expect { job }.to have_enqueued_job(described_class)

View file

@ -58,8 +58,8 @@ describe Whatsapp::IncomingMessageService do
'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }],
'messages' => [{
'errors' => [{ 'code': 131_051, 'title': 'Message type is currently not supported.' }],
'from': '2423423243', 'id': 'wamid.SDFADSf23sfasdafasdfa',
'timestamp': '1667047370', 'type': 'unsupported'
:from => '2423423243', :id => 'wamid.SDFADSf23sfasdafasdfa',
:timestamp => '1667047370', :type => 'unsupported'
}]
}.with_indifferent_access
@ -115,7 +115,7 @@ describe Whatsapp::IncomingMessageService do
params = {
'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }],
'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa',
'interactive': {
:interactive => {
'button_reply': {
'id': '1',
'title': 'First Button'
@ -179,11 +179,11 @@ describe Whatsapp::IncomingMessageService do
'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }],
'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa',
'location' => { 'id' => 'b1c68f38-8734-4ad3-b4a1-ef0c10d683',
'address': 'San Francisco, CA, USA',
'latitude': 37.7893768,
'longitude': -122.3895553,
'name': 'Bay Bridge',
'url': 'http://location_url.test' },
:address => 'San Francisco, CA, USA',
:latitude => 37.7893768,
:longitude => -122.3895553,
:name => 'Bay Bridge',
:url => 'http://location_url.test' },
'timestamp' => '1633034394', 'type' => 'location' }]
}.with_indifferent_access
described_class.new(inbox: whatsapp_channel.inbox, params: params).perform

View file

@ -15,7 +15,7 @@ RSpec.configure do |config|
config.shared_context_metadata_behavior = :apply_to_host_groups
def with_modified_env(options, &block)
ClimateControl.modify(options, &block)
def with_modified_env(options, &)
ClimateControl.modify(options, &)
end
end