Skip to content

Commit

Permalink
Merge pull request #2061 from 3scale/3scale-2.9.0-CR1
Browse files Browse the repository at this point in the history
3scale-2.9.0-CR1
  • Loading branch information
guicassolato authored Jul 17, 2020
2 parents 69e5a47 + 632d382 commit c34e5b9
Show file tree
Hide file tree
Showing 157 changed files with 2,495 additions and 1,092 deletions.
27 changes: 23 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ jobs:
path: tmp/capybara
destination: capybara

portafly:
portafly_tests:
resource_class: small
docker:
- image: circleci/node:12
Expand All @@ -841,9 +841,25 @@ jobs:
command: |
cd portafly
yarn --version
yarn install
yarn install --frozen-lockfile
yarn test --maxWorkers=3
portafly_build:
resource_class: small
docker:
- image: circleci/node:12
parameters:
steps:
- checkout-with-submodules
- run:
name: Run PortaFly Build
root: .
command: |
cd portafly
yarn --version
yarn install --frozen-lockfile
CI=false yarn build
check_production_gemfile:
parameters:
executor:
Expand Down Expand Up @@ -1139,16 +1155,19 @@ workflows:
- assets_precompile
<<: *only-master-filter

portafly_build:
portafly:
jobs:
- manual_approval:
type: approval
- notify_start:
requires:
- manual_approval
- portafly:
- portafly_tests:
requires:
- manual_approval
- portafly_build:
requires:
- portafly_tests

production_gemfile-master:
jobs:
Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/provider/themes/wizard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,13 @@ $code-color-params: $color-brand-primary;

.code-example--slash:after {
content: '/';
color: $color-brand-secondary;
}

.feedback--inactive .code-example--slash:after {
color: $color-text-secondary;
}

.code-example--optional {

&:before {
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/admin/api/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,10 @@ def find_buyer_account
buyer_accounts.first_by_provider_key!(provider_key, error: ActiveRecord::RecordNotFound)
when current_account.master? && service_token = params[:buyer_service_token]
buyer_accounts.find_by_service_token!(service_token)
when email = params[:email].presence
buyer_users.find_by!(email: email).account
else
buyer_users.find_by!(email: params[:email]).account
raise ActiveRecord::RecordNotFound
end
end
end
11 changes: 11 additions & 0 deletions app/decorators/account_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class AccountDecorator < ApplicationDecorator
delegate :display_name, to: :admin_user, prefix: true

private

def admin_user
@admin_user ||= (super || User.new).decorate
end
end
15 changes: 15 additions & 0 deletions app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

class UserDecorator < ApplicationDecorator
def full_name
[first_name, last_name].select(&:present?).join(' ')
end

def display_name
full_name.presence || username
end

def informal_name
first_name.presence || last_name.presence || username
end
end
2 changes: 1 addition & 1 deletion app/helpers/buyers/accounts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def public_domain(account)
end

def account_title account
[ h(account.org_name), h(account.admin_user.try!(:display_name)) ].compact.join(" &mdash; ").html_safe
[ h(account.org_name), h(account.decorate.admin_user_display_name) ].compact.join(" &mdash; ").html_safe
end

def link_to_buyer_or_deleted( buyer, path_method = :admin_buyers_account_path)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/posts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def display_author_name(post)
name = if post.user.nil? || post.anonymous_user?
"Anonymous User"
else
post.user.display_name
post.user.decorate.display_name
end

h(truncate(name, :length => 30))
Expand Down
7 changes: 4 additions & 3 deletions app/indices/account_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
indexes sphinx_user_ids, as: :user_id

set_property field_weights: { name: 2 }

has :provider_account_id, type: :integer
has :tenant_id, type: :integer
set_property charset_table: "0..9, A..Z->a..z, a..z, U+23, U+25, U+27, U+2A..U+2C, U+2E, U+3A, U+3B, U+3F, U+5F, U+60, U+7B, U+7D"

has :provider_account_id, type: :bigint
has :tenant_id, type: :bigint
has :state, type: :string

scope { Account.not_master.includes(:users, :bought_cinstances) }
Expand Down
2 changes: 1 addition & 1 deletion app/indices/cms_page_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ThinkingSphinx::Index.define 'cms/page', with: :real_time do
indexes :title
has :tenant_id, type: :integer
has :tenant_id, type: :bigint

indexes :published
scope { CMS::Page.where(searchable: true) }
Expand Down
2 changes: 1 addition & 1 deletion app/indices/proxy_rules_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ThinkingSphinx::Index.define(:proxy_rule, with: :real_time) do
indexes :pattern

has owner_id, as: :owner_id, type: :integer
has owner_id, as: :owner_id, type: :bigint
has owner_type, as: :owner_type, type: :string

set_property min_infix_len: 1
Expand Down
4 changes: 2 additions & 2 deletions app/indices/topic_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
indexes :title
indexes sphinx_post_bodies, as: :post

has :tenant_id, type: :integer
has :tenant_id, type: :bigint

has :forum_id, type: :integer
has :forum_id, type: :bigint
has :sticky, type: :boolean
has :last_updated_at, type: :timestamp

Expand Down
7 changes: 6 additions & 1 deletion app/javascript/packs/OAS3Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ const addAutocompleteToParam = (param: Param, accountData: AccountData): Param =
: param
}

const getPathParameters = (path) => {
const hasParamsInGet = path.get && path.get.parameters
return hasParamsInGet ? path.get.parameters : path.parameters
}

const injectAutocompleteToResponseBody = (responseBody: ResponseBody, accountData: AccountData): ResponseBody => (
{
...responseBody,
paths: Object.keys(responseBody.paths).reduce(
(paths, key) => {
const pathParameters = responseBody.paths[key].get.parameters
const pathParameters = getPathParameters(responseBody.paths[key])
if (pathParameters) {
paths[key] = {
get: {
Expand Down
6 changes: 5 additions & 1 deletion app/javascript/src/Types/SwaggerTypes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export type Param = {
export type ResponseBody = {
paths: {
[string]: {
parameters: Array<Param>,
parameters?: Array<Param>,
get?: {
parameters?: Array<Param>,
[string]: string | {}
},
[string]: string | {}
}
},
Expand Down
7 changes: 4 additions & 3 deletions app/lib/csv/buyers_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def generate
end

def values_for_account(account)
user = account.admin_user
[
account.id,
account.state,
Expand All @@ -24,10 +25,10 @@ def values_for_account(account)
account.bought_account_plan.try!(:name),
account.created_at.to_s(:db),
account.bought_cinstances.count,
account.first_admin.try!(:display_name),
account.first_admin.try!(:email),
account.decorate.admin_user_display_name,
user&.email,
account.extra_fields.to_json,
account.first_admin.try!(:extra_fields).to_json
user&.extra_fields.to_json
]
end

Expand Down
2 changes: 1 addition & 1 deletion app/lib/three_scale/analytics/user_tracking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def basic_traits
firstName: @user.first_name,
lastName: @user.last_name,
lastSeen: Time.now,
name: @user.full_name,
name: @user.decorate.full_name,
username: @user.username,
phone: @account.telephone_number,
organization: @account.org_name,
Expand Down
14 changes: 5 additions & 9 deletions app/mailers/account_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def confirmed(account)

mail(:template_name => 'account_confirmed',
:from => from_address(account),
:to => admin_of(account).email,
:to => account.admin_user.email,
:subject => "Waiting list confirmation")

end
Expand All @@ -33,7 +33,7 @@ def approved(account)

mail(:template_name => 'account_approved',
:from => from_address(account),
:to => admin_of(account).email,
:to => account.admin_user.email,
:subject => "Registration now active!")

end
Expand All @@ -48,7 +48,7 @@ def rejected(account)

mail(:template_name => 'account_rejected',
:from => from_address(account),
:to => admin_of(account).email,
:to => account.admin_user.email,
:subject => "Registration Denied")
end

Expand Down Expand Up @@ -87,18 +87,14 @@ def support_entitlements_revoked(account, effective_since: Time.now.utc, invoice

def assigns(account)
{
:user => Liquid::Drops::User.new(admin_of(account)),
:user => Liquid::Drops::User.new(account.admin_user),
:domain => account.provider_account.external_domain,
:account => Liquid::Drops::Account.new(account),
:provider => Liquid::Drops::Provider.new(account.provider_account),
:support_email => admin_of(account.provider_account).email
:support_email => account.provider_account.admin_user.email
}
end

def admin_of(account)
account.admins.first
end

def provider(account)
account.provider_account
end
Expand Down
Loading

0 comments on commit c34e5b9

Please sign in to comment.