Skip to content

Commit

Permalink
Upgrade: update project with v1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
versedpro committed Oct 21, 2020
2 parents 83d2bda + b9be43b commit 6e0075e
Show file tree
Hide file tree
Showing 109 changed files with 1,494 additions and 676 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ MAILER_INBOUND_EMAIL_DOMAIN=usg.mail.textyomni.com
# :mandrill for Mandrill
# :postmark for Postmark
# :sendgrid for Sendgrid
RAILS_INBOUND_EMAIL_SERVICE=: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
RAILS_INBOUND_EMAIL_PASSWORD=x3fGwQ95vStP
Expand Down
104 changes: 52 additions & 52 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,56 @@ GEM
specs:
action-cable-testing (0.6.1)
actioncable (>= 5.0)
actioncable (6.0.3.3)
actionpack (= 6.0.3.3)
actioncable (6.0.3.4)
actionpack (= 6.0.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.3)
actionpack (= 6.0.3.3)
activejob (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
actionmailbox (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
mail (>= 2.7.1)
actionmailer (6.0.3.3)
actionpack (= 6.0.3.3)
actionview (= 6.0.3.3)
activejob (= 6.0.3.3)
actionmailer (6.0.3.4)
actionpack (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.3)
actionview (= 6.0.3.3)
activesupport (= 6.0.3.3)
actionpack (6.0.3.4)
actionview (= 6.0.3.4)
activesupport (= 6.0.3.4)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.3)
actionpack (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
actiontext (6.0.3.4)
actionpack (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
nokogiri (>= 1.8.5)
actionview (6.0.3.3)
activesupport (= 6.0.3.3)
actionview (6.0.3.4)
activesupport (= 6.0.3.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.3)
activesupport (= 6.0.3.3)
activejob (6.0.3.4)
activesupport (= 6.0.3.4)
globalid (>= 0.3.6)
activemodel (6.0.3.3)
activesupport (= 6.0.3.3)
activerecord (6.0.3.3)
activemodel (= 6.0.3.3)
activesupport (= 6.0.3.3)
activestorage (6.0.3.3)
actionpack (= 6.0.3.3)
activejob (= 6.0.3.3)
activerecord (= 6.0.3.3)
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activerecord (6.0.3.4)
activemodel (= 6.0.3.4)
activesupport (= 6.0.3.4)
activestorage (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
marcel (~> 0.3.1)
activesupport (6.0.3.3)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand Down Expand Up @@ -313,7 +313,7 @@ GEM
multi_xml (0.6.0)
multipart-post (2.1.1)
netrc (0.11.0)
nio4r (2.5.3)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oauth (0.5.4)
Expand Down Expand Up @@ -344,29 +344,29 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.3)
actioncable (= 6.0.3.3)
actionmailbox (= 6.0.3.3)
actionmailer (= 6.0.3.3)
actionpack (= 6.0.3.3)
actiontext (= 6.0.3.3)
actionview (= 6.0.3.3)
activejob (= 6.0.3.3)
activemodel (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
rails (6.0.3.4)
actioncable (= 6.0.3.4)
actionmailbox (= 6.0.3.4)
actionmailer (= 6.0.3.4)
actionpack (= 6.0.3.4)
actiontext (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
activemodel (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
bundler (>= 1.3.0)
railties (= 6.0.3.3)
railties (= 6.0.3.4)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.3)
actionpack (= 6.0.3.3)
activesupport (= 6.0.3.3)
railties (6.0.3.4)
actionpack (= 6.0.3.4)
activesupport (= 6.0.3.4)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
Expand Down Expand Up @@ -496,7 +496,7 @@ GEM
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
Expand Down
2 changes: 1 addition & 1 deletion app/builders/messages/facebook/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def build_message
def attach_file(attachment, file_url)
file_resource = LocalResource.new(file_url)
attachment.file.attach(io: file_resource.file, filename: file_resource.filename, content_type: file_resource.encoding)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
rescue *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "invalid url #{file_url} : #{e.message}"
end

Expand Down
6 changes: 6 additions & 0 deletions app/controllers/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts/agents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def create
private

def check_authorization
authorize(User)
super(User)
end

def fetch_agent
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/accounts/callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def set_avatar(facebook_inbox, page_id)

avatar_resource = LocalResource.new(uri)
facebook_inbox.avatar.attach(io: avatar_resource.file, filename: avatar_resource.tmp_filename, content_type: avatar_resource.encoding)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError => e
rescue *ExceptionList::URI_EXCEPTIONS => e
Rails.logger.info "invalid url #{file_url} : #{e.message}"
end

Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v1/accounts/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ def search

private

def check_authorization
authorize(Contact)
end

def build_contact_inbox
return if params[:inbox_id].blank?

Expand Down
5 changes: 5 additions & 0 deletions app/controllers/api/v1/accounts/conversations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def mute
head :ok
end

def unmute
@conversation.unmute!
head :ok
end

def transcript
ConversationReplyMailer.conversation_transcript(@conversation, params[:email])&.deliver_later if params[:email].present?
head :ok
Expand Down
7 changes: 2 additions & 5 deletions app/controllers/api/v1/accounts/inboxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ def fetch_agent_bot
@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'
Expand All @@ -79,7 +75,7 @@ def update_channel_feature_flags

def permitted_params
params.permit(:id, :avatar, :name, :greeting_message, :greeting_enabled, channel:
[:type, :website_url, :widget_color, :welcome_title, :welcome_tagline, :webhook_url, :email])
[:type, :website_url, :widget_color, :welcome_title, :welcome_tagline, :webhook_url, :email, :reply_time])
end

def inbox_update_params
Expand All @@ -91,6 +87,7 @@ def inbox_update_params
:welcome_tagline,
:webhook_url,
:email,
:reply_time,
{ selected_feature_flags: [] }
])
end
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v1/accounts/labels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ def fetch_label
@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
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/api/v1/accounts/webhooks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ def webhook_params
def fetch_webhook
@webhook = Current.account.webhooks.find(params[:id])
end

def check_authorization
authorize(Webhook)
end
end
4 changes: 0 additions & 4 deletions app/controllers/api/v1/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ def update_active_at

private

def check_authorization
authorize(Account)
end

def confirmed?
super_admin? && params[:confirmed]
end
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/api/v1/widget/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ class Api::V1::Widget::BaseController < ApplicationController

private

def conversations
@conversations = @contact_inbox.conversations.where(inbox_id: auth_token_params[:inbox_id])
end

def conversation
@conversation ||= @contact_inbox.conversations.where(
inbox_id: auth_token_params[:inbox_id]
).last
@conversation ||= conversations.last
end

def auth_token_params
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/dashboard/api/inbox/conversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class ConversationApi extends ApiClient {
return axios.post(`${this.url}/${conversationId}/mute`);
}

unmute(conversationId) {
return axios.post(`${this.url}/${conversationId}/unmute`);
}

meta({ inboxId, status, assigneeType, labels }) {
return axios.get(`${this.url}/meta`, {
params: {
Expand Down
25 changes: 25 additions & 0 deletions app/javascript/dashboard/api/specs/inbox/conversation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,32 @@ describe('#ConversationAPI', () => {
expect(conversationAPI).toHaveProperty('markMessageRead');
expect(conversationAPI).toHaveProperty('toggleTyping');
expect(conversationAPI).toHaveProperty('mute');
expect(conversationAPI).toHaveProperty('unmute');
expect(conversationAPI).toHaveProperty('meta');
expect(conversationAPI).toHaveProperty('sendEmailTranscript');
});

describe('API calls', () => {
let originalAxios = null;
let axiosMock = null;

beforeEach(() => {
originalAxios = window.axios;
axiosMock = { post: jest.fn(() => Promise.resolve()) };

window.axios = axiosMock;
});

afterEach(() => {
window.axios = originalAxios;
});

it('#unmute', () => {
conversationAPI.unmute(45);

expect(axiosMock.post).toHaveBeenCalledWith(
'/api/v1/conversations/45/unmute'
);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

.button {
font-family: $body-font-family;
font-weight: $font-weight-medium;
Expand Down
1 change: 0 additions & 1 deletion app/javascript/dashboard/assets/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
@import '~bourbon/core/bourbon';

@include foundation-everything($flex: true);

@import 'woot';
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

.integration--image {
display: flex;
height: 10rem;
margin-right: $space-normal;
width: 10rem;

Expand Down
5 changes: 5 additions & 0 deletions app/javascript/dashboard/assets/scss/widgets/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
&.round {
border-radius: $space-larger;
}

&.compact {
padding-bottom: 0;
padding-top: 0;
}
}

.button--fixed-right-top {
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/dashboard/components/layout/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ export default {
accountLabels: 'labels/getLabelsOnSidebar',
}),
currentUserAvailableName() {
const { available_name: availableName } = this.currentUser;
return availableName;
return this.currentUser.name;
},
showChangeAccountOption() {
if (this.globalConfig.createNewAccountFromDashboard) {
Expand Down Expand Up @@ -275,6 +274,7 @@ export default {
id: label.id,
label: label.title,
color: label.color,
truncateLabel: true,
toState: frontendURL(
`accounts/${this.accountId}/label/${label.title}`
),
Expand Down
Loading

0 comments on commit 6e0075e

Please sign in to comment.