diff --git a/.github/workflows/plugin-linting.yml b/.github/workflows/plugin-linting.yml index 17864e9..affe103 100644 --- a/.github/workflows/plugin-linting.yml +++ b/.github/workflows/plugin-linting.yml @@ -20,13 +20,10 @@ jobs: node-version: 12 - name: Set up ruby - uses: actions/setup-ruby@v1 + uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 - - name: Setup bundler - run: gem install bundler -v 2.1.4 --no-doc - - name: Setup gems run: bundle install --jobs 4 @@ -46,5 +43,8 @@ jobs: yarn prettier --list-different "test/**/*.{js,es6}" ; \ fi + - name: Ember template lint + run: yarn ember-template-lint assets/javascripts + - name: Rubocop run: bundle exec rubocop . diff --git a/.github/workflows/plugin-tests.yml b/.github/workflows/plugin-tests.yml index bee02fb..ad05806 100644 --- a/.github/workflows/plugin-tests.yml +++ b/.github/workflows/plugin-tests.yml @@ -10,7 +10,7 @@ on: jobs: build: name: ${{ matrix.build_type }} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest timeout-minutes: 60 env: @@ -26,8 +26,7 @@ jobs: matrix: build_type: ["backend", "frontend"] - os: [ubuntu-latest] - ruby: ["2.6"] + ruby: ["2.7"] postgres: ["12"] redis: ["4.x"] @@ -47,13 +46,13 @@ jobs: --health-retries 5 steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 with: repository: discourse/discourse fetch-depth: 1 - name: Install plugin - uses: actions/checkout@master + uses: actions/checkout@v2 with: path: plugins/${{ github.event.repository.name }} fetch-depth: 1 @@ -94,27 +93,14 @@ jobs: redis-version: ${{ matrix.redis }} - name: Setup ruby - uses: actions/setup-ruby@v1 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} + bundler-cache: true - - name: Setup bundler - run: | - gem install bundler -v 2.1.4 --no-doc - bundle config deployment 'true' - bundle config without 'development' - - - name: Bundler cache - uses: actions/cache@v2 - id: bundler-cache - with: - path: vendor/bundle - key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gem- - - - name: Setup gems - run: bundle install --jobs 4 + - name: Lint English locale + if: matrix.build_type == 'backend' + run: bundle exec ruby script/i18n_lint.rb "plugins/${{ github.event.repository.name }}/locales/{client,server}.en.yml" - name: Get yarn cache directory id: yarn-cache-dir diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-channel-error.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-channel-error.hbs index 3c0cea7..dec200d 100644 --- a/assets/javascripts/admin/templates/modal/admin-plugins-chat-channel-error.hbs +++ b/assets/javascripts/admin/templates/modal/admin-plugins-chat-channel-error.hbs @@ -1,4 +1,4 @@ {{#d-modal-body id="chat_integration_error_modal"}} -

{{i18n model.error_key}}

-
{{model.error_info}}
-{{/d-modal-body}} \ No newline at end of file +

{{i18n model.error_key}}

+
{{model.error_info}}
+{{/d-modal-body}} diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-channel.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-channel.hbs index 1b3a3df..b769f62 100644 --- a/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-channel.hbs +++ b/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-channel.hbs @@ -2,54 +2,58 @@
- - - - - - - - - - - {{#each model.provider.channel_parameters as |param|}} + - + + - + - {{/each}} -
- {{i18n (concat 'chat_integration.provider.' model.channel.provider '.title')}} -
- {{text-field - name=(concat 'param-' param.key) - value=(mut (get model.channel.data param.key)) - }} - -   - {{#if (get model.channel.data param.key)}} - {{input-tip validation=(get paramValidation param.key)}} - {{/if}} + {{i18n (concat "chat_integration.provider." model.channel.provider ".title")}}
+ {{#each model.provider.channel_parameters as |param|}} + + + + {{text-field + name=(concat "param-" param.key) + value=(mut (get model.channel.data param.key)) + }} + +   + {{#if (get model.channel.data param.key)}} + {{input-tip validation=(get paramValidation param.key)}} + {{/if}} + + + + + + + + {{/each}} + +
{{/d-modal-body}} diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-rule.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-rule.hbs index d0581de..2fe03b5 100644 --- a/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-rule.hbs +++ b/assets/javascripts/admin/templates/modal/admin-plugins-chat-edit-rule.hbs @@ -2,110 +2,119 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{#if showCategory}} + - + + - + - {{else}} + - + + - + - {{/if}} - {{#if siteSettings.tagging_enabled}} - + + - + - {{/if}} + + + + + + + + + + + {{#if showCategory}} + + + + + + + + + + {{else}} + + + + + + + + + + {{/if}} + + {{#if siteSettings.tagging_enabled}} + + + + + + + + + + {{/if}} +
- {{i18n (concat 'chat_integration.provider.' model.channel.provider '.title')}} -
- {{channel-data provider=model.provider channel=model.channel}} -
- {{combo-box name="type" content=model.rule.available_types value=model.rule.type}} -
- {{combo-box name="filter" content=model.rule.available_filters value=model.rule.filter}} -
- {{category-chooser - name="category" - value=model.rule.category_id - rootNoneLabel="chat_integration.all_categories" - rootNone=true - overrideWidths=false}} + {{i18n (concat "chat_integration.provider." model.channel.provider ".title")}}
- {{combo-box content=model.groups valueAttribute="id" value=model.rule.group_id none="chat_integration.choose_group"}} + {{channel-data provider=model.provider channel=model.channel}}
- {{tag-chooser placeholderKey="chat_integration.all_tags" name="tags" tags=model.rule.tags everyTag=true }} + {{combo-box name="type" content=model.rule.available_types value=model.rule.type}}
+ {{combo-box name="filter" content=model.rule.available_filters value=model.rule.filter}} +
+ {{category-chooser + name="category" + value=model.rule.category_id + rootNoneLabel="chat_integration.all_categories" + rootNone=true + overrideWidths=false + }} +
+ {{combo-box content=model.groups valueAttribute="id" value=model.rule.group_id none="chat_integration.choose_group"}} +
+ {{tag-chooser placeholderKey="chat_integration.all_tags" name="tags" tags=model.rule.tags everyTag=true }} +
-
{{/d-modal-body}} diff --git a/assets/javascripts/admin/templates/modal/admin-plugins-chat-test.hbs b/assets/javascripts/admin/templates/modal/admin-plugins-chat-test.hbs index 16da474..e2e95d1 100644 --- a/assets/javascripts/admin/templates/modal/admin-plugins-chat-test.hbs +++ b/assets/javascripts/admin/templates/modal/admin-plugins-chat-test.hbs @@ -2,12 +2,14 @@
- - - - + + + + + +
- {{choose-topic selectedTopicId=model.topic_id}} -
+ {{choose-topic selectedTopicId=model.topic_id}} +
@@ -17,16 +19,18 @@ {{#conditional-loading-spinner condition=loading}} {{d-button id="send-test" - class='btn-primary btn-large' + class="btn-primary btn-large" action=(action "send") title="chat_integration.test_modal.send" label="chat_integration.test_modal.send" - disabled=sendDisabled}} + disabled=sendDisabled + }} {{d-button class="btn-large" action=(route-action "closeModal") title="chat_integration.test_modal.close" - label="chat_integration.test_modal.close"}} + label="chat_integration.test_modal.close" + }} {{/conditional-loading-spinner}} diff --git a/assets/javascripts/discourse/templates/admin/plugins-chat-provider.hbs b/assets/javascripts/discourse/templates/admin/plugins-chat-provider.hbs index ad27031..2f18f7c 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-chat-provider.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-chat-provider.hbs @@ -1,6 +1,6 @@ {{#if anyErrors}}
- {{d-icon 'exclamation-triangle'}} + {{d-icon "exclamation-triangle"}} {{i18n "chat_integration.channels_with_errors"}}
{{/if}} @@ -14,7 +14,8 @@ test=(action "testChannel") createRule=(action "createRule") editRuleWithChannel=(action "editRuleWithChannel") - showError=(action "showError")}} + showError=(action "showError") + }} {{/each}} diff --git a/assets/javascripts/discourse/templates/admin/plugins-chat.hbs b/assets/javascripts/discourse/templates/admin/plugins-chat.hbs index c3aa326..bc578dc 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-chat.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-chat.hbs @@ -4,9 +4,10 @@ @@ -16,7 +17,8 @@ action=(route-action "showSettings") icon="cog" title="chat_integration.settings" - label="chat_integration.settings"}} + label="chat_integration.settings" + }} diff --git a/assets/javascripts/discourse/templates/components/channel-data.hbs b/assets/javascripts/discourse/templates/components/channel-data.hbs index 6f034a3..b88d089 100644 --- a/assets/javascripts/discourse/templates/components/channel-data.hbs +++ b/assets/javascripts/discourse/templates/components/channel-data.hbs @@ -1,9 +1,9 @@ {{#each provider.channel_parameters as |param|}} {{#unless param.hidden}} - - {{i18n (concat 'chat_integration.provider.' channel.provider '.param.' param.key '.title')}}: + + {{i18n (concat "chat_integration.provider." channel.provider ".param." param.key ".title")}}: - {{get channel.data param.key}} -
+ {{get channel.data param.key}} +
{{/unless}} {{/each}} diff --git a/assets/javascripts/discourse/templates/components/channel-details.hbs b/assets/javascripts/discourse/templates/components/channel-details.hbs index 725fc16..ccfda7b 100644 --- a/assets/javascripts/discourse/templates/components/channel-details.hbs +++ b/assets/javascripts/discourse/templates/components/channel-details.hbs @@ -1,11 +1,12 @@ -
-
+
+
{{d-button action=editChannel actionParam=channel icon="pencil-alt" title="chat_integration.edit_channel" - label="chat_integration.edit_channel"}} + label="chat_integration.edit_channel" + }} {{d-button action=test @@ -13,56 +14,64 @@ icon="rocket" title="chat_integration.test_channel" label="chat_integration.test_channel" - class="btn-chat-test"}} + class="btn-chat-test" + }} {{d-button - class='cancel' + class="cancel" action=(action "deleteChannel") actionParam=channel icon="trash-alt" title="chat_integration.delete_channel" - label="chat_integration.delete_channel"}} + label="chat_integration.delete_channel" + }}
- + {{#if channel.error_key}} {{d-button action=showError actionParam=channel class="delete btn-danger" - icon="exclamation-triangle"}} + icon="exclamation-triangle" + }} {{/if}} {{channel-data provider=provider channel=channel}}
-
+
- - - + + + + - {{#if siteSettings.tagging_enabled}} - - {{/if}} + {{#if siteSettings.tagging_enabled}} + + {{/if}} - - + + + - {{#each channel.rules as |rule|}} - {{rule-row rule=rule edit=(action "editRule") refresh=refresh}} - {{/each}} + + {{#each channel.rules as |rule|}} + {{rule-row rule=rule edit=(action "editRule") refresh=refresh}} + {{/each}} +
{{i18n "chat_integration.rule_table.filter"}}{{i18n "chat_integration.rule_table.category"}}
{{i18n "chat_integration.rule_table.filter"}}{{i18n "chat_integration.rule_table.category"}}{{i18n "chat_integration.rule_table.tags"}}{{i18n "chat_integration.rule_table.tags"}}
-