From bbef03edea69aaea465ad773f54b768b426bb1a2 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Tue, 20 Oct 2020 18:35:40 +0530 Subject: [PATCH 01/36] chore: Update documentation for inbound email service (#1354) --- .env.example | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 5a6ab50ba..03199dd60 100644 --- a/.env.example +++ b/.env.example @@ -52,11 +52,11 @@ SMTP_ENABLE_STARTTLS_AUTO= MAILER_INBOUND_EMAIL_DOMAIN= # Set this to appropriate ingress channel with regards to incoming emails # Possible values are : -# :relay for Exim, Postfix, Qmail -# :mailgun for Mailgun -# :mandrill for Mandrill -# :postmark for Postmark -# :sendgrid for Sendgrid +# relay for Exim, Postfix, Qmail +# mailgun for Mailgun +# mandrill for Mandrill +# postmark for Postmark +# sendgrid for Sendgrid RAILS_INBOUND_EMAIL_SERVICE= # Use one of the following based on the email ingress service # Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html From cbe9e06472cf0b9781c5872a2f56c4871a3c44d5 Mon Sep 17 00:00:00 2001 From: Ronald Walker Date: Tue, 20 Oct 2020 06:52:21 -0700 Subject: [PATCH 02/36] chore: DRY up check_authorization method (#1351) --- app/controllers/api/base_controller.rb | 6 ++++++ app/controllers/api/v1/accounts/agents_controller.rb | 2 +- app/controllers/api/v1/accounts/contacts_controller.rb | 4 ---- app/controllers/api/v1/accounts/inboxes_controller.rb | 4 ---- app/controllers/api/v1/accounts/labels_controller.rb | 4 ---- app/controllers/api/v1/accounts/webhooks_controller.rb | 4 ---- app/controllers/api/v1/accounts_controller.rb | 4 ---- 7 files changed, 7 insertions(+), 21 deletions(-) diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index 1b9fa24cc..0cfd7205b 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -10,4 +10,10 @@ class Api::BaseController < ApplicationController def authenticate_by_access_token? request.headers[:api_access_token].present? || request.headers[:HTTP_API_ACCESS_TOKEN].present? end + + def check_authorization(model = nil) + model ||= controller_name.classify.constantize + + authorize(model) + end end diff --git a/app/controllers/api/v1/accounts/agents_controller.rb b/app/controllers/api/v1/accounts/agents_controller.rb index dacd66e46..ed9d3ebc8 100644 --- a/app/controllers/api/v1/accounts/agents_controller.rb +++ b/app/controllers/api/v1/accounts/agents_controller.rb @@ -27,7 +27,7 @@ class Api::V1::Accounts::AgentsController < Api::V1::Accounts::BaseController private def check_authorization - authorize(User) + super(User) end def fetch_agent diff --git a/app/controllers/api/v1/accounts/contacts_controller.rb b/app/controllers/api/v1/accounts/contacts_controller.rb index a82a30414..031b8b706 100644 --- a/app/controllers/api/v1/accounts/contacts_controller.rb +++ b/app/controllers/api/v1/accounts/contacts_controller.rb @@ -41,10 +41,6 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController private - def check_authorization - authorize(Contact) - end - def build_contact_inbox return if params[:inbox_id].blank? diff --git a/app/controllers/api/v1/accounts/inboxes_controller.rb b/app/controllers/api/v1/accounts/inboxes_controller.rb index 98163bae7..41b64b76d 100644 --- a/app/controllers/api/v1/accounts/inboxes_controller.rb +++ b/app/controllers/api/v1/accounts/inboxes_controller.rb @@ -55,10 +55,6 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController @agent_bot = AgentBot.find(params[:agent_bot]) if params[:agent_bot] end - def check_authorization - authorize(Inbox) - end - def create_channel case permitted_params[:channel][:type] when 'web_widget' diff --git a/app/controllers/api/v1/accounts/labels_controller.rb b/app/controllers/api/v1/accounts/labels_controller.rb index 12c026e66..547b9e6d6 100644 --- a/app/controllers/api/v1/accounts/labels_controller.rb +++ b/app/controllers/api/v1/accounts/labels_controller.rb @@ -28,10 +28,6 @@ class Api::V1::Accounts::LabelsController < Api::V1::Accounts::BaseController @label = Current.account.labels.find(params[:id]) end - def check_authorization - authorize(Label) - end - def permitted_params params.require(:label).permit(:title, :description, :color, :show_on_sidebar) end diff --git a/app/controllers/api/v1/accounts/webhooks_controller.rb b/app/controllers/api/v1/accounts/webhooks_controller.rb index 9e61904d6..58f9b21a0 100644 --- a/app/controllers/api/v1/accounts/webhooks_controller.rb +++ b/app/controllers/api/v1/accounts/webhooks_controller.rb @@ -29,8 +29,4 @@ class Api::V1::Accounts::WebhooksController < Api::V1::Accounts::BaseController def fetch_webhook @webhook = Current.account.webhooks.find(params[:id]) end - - def check_authorization - authorize(Webhook) - end end diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 933bd5a3a..5d7064fd0 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -44,10 +44,6 @@ class Api::V1::AccountsController < Api::BaseController private - def check_authorization - authorize(Account) - end - def confirmed? super_admin? && params[:confirmed] end From 552df63621fd417354fb97a807b5fad00178a338 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Wed, 21 Oct 2020 13:03:04 +0530 Subject: [PATCH 03/36] fix: Show File Upload for API Inbox (#1356) --- .../dashboard/components/widgets/conversation/ReplyBox.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index f56d224a5..ba55a8a78 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -179,7 +179,8 @@ export default { return ( this.isAWebWidgetInbox || this.isAFacebookInbox || - this.isATwilioWhatsappChannel + this.isATwilioWhatsappChannel || + this.isAPIInbox ); }, replyButtonLabel() { From b9be43b27646f80a5a09485943e6e21b88706f0f Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Wed, 21 Oct 2020 15:18:36 +0530 Subject: [PATCH 04/36] fix: Add compact type, fix spacing in contact panel (#1352) * fix: Add compact type, fix spacing in contact panel * Set padding-top, padding-bottom --- app/javascript/dashboard/assets/scss/widgets/_buttons.scss | 5 +++++ .../routes/dashboard/conversation/contact/ContactInfoRow.vue | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/assets/scss/widgets/_buttons.scss b/app/javascript/dashboard/assets/scss/widgets/_buttons.scss index 7e141d30e..280997559 100644 --- a/app/javascript/dashboard/assets/scss/widgets/_buttons.scss +++ b/app/javascript/dashboard/assets/scss/widgets/_buttons.scss @@ -38,6 +38,11 @@ &.round { border-radius: $space-larger; } + + &.compact { + padding-bottom: 0; + padding-top: 0; + } } .button--fixed-right-top { diff --git a/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfoRow.vue b/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfoRow.vue index 2067218e0..154dbee2a 100644 --- a/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfoRow.vue +++ b/app/javascript/dashboard/routes/dashboard/conversation/contact/ContactInfoRow.vue @@ -10,7 +10,7 @@