diff --git a/Gemfile b/Gemfile index 12be5f352..e57208be1 100644 --- a/Gemfile +++ b/Gemfile @@ -114,7 +114,6 @@ gem "biz", "~> 1.8" # gem "i18n-js" gem "i18n-js", "~> 4.0.0.alpha1" - gem "globalize", github: "globalize/globalize" # Reduces boot times through caching; required in config/boot.rb diff --git a/Rakefile b/Rakefile index 929076c49..78dab5dca 100644 --- a/Rakefile +++ b/Rakefile @@ -10,7 +10,7 @@ Rails.application.load_tasks namespace :locales do desc "compile i18n before compile" task :build do - system('yarn i18n:export') + system("yarn i18n:export") end end diff --git a/app/graphql/mutations/predicates/delete_predicate.rb b/app/graphql/mutations/predicates/delete_predicate.rb index d175f85c0..a44c1a5e8 100644 --- a/app/graphql/mutations/predicates/delete_predicate.rb +++ b/app/graphql/mutations/predicates/delete_predicate.rb @@ -13,9 +13,8 @@ class Predicates::DeletePredicate < Mutations::BaseMutation def resolve(app_key:, id:) current_user = context[:current_user] @app = current_user.apps.find_by(key: app_key) - if @app.segments.size == 1 - raise "server does not allow empty segments, we kept one" - end + raise "server does not allow empty segments, we kept one" if @app.segments.size == 1 + @segment = @app.segments.find(id) @segment.delete { segment: @segment, errors: @segment.errors } diff --git a/app/javascript/packages/store/src/graphql/client.js b/app/javascript/packages/store/src/graphql/client.js index b3897992f..382a47a87 100644 --- a/app/javascript/packages/store/src/graphql/client.js +++ b/app/javascript/packages/store/src/graphql/client.js @@ -10,7 +10,7 @@ import { refreshToken } from '../actions/auth' const graphql = (query, variables, callbacks) => { const { auth, current_user } = store.getState() - const locale = current_user.lang || I18n.defaultLocale + const locale = current_user.lang || (window.I18n && window.I18n.defaultLocale) || 'en' const config = { authorization: `Bearer ${auth.accessToken}`, diff --git a/app/javascript/src/locales/translations.json b/app/javascript/src/locales/translations.json index 215d06c82..7061d3dc3 100644 --- a/app/javascript/src/locales/translations.json +++ b/app/javascript/src/locales/translations.json @@ -12245,10 +12245,6 @@ } } }, - "nth": { - "ordinalized": "#", - "ordinals": "#" - }, "percentage": { "format": { "delimiter": "", diff --git a/app/javascript/src/pages/Dashboard.js b/app/javascript/src/pages/Dashboard.js index 30308ed54..33acde307 100644 --- a/app/javascript/src/pages/Dashboard.js +++ b/app/javascript/src/pages/Dashboard.js @@ -3,6 +3,7 @@ import { withRouter, Link } from 'react-router-dom' import { connect } from 'react-redux' import WebSetup from '@chaskiq/components/src/components/webSetup' import Badge from '@chaskiq/components/src/components/Badge' +import { useHistory } from "react-router-dom"; import Content from '@chaskiq/components/src/components/Content' import PageHeader from '@chaskiq/components/src/components/PageHeader' @@ -10,30 +11,10 @@ import PageHeader from '@chaskiq/components/src/components/PageHeader' import DashboardItem from './reports/ReportItem' import { - MoreIcon, - WebhooksIcon, - ApiIcon, - DashboardIcon, - PlatformIcon, ConversationChatIcon, - AssignmentIcon, CampaignsIcon, - MailingIcon, - AutoMessages, - BannersIcon, - ToursIcon, - BotIcon, - OutboundIcon, - NewconversationIcon, SettingsIcon, HelpCenterIcon, - ArticlesIcon, - CollectionsIcon, - ChatIcon, - BillingIcon, - IntegrationsIcon, - TeamIcon, - MessengerIcon, AppSettingsIcon, ChartsIcons, } from '@chaskiq/components/src/components/icons' @@ -42,6 +23,7 @@ import { setCurrentSection, setCurrentPage } from '@chaskiq/store/src/actions/navigation' +import { LinkButton } from '@chaskiq/components/src/components/RouterLink' export function Home() { return ( @@ -59,6 +41,8 @@ function Dashboard(props) { dispatch(setCurrentPage(null)) }, []) + const history = useHistory() + const actions = [ { @@ -70,6 +54,7 @@ function Dashboard(props) { render: ()=>(
+ {I18n.t('dashboard.status')}{' '} {app.activeMessenger && ( @@ -138,8 +123,24 @@ function Dashboard(props) { }} /> - - + +
+ + + window.open(`/tester/${app.key}`, '_blank').focus() } + target="blank"> + Chat tester + + + history.push("/playground") }> + Playground + +
+
diff --git a/app/javascript/src/pages/articles/collections/show.js b/app/javascript/src/pages/articles/collections/show.js index ddccfc075..fde1f4ab9 100644 --- a/app/javascript/src/pages/articles/collections/show.js +++ b/app/javascript/src/pages/articles/collections/show.js @@ -335,8 +335,11 @@ class CollectionDetail extends Component { if (collection) { this.getCollection() } + this.setState({ addArticlesDialog: false }) + }, + error: () => { + this.setState({ addArticlesDialog: false }) }, - error: () => {}, } ) } @@ -469,9 +472,9 @@ class AddArticleDialog extends Component { {this.state.articles.map((o) => ( - {o.state}

} + secondary={

{o.state}

} />
))} diff --git a/app/models/article.rb b/app/models/article.rb index e89378eed..d8d0d1c29 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -48,7 +48,10 @@ class Article < ApplicationRecord scope :without_section, -> { where(article_section_id: nil).order(position: :asc) } scope :with_section, -> { where.not(article_section_id: nil).order(position: :asc) } - scope :without_collection, -> { where(article_collection_id: nil).order(position: :asc) } + scope :without_collection, lambda { + where(article_collection_id: [nil, 0]) + .order(position: :asc) + } aasm column: :state do state :draft, initial: true diff --git a/app/models/article_setting.rb b/app/models/article_setting.rb index 470a47a14..cbd5082ca 100644 --- a/app/models/article_setting.rb +++ b/app/models/article_setting.rb @@ -27,8 +27,7 @@ class ArticleSetting < ApplicationRecord validates :subdomain, exclusion: { in: %w[www], - message: "%{value} is reserved." - }, + message: "%{value} is reserved." }, presence: true, uniqueness: true, allow_blank: true diff --git a/app/services/message_apis/csat/api.rb b/app/services/message_apis/csat/api.rb index 44d6bf82d..540227247 100644 --- a/app/services/message_apis/csat/api.rb +++ b/app/services/message_apis/csat/api.rb @@ -37,7 +37,7 @@ def report(path, integration, options) options = integration.app.conversation_events.custom_counts("plugins.csat", "val") data_options = MessageApis::Csat::Presenter.csat_buttons[:options] - total = options.map{|o| o.freq.to_f }.inject(:+) + total = options.map { |o| o.freq.to_f }.inject(:+) { id: "csat-plugin", diff --git a/app/services/message_apis/csat/presenter.rb b/app/services/message_apis/csat/presenter.rb index cf785abc7..8e7f4d783 100644 --- a/app/services/message_apis/csat/presenter.rb +++ b/app/services/message_apis/csat/presenter.rb @@ -72,13 +72,13 @@ def self.configure_hook(kind:, ctx:) definitions = [ - #{ + # { # type: "input", # id: "label", # label: "CSAT label", # placeholder: "How would you rate your experience with our service?", # save_state: "unsaved" - #}, + # }, csat_buttons, { type: "button", diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4c3482528..75d3b85c7 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -30,7 +30,7 @@ - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <% #= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> diff --git a/config/i18n.yml b/config/i18n.yml index e3f32f0fd..460290f3c 100644 --- a/config/i18n.yml +++ b/config/i18n.yml @@ -32,5 +32,6 @@ translations: - "*" - "!*.ransack" - "!*.faker" + - "!*.number.nth" - file: "app/javascript/src/locales/messenger-translations.json" patterns: ["*.messenger.*"] diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index b392ce3c2..3fe6dfddf 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -3,5 +3,7 @@ # skips faker & ransack # I18n.load_path -= I18n.load_path.grep(/faker|ransack/) -require "i18n-js/listen" -I18nJS.listen \ No newline at end of file +if Rails.env.development? + require "i18n-js/listen" + I18nJS.listen +end \ No newline at end of file