From 52672b9eabccb1184d85dc7f08062d5a7c18cb73 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 4 Sep 2020 13:42:47 +0200 Subject: [PATCH] DEV: apply new coding standards (#10592) --- app/assets/javascripts/activate-account.js | 17 +- .../javascripts/admin/adapters/api-key.js | 2 +- .../admin/adapters/build-plugin.js | 2 +- .../admin/adapters/customization-base.js | 2 +- .../javascripts/admin/adapters/email-style.js | 2 +- .../javascripts/admin/adapters/embedding.js | 2 +- .../admin/adapters/staff-action-log.js | 2 +- .../javascripts/admin/adapters/tag-group.js | 2 +- .../javascripts/admin/adapters/theme.js | 10 +- .../admin/adapters/web-hook-event.js | 2 +- .../javascripts/admin/adapters/web-hook.js | 2 +- .../admin/components/ace-editor.js | 12 +- .../admin/components/admin-backups-logs.js | 6 +- .../admin/components/admin-editable-field.js | 4 +- .../admin/components/admin-form-row.js | 2 +- .../admin/components/admin-graph.js | 30 +-- .../javascripts/admin/components/admin-nav.js | 2 +- .../admin/components/admin-report-chart.js | 62 ++--- .../admin/components/admin-report-counters.js | 2 +- .../admin/components/admin-report-counts.js | 2 +- .../components/admin-report-inline-table.js | 2 +- .../components/admin-report-per-day-counts.js | 2 +- .../components/admin-report-stacked-chart.js | 50 ++-- .../components/admin-report-storage-stats.js | 2 +- .../components/admin-report-table-cell.js | 2 +- .../components/admin-report-table-header.js | 2 +- .../components/admin-report-table-row.js | 2 +- .../admin/components/admin-report-table.js | 14 +- .../admin-report-trust-level-counts.js | 2 +- .../admin/components/admin-report.js | 54 ++-- .../admin/components/admin-theme-editor.js | 14 +- .../admin/components/admin-user-field-item.js | 6 +- .../admin/components/admin-watched-word.js | 6 +- .../admin-web-hook-event-chooser.js | 8 +- .../admin/components/admin-web-hook-event.js | 14 +- .../admin/components/admin-web-hook-status.js | 4 +- .../admin/components/admin-wrapper.js | 2 +- .../admin/components/cancel-link.js | 2 +- .../admin/components/color-input.js | 8 +- .../admin/components/email-styles-editor.js | 10 +- .../admin/components/embeddable-host.js | 6 +- .../admin/components/embedding-setting.js | 4 +- .../admin/components/flag-user-lists.js | 2 +- .../admin/components/highlighted-code.js | 2 +- .../admin/components/inline-edit-checkbox.js | 4 +- .../admin/components/install-theme-item.js | 2 +- .../javascripts/admin/components/ip-lookup.js | 28 +- .../components/moderation-history-item.js | 2 +- .../admin/components/penalty-post-action.js | 6 +- .../admin/components/permalink-form.js | 18 +- .../admin/components/report-filters/bool.js | 2 +- .../components/report-filters/category.js | 2 +- .../admin/components/report-filters/filter.js | 2 +- .../admin/components/report-filters/group.js | 4 +- .../admin/components/resumable-upload.js | 10 +- .../components/screened-ip-address-form.js | 24 +- .../admin/components/secret-value-list.js | 10 +- .../admin/components/silence-details.js | 2 +- .../admin/components/simple-list.js | 2 +- .../admin/components/site-setting.js | 4 +- .../site-settings-image-uploader.js | 2 +- .../admin/components/site-settings/bool.js | 4 +- .../components/site-settings/category-list.js | 6 +- .../admin/components/site-settings/color.js | 9 +- .../components/site-settings/compact-list.js | 19 +- .../components/site-settings/group-list.js | 10 +- .../components/site-settings/simple-list.js | 2 +- .../components/site-settings/tag-list.js | 4 +- .../site-settings/uploaded-image-list.js | 8 +- .../admin/components/site-text-summary.js | 4 +- .../admin/components/staff-actions.js | 8 +- .../admin/components/suspension-details.js | 2 +- .../admin/components/tags-uploader.js | 2 +- .../admin/components/theme-setting-editor.js | 6 +- .../theme-setting-relatives-selector.js | 9 +- .../admin/components/theme-translation.js | 2 +- .../admin/components/themes-list-item.js | 22 +- .../admin/components/themes-list.js | 12 +- .../admin/components/value-list.js | 8 +- .../admin/components/watched-word-form.js | 26 +- .../admin/components/watched-word-uploader.js | 2 +- .../admin/controllers/admin-api-keys-index.js | 4 +- .../admin/controllers/admin-api-keys-new.js | 12 +- .../admin/controllers/admin-api-keys-show.js | 8 +- .../admin/controllers/admin-backups-index.js | 8 +- .../admin/controllers/admin-backups-logs.js | 2 +- .../admin/controllers/admin-backups.js | 2 +- .../admin/controllers/admin-badges-award.js | 6 +- .../admin/controllers/admin-badges-show.js | 16 +- .../admin/controllers/admin-badges.js | 2 +- .../admin-customize-colors-show.js | 16 +- .../controllers/admin-customize-colors.js | 10 +- .../admin-customize-email-style-edit.js | 8 +- .../admin-customize-email-templates-edit.js | 6 +- .../admin-customize-email-templates.js | 2 +- .../controllers/admin-customize-robots-txt.js | 14 +- .../admin-customize-themes-edit.js | 14 +- .../admin-customize-themes-show.js | 48 ++-- .../controllers/admin-customize-themes.js | 8 +- .../controllers/admin-dashboard-general.js | 54 ++-- .../controllers/admin-dashboard-moderation.js | 12 +- .../controllers/admin-dashboard-reports.js | 8 +- .../admin/controllers/admin-dashboard.js | 35 ++- .../controllers/admin-email-advanced-test.js | 10 +- .../admin/controllers/admin-email-bounced.js | 4 +- .../admin/controllers/admin-email-index.js | 18 +- .../admin/controllers/admin-email-logs.js | 6 +- .../controllers/admin-email-preview-digest.js | 8 +- .../admin/controllers/admin-email-received.js | 6 +- .../admin/controllers/admin-email-rejected.js | 6 +- .../admin/controllers/admin-email-sent.js | 4 +- .../admin/controllers/admin-email-skipped.js | 4 +- .../admin/controllers/admin-embedding.js | 4 +- .../admin/controllers/admin-emojis.js | 14 +- .../controllers/admin-logs-screened-emails.js | 8 +- .../admin-logs-screened-ip-addresses.js | 28 +- .../controllers/admin-logs-screened-urls.js | 6 +- .../admin-logs-staff-action-logs.js | 20 +- .../admin/controllers/admin-permalinks.js | 16 +- .../admin/controllers/admin-plugins.js | 8 +- .../admin/controllers/admin-reports-show.js | 2 +- .../controllers/admin-search-logs-index.js | 8 +- .../controllers/admin-search-logs-term.js | 10 +- .../admin-site-settings-category.js | 2 +- .../admin/controllers/admin-site-settings.js | 21 +- .../admin/controllers/admin-site-text-edit.js | 8 +- .../controllers/admin-site-text-index.js | 6 +- .../admin/controllers/admin-user-badges.js | 20 +- .../admin/controllers/admin-user-fields.js | 10 +- .../admin/controllers/admin-user-index.js | 40 +-- .../controllers/admin-users-list-show.js | 10 +- .../controllers/admin-watched-words-action.js | 18 +- .../admin/controllers/admin-watched-words.js | 12 +- .../admin-web-hooks-show-events.js | 16 +- .../admin/controllers/admin-web-hooks-show.js | 14 +- .../admin/controllers/admin-web-hooks.js | 6 +- .../javascripts/admin/controllers/admin.js | 4 +- .../controllers/modals/admin-add-upload.js | 16 +- .../controllers/modals/admin-badge-preview.js | 6 +- .../modals/admin-color-scheme-select-base.js | 4 +- .../modals/admin-edit-badge-groupings.js | 18 +- .../modals/admin-incoming-email.js | 8 +- .../controllers/modals/admin-install-theme.js | 18 +- .../modals/admin-merge-users-confirmation.js | 4 +- .../modals/admin-merge-users-prompt.js | 2 +- .../admin/controllers/modals/admin-reseed.js | 14 +- .../controllers/modals/admin-silence-user.js | 6 +- .../controllers/modals/admin-start-backup.js | 4 +- .../controllers/modals/admin-suspend-user.js | 6 +- .../controllers/modals/admin-theme-change.js | 4 +- .../modals/admin-uploaded-image-list.js | 4 +- .../modals/admin-watched-word-test.js | 2 +- .../modals/site-setting-default-categories.js | 4 +- .../javascripts/admin/helpers/check-icon.js | 2 +- .../admin/helpers/disposition-icon.js | 2 +- .../javascripts/admin/helpers/human-size.js | 2 +- .../admin/helpers/post-action-title.js | 2 +- .../admin/helpers/preserve-newlines.js | 4 +- .../javascripts/admin/helpers/value-at-tl.js | 4 +- .../admin/mixins/penalty-controller.js | 8 +- .../admin/mixins/period-computation.js | 32 +-- .../admin/mixins/setting-component.js | 47 ++-- .../admin/mixins/setting-object.js | 8 +- .../admin/models/admin-dashboard.js | 14 +- .../javascripts/admin/models/admin-user.js | 160 ++++++------ .../javascripts/admin/models/api-key.js | 12 +- .../javascripts/admin/models/backup-status.js | 2 +- app/assets/javascripts/admin/models/backup.js | 26 +- .../admin/models/color-scheme-color.js | 4 +- .../javascripts/admin/models/color-scheme.js | 34 +-- .../javascripts/admin/models/email-log.js | 6 +- .../javascripts/admin/models/email-preview.js | 13 +- .../admin/models/email-settings.js | 6 +- .../javascripts/admin/models/email-style.js | 2 +- .../admin/models/email-template.js | 6 +- .../javascripts/admin/models/flag-type.js | 2 +- .../admin/models/incoming-email.js | 8 +- .../javascripts/admin/models/permalink.js | 24 +- app/assets/javascripts/admin/models/report.js | 72 +++-- .../admin/models/screened-email.js | 14 +- .../admin/models/screened-ip-address.js | 16 +- .../javascripts/admin/models/screened-url.js | 12 +- .../javascripts/admin/models/site-setting.js | 10 +- .../javascripts/admin/models/site-text.js | 6 +- .../admin/models/staff-action-log.js | 26 +- app/assets/javascripts/admin/models/theme.js | 54 ++-- .../admin/models/tl3-requirements.js | 4 +- .../javascripts/admin/models/user-field.js | 6 +- .../javascripts/admin/models/version-check.js | 8 +- .../javascripts/admin/models/watched-word.js | 18 +- .../javascripts/admin/models/web-hook.js | 12 +- .../admin/routes/admin-api-index.js | 2 +- .../admin/routes/admin-api-keys-index.js | 2 +- .../admin/routes/admin-api-keys-new.js | 6 +- .../admin/routes/admin-api-keys-show.js | 2 +- .../admin/routes/admin-api-keys.js | 4 +- .../admin/routes/admin-backups-index.js | 6 +- .../admin/routes/admin-backups-logs.js | 8 +- .../javascripts/admin/routes/admin-backups.js | 40 +-- .../admin/routes/admin-badges-award.js | 2 +- .../admin/routes/admin-badges-index.js | 10 +- .../admin/routes/admin-badges-show.js | 16 +- .../javascripts/admin/routes/admin-badges.js | 12 +- .../routes/admin-customize-colors-show.js | 2 +- .../admin/routes/admin-customize-colors.js | 2 +- .../admin-customize-email-style-edit.js | 10 +- .../admin-customize-email-style-index.js | 2 +- .../routes/admin-customize-email-style.js | 2 +- .../admin-customize-email-templates-edit.js | 2 +- .../routes/admin-customize-email-templates.js | 2 +- .../admin/routes/admin-customize-index.js | 2 +- .../routes/admin-customize-robots-txt.js | 2 +- .../routes/admin-customize-themes-edit.js | 14 +- .../routes/admin-customize-themes-index.js | 12 +- .../routes/admin-customize-themes-show.js | 14 +- .../admin/routes/admin-customize-themes.js | 4 +- .../admin/routes/admin-dashboard-general.js | 2 +- .../admin/routes/admin-dashboard-reports.js | 2 +- .../admin/routes/admin-dashboard.js | 2 +- .../admin/routes/admin-email-bounced.js | 4 +- .../admin/routes/admin-email-incomings.js | 2 +- .../admin/routes/admin-email-index.js | 2 +- .../admin/routes/admin-email-logs.js | 4 +- .../routes/admin-email-preview-digest.js | 4 +- .../admin/routes/admin-email-rejected.js | 4 +- .../admin/routes/admin-embedding.js | 2 +- .../javascripts/admin/routes/admin-emojis.js | 8 +- .../admin/routes/admin-flags-posts-active.js | 2 +- .../admin/routes/admin-flags-posts-old.js | 2 +- .../admin/routes/admin-flags-topics-index.js | 2 +- .../admin/routes/admin-logs-index.js | 4 +- .../routes/admin-logs-screened-emails.js | 6 +- .../admin-logs-screened-ip-addresses.js | 4 +- .../admin/routes/admin-logs-screened-urls.js | 6 +- .../routes/admin-logs-staff-action-logs.js | 10 +- .../admin/routes/admin-permalinks.js | 2 +- .../javascripts/admin/routes/admin-plugins.js | 4 +- .../admin/routes/admin-reports-index.js | 2 +- .../admin/routes/admin-reports-show.js | 13 +- .../admin/routes/admin-route-map.js | 64 ++--- .../admin/routes/admin-search-logs-index.js | 12 +- .../admin/routes/admin-search-logs-term.js | 12 +- .../routes/admin-site-settings-category.js | 4 +- .../admin/routes/admin-site-settings-index.js | 2 +- .../admin/routes/admin-site-settings.js | 8 +- .../admin/routes/admin-site-text-edit.js | 2 +- .../admin/routes/admin-site-text-index.js | 6 +- .../admin/routes/admin-user-badges.js | 4 +- .../admin/routes/admin-user-fields.js | 6 +- .../admin/routes/admin-user-index.js | 6 +- .../routes/admin-user-tl3-requirements.js | 2 +- .../javascripts/admin/routes/admin-user.js | 6 +- .../admin/routes/admin-users-index.js | 4 +- .../admin/routes/admin-users-list-index.js | 4 +- .../admin/routes/admin-users-list-show.js | 8 +- .../admin/routes/admin-users-list.js | 6 +- .../routes/admin-watched-words-action.js | 4 +- .../admin/routes/admin-watched-words-index.js | 2 +- .../admin/routes/admin-watched-words.js | 4 +- .../routes/admin-web-hooks-show-events.js | 2 +- .../admin/routes/admin-web-hooks-show.js | 2 +- .../admin/routes/admin-web-hooks.js | 4 +- app/assets/javascripts/admin/routes/admin.js | 4 +- .../javascripts/admin/services/admin-tools.js | 31 +-- app/assets/javascripts/app-boot.js | 4 +- app/assets/javascripts/auto-redirect.js | 4 +- .../confirm-new-email/bootstrap.js | 2 +- .../confirm-new-email/confirm-new-email.js | 10 +- .../discourse-common/addon/helpers/d-icon.js | 2 +- .../discourse-common/addon/helpers/fa-icon.js | 2 +- .../discourse-common/addon/helpers/get-url.js | 2 +- .../addon/helpers/html-safe.js | 2 +- .../addon/helpers/popular-themes.js | 28 +- .../addon/lib/attribute-hook.js | 4 +- .../discourse-common/addon/lib/get-owner.js | 4 +- .../discourse-common/addon/lib/helpers.js | 10 +- .../addon/lib/icon-library.js | 12 +- .../discourse-common/addon/lib/object.js | 4 +- .../addon/lib/raw-handlebars-helpers.js | 12 +- .../addon/lib/raw-handlebars.js | 24 +- .../addon/lib/raw-templates.js | 2 +- .../discourse-common/addon/resolver.js | 6 +- .../addon/utils/decorator-alias.js | 8 +- .../addon/utils/decorators.js | 12 +- .../addon/utils/handle-descriptor.js | 12 +- .../addon/utils/macro-alias.js | 8 +- .../discourse-common/config/ember-try.js | 60 ++--- .../discourse-common/config/environment.js | 2 +- .../discourse-common/ember-cli-build.js | 2 +- .../javascripts/discourse-common/index.js | 8 +- app/assets/javascripts/discourse-loader.js | 68 ++--- app/assets/javascripts/discourse-shims.js | 14 +- .../discourse/app/adapters/email-template.js | 2 +- .../discourse/app/adapters/group.js | 2 +- .../app/adapters/post-reply-history.js | 4 +- .../discourse/app/adapters/post-reply.js | 4 +- .../discourse/app/adapters/post.js | 6 +- .../discourse/app/adapters/published-page.js | 2 +- .../discourse/app/adapters/rest.js | 14 +- .../app/adapters/reviewable-explanation.js | 2 +- .../app/adapters/reviewable-settings.js | 2 +- .../app/adapters/reviewable-topic.js | 2 +- .../discourse/app/adapters/reviewable.js | 2 +- .../discourse/app/adapters/tag-info.js | 2 +- .../app/adapters/tag-notification.js | 2 +- .../discourse/app/adapters/topic-list.js | 8 +- .../discourse/app/adapters/topic.js | 2 +- app/assets/javascripts/discourse/app/app.js | 10 +- .../app/components/about-page-users.js | 10 +- .../app/components/activation-controls.js | 2 +- .../components/add-category-tag-classes.js | 4 +- .../app/components/auth-token-dropdown.js | 14 +- .../discourse/app/components/avatar-flair.js | 4 +- .../app/components/avatar-uploader.js | 4 +- .../discourse/app/components/backup-codes.js | 4 +- .../app/components/backup-uploader.js | 10 +- .../discourse/app/components/badge-button.js | 4 +- .../discourse/app/components/badge-card.js | 2 +- .../app/components/badge-selector.js | 10 +- .../discourse/app/components/badge-title.js | 8 +- .../app/components/basic-topic-list.js | 14 +- .../components/bookmark-actions-dropdown.js | 10 +- .../discourse/app/components/bookmark-list.js | 12 +- .../discourse/app/components/bread-crumbs.js | 14 +- .../app/components/bulk-select-button.js | 8 +- .../categories-and-latest-topics.js | 2 +- .../components/categories-and-top-topics.js | 2 +- .../app/components/categories-boxes-topic.js | 2 +- .../categories-boxes-with-topics.js | 6 +- .../app/components/categories-boxes.js | 8 +- .../app/components/categories-only.js | 4 +- .../app/components/category-list-item.js | 4 +- .../components/category-read-only-banner.js | 2 +- .../app/components/category-title-before.js | 2 +- .../app/components/category-title-link.js | 2 +- .../app/components/category-unread.js | 2 +- .../discourse/app/components/cdn-img.js | 2 +- .../app/components/choose-message.js | 14 +- .../discourse/app/components/choose-topic.js | 16 +- .../app/components/color-picker-choice.js | 2 +- .../discourse/app/components/color-picker.js | 4 +- .../app/components/composer-action-title.js | 6 +- .../discourse/app/components/composer-body.js | 12 +- .../app/components/composer-editor.js | 91 +++---- .../app/components/composer-message.js | 4 +- .../app/components/composer-messages.js | 22 +- .../app/components/composer-save-button.js | 2 +- .../app/components/composer-title.js | 10 +- .../app/components/composer-toggles.js | 2 +- .../app/components/composer-user-selector.js | 10 +- .../components/conditional-loading-section.js | 2 +- .../components/conditional-loading-spinner.js | 4 +- .../discourse/app/components/cook-text.js | 4 +- .../discourse/app/components/count-i18n.js | 2 +- .../app/components/create-account.js | 6 +- .../app/components/create-topic-button.js | 2 +- .../app/components/create-topics-notice.js | 8 +- .../discourse/app/components/csv-uploader.js | 6 +- .../discourse/app/components/custom-html.js | 2 +- .../discourse/app/components/d-button.js | 10 +- .../discourse/app/components/d-document.js | 4 +- .../discourse/app/components/d-editor.js | 105 ++++---- .../discourse/app/components/d-modal-body.js | 6 +- .../app/components/d-modal-cancel.js | 2 +- .../discourse/app/components/d-modal.js | 6 +- .../discourse/app/components/d-navigation.js | 8 +- .../discourse/app/components/d-section.js | 2 +- .../discourse/app/components/d-textarea.js | 2 +- .../discourse/app/components/date-input.js | 14 +- .../app/components/date-picker-future.js | 10 +- .../app/components/date-picker-past.js | 4 +- .../discourse/app/components/date-picker.js | 6 +- .../app/components/date-time-input-range.js | 4 +- .../app/components/date-time-input.js | 10 +- .../components/desktop-notification-config.js | 12 +- .../app/components/directory-item.js | 2 +- .../discourse/app/components/disabled-icon.js | 2 +- .../app/components/discourse-banner.js | 6 +- .../app/components/discourse-linked-text.js | 2 +- .../app/components/discourse-tag-bound.js | 2 +- .../app/components/discourse-topic.js | 6 +- .../app/components/discovery-categories.js | 2 +- .../app/components/discovery-topics-list.js | 6 +- .../app/components/edit-category-general.js | 12 +- .../app/components/edit-category-images.js | 8 +- .../app/components/edit-category-panel.js | 4 +- .../app/components/edit-category-security.js | 14 +- .../app/components/edit-category-settings.js | 26 +- .../app/components/edit-category-tab.js | 8 +- .../app/components/edit-category-tags.js | 2 +- .../edit-category-topic-template.js | 4 +- .../app/components/edit-topic-timer-form.js | 4 +- .../app/components/email-dropdown.js | 12 +- .../discourse/app/components/emoji-picker.js | 36 +-- .../app/components/emoji-uploader.js | 4 +- .../discourse/app/components/expand-post.js | 6 +- .../app/components/expanding-text-area.js | 2 +- .../app/components/featured-topic.js | 4 +- .../app/components/flag-action-type.js | 6 +- .../app/components/flag-selection.js | 2 +- .../discourse/app/components/flat-button.js | 2 +- .../app/components/footer-message.js | 2 +- .../discourse/app/components/footer-nav.js | 4 +- .../app/components/future-date-input.js | 4 +- .../app/components/generated-invite-link.js | 6 +- .../discourse/app/components/global-notice.js | 34 +-- .../discourse/app/components/google-search.js | 2 +- .../app/components/group-activity-filter.js | 2 +- .../app/components/group-card-contents.js | 10 +- .../app/components/group-flair-inputs.js | 8 +- .../components/group-manage-logs-filter.js | 4 +- .../app/components/group-manage-logs-row.js | 4 +- .../components/group-manage-save-button.js | 6 +- .../app/components/group-member-dropdown.js | 20 +- .../discourse/app/components/group-member.js | 4 +- .../app/components/group-membership-button.js | 8 +- .../app/components/group-navigation.js | 2 +- .../discourse/app/components/group-post.js | 2 +- .../app/components/group-selector.js | 18 +- .../components/groups-form-email-fields.js | 4 +- .../groups-form-interaction-fields.js | 16 +- .../groups-form-membership-fields.js | 12 +- .../components/groups-form-profile-fields.js | 8 +- .../discourse/app/components/groups-info.js | 2 +- .../app/components/hide-modal-trigger.js | 6 +- .../app/components/highlight-search.js | 4 +- .../app/components/highlight-text.js | 2 +- .../app/components/honeypot-input.js | 2 +- .../discourse/app/components/iframed-html.js | 2 +- .../app/components/ignored-user-list-item.js | 4 +- .../app/components/ignored-user-list.js | 12 +- .../app/components/image-uploader.js | 12 +- .../app/components/images-uploader.js | 2 +- .../discourse/app/components/input-tip.js | 2 +- .../app/components/invite-link-panel.js | 24 +- .../discourse/app/components/invite-panel.js | 34 +-- .../app/components/latest-topic-list-item.js | 6 +- .../discourse/app/components/link-to-input.js | 6 +- .../app/components/links-redirect.js | 4 +- .../discourse/app/components/load-more.js | 4 +- .../discourse/app/components/login-buttons.js | 4 +- .../discourse/app/components/login-modal.js | 4 +- .../app/components/login-reply-button.js | 2 +- .../app/components/mobile-category-topic.js | 4 +- .../discourse/app/components/mobile-nav.js | 6 +- .../discourse/app/components/modal-panel.js | 2 +- .../discourse/app/components/modal-tab.js | 2 +- .../discourse/app/components/mount-widget.js | 16 +- .../discourse/app/components/nav-item.js | 2 +- .../app/components/navigation-bar.js | 12 +- .../app/components/navigation-item.js | 4 +- .../components/notification-consent-banner.js | 6 +- .../discourse/app/components/number-field.js | 4 +- .../app/components/password-field.js | 2 +- .../app/components/plugin-connector.js | 8 +- .../discourse/app/components/plugin-outlet.js | 4 +- .../app/components/popup-input-tip.js | 2 +- .../app/components/preference-checkbox.js | 2 +- .../app/components/private-message-glyph.js | 2 +- .../app/components/pwa-install-banner.js | 6 +- .../discourse/app/components/quote-button.js | 10 +- .../discourse/app/components/radio-button.js | 4 +- .../app/components/related-messages.js | 6 +- .../components/reviewable-bundled-action.js | 4 +- .../components/reviewable-claimed-topic.js | 6 +- .../reviewable-conversation-post.js | 2 +- .../components/reviewable-field-category.js | 4 +- .../app/components/reviewable-field-tags.js | 8 +- .../app/components/reviewable-flagged-post.js | 8 +- .../app/components/reviewable-histories.js | 2 +- .../app/components/reviewable-item.js | 18 +- .../app/components/reviewable-queued-post.js | 4 +- .../app/components/reviewable-score.js | 2 +- .../app/components/reviewable-user.js | 2 +- .../discourse/app/components/save-controls.js | 2 +- .../app/components/scroll-tracker.js | 4 +- .../app/components/scrolling-post-stream.js | 28 +- .../app/components/search-advanced-options.js | 38 +-- .../app/components/search-text-field.js | 2 +- .../app/components/second-factor-form.js | 4 +- .../app/components/second-factor-input.js | 2 +- .../app/components/security-key-form.js | 4 +- .../discourse/app/components/share-panel.js | 6 +- .../discourse/app/components/share-popup.js | 8 +- .../discourse/app/components/share-source.js | 6 +- .../app/components/shared-draft-controls.js | 6 +- .../discourse/app/components/signup-cta.js | 6 +- .../discourse/app/components/site-header.js | 10 +- .../app/components/suggested-topics.js | 8 +- .../app/components/table-header-toggle.js | 2 +- .../discourse/app/components/tag-drop-link.js | 4 +- .../app/components/tag-groups-form.js | 12 +- .../discourse/app/components/tag-info.js | 28 +- .../discourse/app/components/tag-list.js | 4 +- .../app/components/tags-admin-dropdown.js | 16 +- .../discourse/app/components/tap-tile-grid.js | 2 +- .../discourse/app/components/tap-tile.js | 2 +- .../discourse/app/components/text-field.js | 6 +- .../discourse/app/components/time-input.js | 20 +- .../app/components/top-period-buttons.js | 6 +- .../app/components/topic-admin-menu-button.js | 2 +- .../app/components/topic-entrance.js | 10 +- .../app/components/topic-footer-buttons.js | 12 +- .../app/components/topic-list-item.js | 22 +- .../discourse/app/components/topic-list.js | 14 +- .../app/components/topic-navigation.js | 10 +- .../app/components/topic-post-badges.js | 2 +- .../app/components/topic-progress.js | 6 +- .../discourse/app/components/topic-status.js | 2 +- .../app/components/topic-timeline.js | 4 +- .../app/components/topic-timer-info.js | 10 +- .../discourse/app/components/topic-title.js | 4 +- .../app/components/track-selected.js | 4 +- .../discourse/app/components/user-badge.js | 2 +- .../app/components/user-card-contents.js | 24 +- .../discourse/app/components/user-field.js | 2 +- .../app/components/user-flag-percentage.js | 10 +- .../discourse/app/components/user-info.js | 2 +- .../discourse/app/components/user-link.js | 2 +- .../components/user-notifications-large.js | 4 +- .../discourse/app/components/user-selector.js | 21 +- .../discourse/app/components/user-stat.js | 2 +- .../app/components/user-stream-item.js | 4 +- .../discourse/app/components/user-stream.js | 24 +- .../user-summary-category-search.js | 2 +- .../app/components/user-summary-section.js | 2 +- .../app/components/user-summary-topic.js | 2 +- .../components/user-summary-topics-list.js | 2 +- .../app/components/user-summary-user.js | 2 +- .../discourse/app/components/watch-read.js | 2 +- .../discourse/app/controllers/about.js | 6 +- .../controllers/account-created-edit-email.js | 4 +- .../app/controllers/account-created-index.js | 4 +- .../app/controllers/activation-edit.js | 10 +- .../app/controllers/add-post-notice.js | 10 +- .../discourse/app/controllers/application.js | 2 +- .../controllers/associate-account-confirm.js | 8 +- .../discourse/app/controllers/auth-token.js | 8 +- .../app/controllers/avatar-selector.js | 8 +- .../discourse/app/controllers/badges/index.js | 6 +- .../discourse/app/controllers/badges/show.js | 12 +- .../app/controllers/basic-modal-body.js | 2 +- .../discourse/app/controllers/bookmark.js | 46 ++-- .../controllers/bulk-notification-level.js | 10 +- .../discourse/app/controllers/change-owner.js | 8 +- .../app/controllers/change-timestamp.js | 4 +- .../discourse/app/controllers/composer.js | 104 ++++---- .../controllers/convert-to-public-topic.js | 4 +- .../app/controllers/create-account.js | 43 ++- .../app/controllers/discovery-sortable.js | 10 +- .../discourse/app/controllers/discovery.js | 8 +- .../app/controllers/discovery/categories.js | 8 +- .../app/controllers/discovery/topics.js | 18 +- .../app/controllers/edit-category.js | 22 +- .../app/controllers/edit-topic-timer.js | 24 +- .../discourse/app/controllers/email-login.js | 14 +- .../discourse/app/controllers/exception.js | 14 +- .../app/controllers/explain-reviewable.js | 4 +- .../controllers/feature-topic-on-profile.js | 6 +- .../app/controllers/feature-topic.js | 18 +- .../discourse/app/controllers/flag.js | 18 +- .../app/controllers/forgot-password.js | 18 +- .../app/controllers/full-page-search.js | 26 +- .../discourse/app/controllers/grant-badge.js | 14 +- .../app/controllers/group-activity-posts.js | 6 +- .../app/controllers/group-activity-topics.js | 4 +- .../app/controllers/group-activity.js | 2 +- .../app/controllers/group-add-members.js | 10 +- .../discourse/app/controllers/group-index.js | 6 +- .../controllers/group-manage-categories.js | 4 +- .../app/controllers/group-manage-logs.js | 12 +- .../app/controllers/group-manage-profile.js | 2 +- .../app/controllers/group-manage-tags.js | 4 +- .../discourse/app/controllers/group-manage.js | 14 +- .../app/controllers/group-messages.js | 2 +- .../app/controllers/group-requests.js | 14 +- .../discourse/app/controllers/group.js | 26 +- .../discourse/app/controllers/groups-index.js | 6 +- .../discourse/app/controllers/groups-new.js | 6 +- .../discourse/app/controllers/history.js | 20 +- .../ignore-duration-with-username.js | 6 +- .../app/controllers/ignore-duration.js | 4 +- .../app/controllers/insert-hyperlink.js | 14 +- .../discourse/app/controllers/invites-show.js | 24 +- .../discourse/app/controllers/jump-to-post.js | 4 +- .../controllers/keyboard-shortcuts-help.js | 94 +++---- .../discourse/app/controllers/login.js | 38 +-- .../app/controllers/move-to-topic.js | 22 +- .../app/controllers/navigation/categories.js | 2 +- .../app/controllers/navigation/category.js | 2 +- .../app/controllers/navigation/default.js | 4 +- .../app/controllers/not-activated.js | 6 +- .../app/controllers/password-reset.js | 24 +- .../discourse/app/controllers/preferences.js | 2 +- .../app/controllers/preferences/account.js | 32 +-- .../app/controllers/preferences/categories.js | 8 +- .../app/controllers/preferences/email.js | 10 +- .../app/controllers/preferences/emails.js | 22 +- .../app/controllers/preferences/interface.js | 38 +-- .../controllers/preferences/notifications.js | 38 +-- .../app/controllers/preferences/profile.js | 16 +- .../controllers/preferences/second-factor.js | 42 +-- .../app/controllers/preferences/tags.js | 8 +- .../app/controllers/preferences/username.js | 8 +- .../app/controllers/preferences/users.js | 8 +- .../discourse/app/controllers/publish-page.js | 22 +- .../discourse/app/controllers/raw-email.js | 12 +- .../discourse/app/controllers/rename-tag.js | 8 +- .../app/controllers/reorder-categories.js | 20 +- .../request-group-membership-form.js | 6 +- .../discourse/app/controllers/review-index.js | 38 +-- .../app/controllers/review-settings.js | 8 +- .../second-factor-add-security-key.js | 46 ++-- .../app/controllers/second-factor-add-totp.js | 16 +- .../controllers/second-factor-backup-edit.js | 18 +- .../second-factor-edit-security-key.js | 12 +- .../app/controllers/second-factor-edit.js | 12 +- .../discourse/app/controllers/static.js | 6 +- .../app/controllers/tag-groups-edit.js | 4 +- .../app/controllers/tag-groups-new.js | 4 +- .../discourse/app/controllers/tag-groups.js | 4 +- .../discourse/app/controllers/tags-index.js | 18 +- .../discourse/app/controllers/tags-show.js | 24 +- .../app/controllers/topic-bulk-actions.js | 48 ++-- .../discourse/app/controllers/topic.js | 154 +++++------ .../app/controllers/upload-selector.js | 10 +- .../controllers/user-activity-bookmarks.js | 12 +- .../app/controllers/user-activity.js | 10 +- .../discourse/app/controllers/user-badges.js | 2 +- .../discourse/app/controllers/user-card.js | 4 +- .../app/controllers/user-invited-show.js | 33 +-- .../app/controllers/user-notifications.js | 8 +- .../discourse/app/controllers/user-posts.js | 4 +- .../controllers/user-private-messages-tags.js | 8 +- .../app/controllers/user-private-messages.js | 4 +- .../discourse/app/controllers/user-summary.js | 2 +- .../app/controllers/user-topics-list.js | 14 +- .../discourse/app/controllers/user.js | 10 +- .../discourse/app/controllers/users.js | 12 +- .../discourse/app/helpers/application.js | 8 +- .../discourse/app/helpers/border-color.js | 2 +- .../discourse/app/helpers/bound-date.js | 2 +- .../app/helpers/capitalize-string.js | 2 +- .../discourse/app/helpers/category-badge.js | 4 +- .../discourse/app/helpers/category-link.js | 2 +- .../discourse/app/helpers/cold-age-class.js | 2 +- .../discourse/app/helpers/dash-if-empty.js | 2 +- .../app/helpers/decorate-username-selector.js | 4 +- .../discourse/app/helpers/dir-span.js | 2 +- .../discourse/app/helpers/discourse-tag.js | 2 +- .../discourse/app/helpers/discourse-tags.js | 2 +- .../discourse/app/helpers/float.js | 2 +- .../discourse/app/helpers/format-age.js | 4 +- .../discourse/app/helpers/format-date.js | 4 +- .../discourse/app/helpers/icon-or-image.js | 2 +- .../discourse/app/helpers/inline-date.js | 2 +- .../discourse/app/helpers/loading-spinner.js | 2 +- .../javascripts/discourse/app/helpers/node.js | 2 +- .../discourse/app/helpers/period-title.js | 6 +- .../app/helpers/raw-plugin-outlet.js | 4 +- .../javascripts/discourse/app/helpers/raw.js | 2 +- .../helpers/reviewable-history-description.js | 2 +- .../app/helpers/reviewable-status.js | 4 +- .../discourse/app/helpers/route-action.js | 14 +- .../discourse/app/helpers/shorten-url.js | 2 +- .../app/helpers/topic-featured-link.js | 2 +- .../discourse/app/helpers/topic-link.js | 2 +- .../app/helpers/topic-status-icons.js | 8 +- .../discourse/app/helpers/user-avatar.js | 4 +- .../discourse/app/helpers/user-status.js | 4 +- .../app/initializers/asset-version.js | 6 +- .../app/initializers/auth-complete.js | 2 +- .../app/initializers/auto-load-modules.js | 8 +- .../app/initializers/avatar-select.js | 4 +- .../discourse/app/initializers/badging.js | 2 +- .../discourse/app/initializers/banner.js | 4 +- .../app/initializers/click-interceptor.js | 2 +- .../app/initializers/copy-codeblocks.js | 14 +- .../discourse/app/initializers/csrf-token.js | 4 +- .../discourse/app/initializers/d-popover.js | 8 +- .../app/initializers/ember-events.js | 8 +- .../app/initializers/enable-emoji.js | 10 +- .../ensure-max-image-dimensions.js | 2 +- .../app/initializers/inject-objects.js | 2 +- .../app/initializers/jquery-plugins.js | 4 +- .../app/initializers/keyboard-shortcuts.js | 2 +- .../app/initializers/live-development.js | 16 +- .../app/initializers/localization.js | 8 +- .../discourse/app/initializers/logout.js | 10 +- .../discourse/app/initializers/logs-notice.js | 8 +- .../discourse/app/initializers/message-bus.js | 8 +- .../discourse/app/initializers/mobile.js | 2 +- .../discourse/app/initializers/moment.js | 2 +- .../app/initializers/page-tracking.js | 10 +- .../app/initializers/post-decorations.js | 18 +- .../discourse/app/initializers/read-only.js | 4 +- .../initializers/register-service-worker.js | 8 +- .../app/initializers/relative-ages.js | 4 +- .../app/initializers/sharing-sources.js | 16 +- .../discourse/app/initializers/show-footer.js | 2 +- .../discourse/app/initializers/signup-cta.js | 2 +- .../strip-mobile-app-url-params.js | 4 +- .../subscribe-user-notifications.js | 28 +- .../app/initializers/topic-footer-buttons.js | 30 +-- .../app/initializers/url-redirects.js | 6 +- .../app/initializers/webview-background.js | 2 +- .../discourse/app/lib/after-transition.js | 10 +- .../discourse/app/lib/ajax-error.js | 2 +- .../javascripts/discourse/app/lib/ajax.js | 4 +- .../discourse/app/lib/autocomplete.js | 39 ++- .../javascripts/discourse/app/lib/autosize.js | 14 +- .../javascripts/discourse/app/lib/bookmark.js | 6 +- .../discourse/app/lib/cached-topic-list.js | 2 +- .../discourse/app/lib/category-hashtags.js | 2 +- .../discourse/app/lib/category-tag-search.js | 16 +- .../discourse/app/lib/clean-dom.js | 9 +- .../discourse/app/lib/click-track.js | 6 +- .../discourse/app/lib/color-scheme-picker.js | 12 +- .../javascripts/discourse/app/lib/computed.js | 32 +-- .../discourse/app/lib/constants.js | 2 +- .../javascripts/discourse/app/lib/cookie.js | 11 +- .../discourse/app/lib/copy-text.js | 2 +- .../discourse/app/lib/d-popover.js | 26 +- .../javascripts/discourse/app/lib/debounce.js | 6 +- .../discourse/app/lib/decimal-adjust.js | 2 +- .../app/lib/desktop-notifications.js | 20 +- .../discourse/app/lib/discourse-location.js | 4 +- .../discourse/app/lib/export-csv.js | 4 +- .../javascripts/discourse/app/lib/eyeline.js | 6 +- .../discourse/app/lib/formatter.js | 30 +-- .../discourse/app/lib/highlight-html.js | 10 +- .../discourse/app/lib/highlight-search.js | 6 +- .../discourse/app/lib/highlight-syntax.js | 6 +- .../app/lib/is-element-in-viewport.js | 2 +- .../discourse/app/lib/key-value-store.js | 6 +- .../discourse/app/lib/keyboard-shortcuts.js | 43 ++- .../discourse/app/lib/lazy-load-images.js | 18 +- .../javascripts/discourse/app/lib/lightbox.js | 18 +- .../discourse/app/lib/link-hashtags.js | 10 +- .../discourse/app/lib/link-mentions.js | 35 ++- .../discourse/app/lib/load-script.js | 12 +- .../javascripts/discourse/app/lib/lock-on.js | 4 +- .../javascripts/discourse/app/lib/mobile.js | 2 +- .../discourse/app/lib/notification-levels.js | 10 +- .../discourse/app/lib/optional-service.js | 6 +- .../discourse/app/lib/page-tracker.js | 12 +- .../discourse/app/lib/page-visible.js | 2 +- .../discourse/app/lib/plugin-api.js | 24 +- .../discourse/app/lib/plugin-connectors.js | 14 +- .../app/lib/posts-with-placeholders.js | 8 +- .../discourse/app/lib/preload-store.js | 8 +- .../discourse/app/lib/push-notifications.js | 30 +-- .../discourse/app/lib/put-cursor-at-end.js | 2 +- .../discourse/app/lib/pwa-utils.js | 2 +- .../javascripts/discourse/app/lib/quote.js | 2 +- .../app/lib/register-topic-footer-button.js | 14 +- .../discourse/app/lib/render-tags.js | 4 +- .../app/lib/render-topic-featured-link.js | 6 +- .../discourse/app/lib/reports-loader.js | 14 +- .../javascripts/discourse/app/lib/round.js | 2 +- .../discourse/app/lib/safari-hacks.js | 20 +- .../discourse/app/lib/screen-track.js | 23 +- .../javascripts/discourse/app/lib/search.js | 36 +-- .../javascripts/discourse/app/lib/sharing.js | 10 +- .../discourse/app/lib/show-modal.js | 4 +- .../discourse/app/lib/static-route-builder.js | 8 +- .../javascripts/discourse/app/lib/text.js | 12 +- .../discourse/app/lib/theme-selector.js | 10 +- .../discourse/app/lib/to-markdown.js | 51 ++-- .../discourse/app/lib/topic-list-tracker.js | 2 +- .../discourse/app/lib/transform-post.js | 14 +- .../javascripts/discourse/app/lib/uploads.js | 15 +- .../javascripts/discourse/app/lib/url.js | 20 +- .../discourse/app/lib/user-activation.js | 2 +- .../discourse/app/lib/user-presence.js | 2 +- .../discourse/app/lib/user-search.js | 16 +- .../discourse/app/lib/utilities.js | 22 +- .../javascripts/discourse/app/lib/webauthn.js | 16 +- .../discourse/app/mapping-router.js | 16 +- .../app/mixins/add-archetype-class.js | 2 +- .../discourse/app/mixins/buffered-content.js | 10 +- .../app/mixins/bulk-topic-selection.js | 10 +- .../discourse/app/mixins/can-check-emails.js | 2 +- .../app/mixins/card-contents-base.js | 18 +- .../discourse/app/mixins/cleans-up.js | 6 +- .../discourse/app/mixins/docking.js | 4 +- .../discourse/app/mixins/filter-mode.js | 6 +- .../app/mixins/grant-badge-controller.js | 12 +- .../discourse/app/mixins/key-enter-escape.js | 2 +- .../discourse/app/mixins/load-more.js | 2 +- .../app/mixins/mobile-scroll-direction.js | 2 +- .../app/mixins/modal-functionality.js | 4 +- .../discourse/app/mixins/name-validation.js | 4 +- .../discourse/app/mixins/open-composer.js | 8 +- .../discourse/app/mixins/pan-events.js | 14 +- .../app/mixins/password-validation.js | 18 +- .../discourse/app/mixins/scroll-top.js | 4 +- .../discourse/app/mixins/scrolling.js | 4 +- .../discourse/app/mixins/singleton.js | 2 +- .../discourse/app/mixins/upload.js | 16 +- .../discourse/app/mixins/url-refresh.js | 2 +- .../app/mixins/user-fields-validation.js | 8 +- .../app/mixins/username-validation.js | 32 +-- .../app/mixins/viewing-action-type.js | 2 +- .../discourse/app/models/action-summary.js | 20 +- .../discourse/app/models/archetype.js | 2 +- .../discourse/app/models/badge-grouping.js | 2 +- .../javascripts/discourse/app/models/badge.js | 26 +- .../discourse/app/models/bookmark.js | 14 +- .../discourse/app/models/category-list.js | 26 +- .../discourse/app/models/category.js | 62 ++--- .../discourse/app/models/composer.js | 92 +++---- .../javascripts/discourse/app/models/draft.js | 8 +- .../discourse/app/models/group-history.js | 2 +- .../javascripts/discourse/app/models/group.js | 66 ++--- .../discourse/app/models/invite.js | 16 +- .../discourse/app/models/live-post-counts.js | 4 +- .../discourse/app/models/login-method.js | 12 +- .../discourse/app/models/nav-item.js | 31 +-- .../discourse/app/models/permission-type.js | 4 +- .../discourse/app/models/post-action-type.js | 2 +- .../discourse/app/models/post-stream.js | 94 +++---- .../javascripts/discourse/app/models/post.js | 72 ++--- .../discourse/app/models/published-page.js | 4 +- .../javascripts/discourse/app/models/rest.js | 10 +- .../discourse/app/models/result-set.js | 2 +- .../app/models/reviewable-history.js | 2 +- .../discourse/app/models/reviewable.js | 6 +- .../discourse/app/models/session.js | 2 +- .../javascripts/discourse/app/models/site.js | 36 +-- .../discourse/app/models/static-page.js | 6 +- .../javascripts/discourse/app/models/store.js | 38 +-- .../discourse/app/models/tag-group.js | 2 +- .../javascripts/discourse/app/models/tag.js | 2 +- .../discourse/app/models/topic-details.js | 16 +- .../discourse/app/models/topic-list.js | 30 +-- .../discourse/app/models/topic-timer.js | 6 +- .../app/models/topic-tracking-state.js | 44 ++-- .../javascripts/discourse/app/models/topic.js | 114 ++++---- .../discourse/app/models/trust-level.js | 2 +- .../discourse/app/models/user-action-group.js | 2 +- .../discourse/app/models/user-action-stat.js | 2 +- .../discourse/app/models/user-action.js | 22 +- .../discourse/app/models/user-badge.js | 36 +-- .../discourse/app/models/user-draft.js | 4 +- .../app/models/user-drafts-stream.js | 16 +- .../discourse/app/models/user-posts-stream.js | 12 +- .../discourse/app/models/user-stream.js | 20 +- .../javascripts/discourse/app/models/user.js | 246 +++++++++--------- .../pre-initializers/discourse-bootstrap.js | 22 +- .../dynamic-route-builders.js | 22 +- .../inject-discourse-objects.js | 30 ++- .../app/pre-initializers/map-routes.js | 4 +- .../register-dom-templates.js | 6 +- .../pre-initializers/sniff-capabilities.js | 4 +- .../svg-sprite-fontawesome.js | 2 +- .../raw-views/list/post-count-or-badges.js | 2 +- .../app/raw-views/list/posts-count-column.js | 2 +- .../app/raw-views/list/visited-line.js | 4 +- .../app/raw-views/topic-list-header-column.js | 2 +- .../discourse/app/raw-views/topic-status.js | 6 +- .../javascripts/discourse/app/routes/about.js | 15 +- .../app/routes/account-created-edit-email.js | 2 +- .../app/routes/account-created-index.js | 2 +- .../app/routes/account-created-resent.js | 2 +- .../discourse/app/routes/account-created.js | 2 +- .../discourse/app/routes/app-route-map.js | 86 +++--- .../discourse/app/routes/application.js | 26 +- .../discourse/app/routes/associate-account.js | 4 +- .../discourse/app/routes/badges-index.js | 6 +- .../discourse/app/routes/badges-show.js | 18 +- .../routes/build-admin-user-posts-route.js | 8 +- .../app/routes/build-category-route.js | 40 +-- .../app/routes/build-group-messages-route.js | 6 +- .../routes/build-private-messages-route.js | 8 +- .../app/routes/build-static-route.js | 4 +- .../discourse/app/routes/build-topic-route.js | 20 +- .../discourse/app/routes/discourse.js | 8 +- .../app/routes/discovery-categories.js | 22 +- .../discourse/app/routes/discovery.js | 8 +- .../discourse/app/routes/email-login.js | 2 +- .../discourse/app/routes/exception-unknown.js | 2 +- .../discourse/app/routes/exception.js | 4 +- .../discourse/app/routes/forgot-password.js | 4 +- .../discourse/app/routes/full-page-search.js | 16 +- .../app/routes/group-activity-index.js | 2 +- .../app/routes/group-activity-posts.js | 6 +- .../app/routes/group-activity-topics.js | 4 +- .../discourse/app/routes/group-index.js | 4 +- .../app/routes/group-manage-categories.js | 2 +- .../app/routes/group-manage-email.js | 2 +- .../app/routes/group-manage-index.js | 2 +- .../app/routes/group-manage-interaction.js | 2 +- .../discourse/app/routes/group-manage-logs.js | 4 +- .../app/routes/group-manage-membership.js | 2 +- .../app/routes/group-manage-profile.js | 2 +- .../discourse/app/routes/group-manage-tags.js | 2 +- .../discourse/app/routes/group-manage.js | 2 +- .../discourse/app/routes/group-members.js | 2 +- .../app/routes/group-messages-index.js | 4 +- .../discourse/app/routes/group-messages.js | 2 +- .../discourse/app/routes/group-permissions.js | 6 +- .../discourse/app/routes/group-requests.js | 4 +- .../javascripts/discourse/app/routes/group.js | 2 +- .../discourse/app/routes/groups-index.js | 4 +- .../discourse/app/routes/groups-new.js | 2 +- .../discourse/app/routes/invites-show.js | 4 +- .../javascripts/discourse/app/routes/login.js | 4 +- .../discourse/app/routes/new-message.js | 8 +- .../discourse/app/routes/new-topic.js | 10 +- .../discourse/app/routes/password-reset.js | 6 +- .../javascripts/discourse/app/routes/post.js | 4 +- .../app/routes/preferences-account.js | 22 +- .../discourse/app/routes/preferences-apps.js | 2 +- .../app/routes/preferences-categories.js | 2 +- .../discourse/app/routes/preferences-email.js | 14 +- .../app/routes/preferences-emails.js | 2 +- .../discourse/app/routes/preferences-index.js | 2 +- .../app/routes/preferences-interface.js | 4 +- .../app/routes/preferences-notifications.js | 2 +- .../app/routes/preferences-profile.js | 2 +- .../app/routes/preferences-second-factor.js | 8 +- .../discourse/app/routes/preferences-tags.js | 2 +- .../app/routes/preferences-username.js | 12 +- .../discourse/app/routes/preferences-users.js | 2 +- .../discourse/app/routes/preferences.js | 2 +- .../discourse/app/routes/restricted-user.js | 2 +- .../discourse/app/routes/review-index.js | 10 +- .../discourse/app/routes/review-settings.js | 2 +- .../discourse/app/routes/review-show.js | 2 +- .../discourse/app/routes/review-topics.js | 2 +- .../discourse/app/routes/review.js | 2 +- .../discourse/app/routes/signup.js | 6 +- .../discourse/app/routes/tag-groups-edit.js | 2 +- .../discourse/app/routes/tag-groups-new.js | 4 +- .../discourse/app/routes/tag-groups.js | 2 +- .../discourse/app/routes/tags-index.js | 16 +- .../discourse/app/routes/tags-show.js | 44 ++-- .../app/routes/topic-by-slug-or-id.js | 2 +- .../discourse/app/routes/topic-from-params.js | 10 +- .../javascripts/discourse/app/routes/topic.js | 38 +-- .../discourse/app/routes/unknown.js | 6 +- .../user-activity-bookmarks-with-reminders.js | 4 +- .../app/routes/user-activity-bookmarks.js | 6 +- .../app/routes/user-activity-drafts.js | 4 +- .../app/routes/user-activity-index.js | 2 +- .../app/routes/user-activity-likes-given.js | 4 +- .../app/routes/user-activity-pending.js | 2 +- .../app/routes/user-activity-replies.js | 4 +- .../app/routes/user-activity-stream.js | 8 +- .../app/routes/user-activity-topics.js | 7 +- .../discourse/app/routes/user-activity.js | 2 +- .../discourse/app/routes/user-badges.js | 4 +- .../discourse/app/routes/user-index.js | 2 +- .../app/routes/user-invited-index.js | 4 +- .../discourse/app/routes/user-invited-show.js | 28 +- .../app/routes/user-notifications-edits.js | 2 +- .../app/routes/user-notifications-index.js | 2 +- .../user-notifications-likes-received.js | 2 +- .../app/routes/user-notifications-mentions.js | 2 +- .../routes/user-notifications-responses.js | 2 +- .../app/routes/user-notifications.js | 6 +- .../user-private-messages-group-archive.js | 4 +- .../app/routes/user-private-messages-group.js | 12 +- .../routes/user-private-messages-tags-show.js | 4 +- .../app/routes/user-private-messages-tags.js | 10 +- .../app/routes/user-private-messages.js | 10 +- .../discourse/app/routes/user-summary.js | 4 +- .../discourse/app/routes/user-topic-list.js | 4 +- .../javascripts/discourse/app/routes/user.js | 8 +- .../javascripts/discourse/app/routes/users.js | 8 +- .../discourse/app/services/app-events.js | 10 +- .../discourse/app/services/document-title.js | 2 +- .../discourse/app/services/emoji-store.js | 4 +- .../discourse/app/services/logs-notice.js | 8 +- .../discourse/app/services/search.js | 4 +- .../discourse/app/services/theme-settings.js | 2 +- .../discourse/app/widgets/actions-summary.js | 14 +- .../discourse/app/widgets/avatar-flair.js | 2 +- .../bookmark-reminder-notification-item.js | 6 +- .../discourse/app/widgets/button.js | 10 +- .../app/widgets/component-connector.js | 2 +- .../discourse/app/widgets/connector.js | 2 +- .../app/widgets/custom-notification-item.js | 2 +- .../app/widgets/default-notification-item.js | 10 +- .../discourse/app/widgets/embedded-post.js | 18 +- .../discourse/app/widgets/emoji.js | 4 +- .../discourse/app/widgets/footer-nav.js | 10 +- .../javascripts/discourse/app/widgets/glue.js | 8 +- ...group-message-summary-notification-item.js | 4 +- .../app/widgets/hamburger-categories.js | 12 +- .../discourse/app/widgets/hamburger-menu.js | 70 ++--- .../discourse/app/widgets/header-contents.js | 2 +- .../app/widgets/header-topic-info.js | 31 +-- .../discourse/app/widgets/header.js | 80 +++--- .../discourse/app/widgets/home-logo.js | 12 +- .../discourse/app/widgets/hooks.js | 80 +++--- .../invitee-accepted-notification-item.js | 2 +- .../liked-consolidated-notification-item.js | 12 +- .../app/widgets/liked-notification-item.js | 6 +- .../javascripts/discourse/app/widgets/link.js | 8 +- ...ship-request-accepted-notification-item.js | 4 +- ...-request-consolidated-notification-item.js | 4 +- .../discourse/app/widgets/menu-panel.js | 6 +- .../discourse/app/widgets/post-admin-menu.js | 34 +-- .../discourse/app/widgets/post-cooked.js | 26 +- .../app/widgets/post-edits-indicator.js | 6 +- .../discourse/app/widgets/post-gap.js | 4 +- .../discourse/app/widgets/post-links.js | 12 +- .../discourse/app/widgets/post-menu.js | 96 +++---- .../discourse/app/widgets/post-placeholder.js | 2 +- .../app/widgets/post-small-action.js | 18 +- .../discourse/app/widgets/post-stream.js | 2 +- .../javascripts/discourse/app/widgets/post.js | 110 ++++---- .../discourse/app/widgets/poster-name.js | 22 +- .../app/widgets/private-message-map.js | 38 +-- .../app/widgets/quick-access-bookmarks.js | 12 +- .../app/widgets/quick-access-item.js | 6 +- .../app/widgets/quick-access-messages.js | 6 +- .../app/widgets/quick-access-notifications.js | 4 +- .../app/widgets/quick-access-panel.js | 12 +- .../app/widgets/quick-access-profile.js | 18 +- .../app/widgets/search-menu-controls.js | 10 +- .../app/widgets/search-menu-results.js | 48 ++-- .../discourse/app/widgets/search-menu.js | 20 +- .../discourse/app/widgets/time-gap.js | 4 +- .../app/widgets/toggle-topic-summary.js | 10 +- .../discourse/app/widgets/topic-admin-menu.js | 46 ++-- .../discourse/app/widgets/topic-map.js | 88 +++---- .../discourse/app/widgets/topic-status.js | 6 +- .../discourse/app/widgets/topic-timeline.js | 64 ++--- .../discourse/app/widgets/user-menu.js | 34 +-- .../app/widgets/user-notifications-large.js | 8 +- .../discourse/app/widgets/widget-dropdown.js | 30 +-- .../discourse/app/widgets/widget.js | 16 +- app/assets/javascripts/embed-application.js | 6 +- app/assets/javascripts/google-tag-manager.js | 2 +- .../javascripts/google-universal-analytics.js | 2 +- app/assets/javascripts/handlebars-shim.js | 4 +- app/assets/javascripts/locales/i18n.js | 2 - app/assets/javascripts/onpopstate-handler.js | 2 +- app/assets/javascripts/polyfills.js | 18 +- .../pretty-text/addon/censored-words.js | 6 +- .../javascripts/pretty-text/addon/emoji.js | 22 +- .../pretty-text/addon/emoji/data.js | 22 +- .../addon/engines/discourse-markdown-it.js | 32 +-- .../discourse-markdown/bbcode-block.js | 8 +- .../discourse-markdown/bbcode-inline.js | 38 +-- .../discourse-markdown/category-hashtag.js | 6 +- .../engines/discourse-markdown/censored.js | 6 +- .../addon/engines/discourse-markdown/code.js | 4 +- .../engines/discourse-markdown/d-wrap.js | 8 +- .../addon/engines/discourse-markdown/emoji.js | 18 +- .../engines/discourse-markdown/html-img.js | 2 +- .../discourse-markdown/inject-line-number.js | 4 +- .../engines/discourse-markdown/mentions.js | 4 +- .../engines/discourse-markdown/newline.js | 2 +- .../engines/discourse-markdown/onebox.js | 2 +- .../engines/discourse-markdown/paragraph.js | 2 +- .../engines/discourse-markdown/quotes.js | 10 +- .../discourse-markdown/resize-controls.js | 19 +- .../addon/engines/discourse-markdown/table.js | 12 +- .../discourse-markdown/text-post-process.js | 8 +- .../discourse-markdown/upload-protocol.js | 4 +- .../javascripts/pretty-text/addon/guid.js | 4 +- .../pretty-text/addon/inline-oneboxer.js | 12 +- .../javascripts/pretty-text/addon/oneboxer.js | 12 +- .../pretty-text/addon/pretty-text.js | 10 +- .../pretty-text/addon/sanitizer.js | 8 +- .../pretty-text/addon/upload-short-url.js | 22 +- .../pretty-text/addon/white-lister.js | 6 +- .../pretty-text/config/ember-try.js | 60 ++--- .../pretty-text/config/environment.js | 2 +- .../pretty-text/ember-cli-build.js | 2 +- app/assets/javascripts/pretty-text/index.js | 2 +- app/assets/javascripts/print-page.js | 2 +- .../components/categories-admin-dropdown.js | 12 +- .../addon/components/category-chooser.js | 12 +- .../addon/components/category-drop.js | 28 +- .../category-drop/category-drop-header.js | 2 +- .../category-notifications-button.js | 4 +- .../addon/components/category-row.js | 35 +-- .../addon/components/category-selector.js | 14 +- .../addon/components/color-palettes.js | 4 +- .../color-palettes/color-palettes-row.js | 12 +- .../select-kit/addon/components/combo-box.js | 4 +- .../components/combo-box/combo-box-header.js | 4 +- .../addon/components/composer-actions.js | 40 +-- .../addon/components/create-color-row.js | 2 +- .../addon/components/dropdown-select-box.js | 4 +- .../dropdown-select-box-header.js | 6 +- .../dropdown-select-box-row.js | 2 +- .../components/future-date-input-selector.js | 158 ++++------- .../future-date-input-selector-header.js | 2 +- .../future-date-input-selector-row.js | 2 +- .../future-date-input-selector/mixin.js | 4 +- .../addon/components/group-chooser.js | 4 +- .../addon/components/group-dropdown.js | 8 +- .../components/group-members-dropdown.js | 12 +- .../components/group-notifications-button.js | 4 +- .../addon/components/icon-picker.js | 14 +- .../addon/components/list-setting.js | 6 +- .../addon/components/mini-tag-chooser.js | 20 +- .../mini-tag-chooser-header.js | 2 +- .../mini-tag-chooser/selected-collection.js | 12 +- .../addon/components/multi-select.js | 18 +- .../multi-select/multi-select-filter.js | 2 +- .../multi-select/multi-select-header.js | 10 +- .../multi-select/selected-category.js | 6 +- .../components/multi-select/selected-color.js | 2 +- .../addon/components/none-category-row.js | 4 +- .../addon/components/notifications-button.js | 8 +- .../notifications-button-row.js | 10 +- .../addon/components/notifications-filter.js | 14 +- .../notifications-filter-header.js | 2 +- .../addon/components/period-chooser.js | 6 +- .../period-chooser/period-chooser-header.js | 2 +- .../period-chooser/period-chooser-row.js | 2 +- .../addon/components/pinned-button.js | 2 +- .../addon/components/pinned-options.js | 12 +- .../search-advanced-category-chooser.js | 4 +- .../select-kit/addon/components/select-kit.js | 73 +++--- .../select-kit/errors-collection.js | 2 +- .../components/select-kit/select-kit-body.js | 4 +- .../select-kit/select-kit-collection.js | 2 +- .../select-kit/select-kit-create-row.js | 2 +- .../select-kit/select-kit-filter.js | 8 +- .../select-kit/select-kit-header.js | 20 +- .../select-kit/select-kit-none-row.js | 2 +- .../components/select-kit/select-kit-row.js | 26 +- .../select-kit/single-select-header.js | 2 +- .../addon/components/selected-color.js | 2 +- .../addon/components/selected-name.js | 14 +- .../addon/components/single-select.js | 8 +- .../addon/components/tag-chooser-row.js | 2 +- .../addon/components/tag-chooser.js | 26 +- .../select-kit/addon/components/tag-drop.js | 28 +- .../components/tag-drop/tag-drop-header.js | 2 +- .../addon/components/tag-group-chooser.js | 20 +- .../components/tag-notifications-button.js | 4 +- .../select-kit/addon/components/tag-row.js | 2 +- .../addon/components/timezone-input.js | 6 +- .../components/toolbar-popup-menu-options.js | 8 +- .../topic-footer-mobile-dropdown.js | 6 +- .../components/topic-notifications-button.js | 4 +- .../components/topic-notifications-options.js | 6 +- .../addon/components/user-chooser.js | 16 +- .../addon/components/user-chooser/user-row.js | 2 +- .../components/user-notifications-dropdown.js | 20 +- .../select-kit/addon/mixins/plugin-api.js | 20 +- .../select-kit/addon/mixins/tags.js | 23 +- .../select-kit/addon/mixins/utils.js | 4 +- .../select-kit/config/ember-try.js | 60 ++--- .../select-kit/config/environment.js | 2 +- .../javascripts/select-kit/ember-cli-build.js | 2 +- app/assets/javascripts/select-kit/index.js | 2 +- .../javascripts/set-prototype-polyfill.js | 2 +- app/assets/javascripts/start-discourse.js | 2 +- app/assets/javascripts/widget-runtime.js | 4 +- app/assets/javascripts/wizard-start.js | 2 +- .../wizard/components/font-preview.js | 6 +- .../wizard/components/font-previews.js | 4 +- .../wizard/components/homepage-preview.js | 40 +-- .../components/image-preview-favicon.js | 2 +- .../components/image-preview-large-icon.js | 4 +- .../components/image-preview-logo-small.js | 2 +- .../wizard/components/image-preview-logo.js | 2 +- .../wizard/components/invite-list-user.js | 2 +- .../wizard/components/invite-list.js | 8 +- .../wizard/components/popular-themes.js | 4 +- .../wizard/components/radio-button.js | 2 +- .../wizard/components/staff-count.js | 2 +- .../wizard/components/theme-preview.js | 6 +- .../wizard/components/theme-previews.js | 4 +- .../wizard/components/wizard-canvas.js | 6 +- .../components/wizard-field-checkboxes.js | 4 +- .../components/wizard-field-dropdown.js | 2 +- .../wizard/components/wizard-field-image.js | 8 +- .../wizard/components/wizard-field-radio.js | 4 +- .../components/wizard-field-textarea.js | 2 +- .../wizard/components/wizard-field.js | 6 +- .../wizard/components/wizard-image-preview.js | 2 +- .../wizard/components/wizard-step-form.js | 2 +- .../wizard/components/wizard-step.js | 24 +- .../wizard/controllers/application.js | 4 +- .../javascripts/wizard/controllers/step.js | 4 +- .../wizard/initializers/load-helpers.js | 4 +- app/assets/javascripts/wizard/lib/ajax.js | 4 +- app/assets/javascripts/wizard/lib/preview.js | 12 +- .../javascripts/wizard/mixins/valid-state.js | 10 +- app/assets/javascripts/wizard/models/step.js | 16 +- .../javascripts/wizard/models/wizard-field.js | 2 +- .../javascripts/wizard/models/wizard.js | 10 +- app/assets/javascripts/wizard/router.js | 4 +- .../javascripts/wizard/routes/application.js | 4 +- app/assets/javascripts/wizard/routes/index.js | 2 +- app/assets/javascripts/wizard/routes/step.js | 4 +- .../wizard/test/acceptance/wizard-test.js | 6 +- .../test/components/invite-list-test.js | 2 +- .../wizard/test/helpers/component-test.js | 2 +- .../wizard/test/helpers/start-app.js | 2 +- .../wizard/test/models/wizard-field-test.js | 6 +- .../javascripts/wizard/test/test_helper.js | 8 +- .../wizard/test/wizard-pretender.js | 32 +-- app/assets/javascripts/wizard/wizard.js | 6 +- .../stylesheets/common/foundation/mixins.scss | 2 +- .../common/foundation/variables.scss | 10 +- test/javascripts/acceptance/about-test.js | 2 +- .../acceptance/account-created-test.js | 24 +- .../acceptance/admin-emails-test.js | 6 +- .../acceptance/admin-search-log-term-test.js | 2 +- .../acceptance/admin-search-logs-test.js | 2 +- .../acceptance/admin-site-settings-test.js | 18 +- .../acceptance/admin-site-text-test.js | 4 +- .../acceptance/admin-suspend-user-test.js | 16 +- .../acceptance/admin-user-badges-test.js | 2 +- .../acceptance/admin-user-emails-test.js | 14 +- .../acceptance/admin-user-index-test.js | 43 +-- .../acceptance/admin-users-list-test.js | 16 +- .../acceptance/admin-watched-words-test.js | 18 +- .../acceptance/auth-complete-test.js | 8 +- test/javascripts/acceptance/badges-test.js | 4 +- test/javascripts/acceptance/bookmarks-test.js | 53 ++-- .../acceptance/category-banner-test.js | 24 +- .../acceptance/category-chooser-test.js | 17 +- .../acceptance/category-edit-security-test.js | 30 +-- .../acceptance/category-edit-test.js | 14 +- .../acceptance/click-track-test.js | 2 +- .../acceptance/composer-actions-test.js | 149 +++++------ .../acceptance/composer-attachment-test.js | 26 +- .../acceptance/composer-edit-conflict-test.js | 14 +- .../acceptance/composer-hyperlink-test.js | 8 +- .../acceptance/composer-onebox-test.js | 10 +- .../acceptance/composer-tags-test.js | 8 +- test/javascripts/acceptance/composer-test.js | 122 ++++----- .../acceptance/composer-topic-links-test.js | 96 +++---- .../acceptance/composer-uncategorized-test.js | 6 +- .../create-account-external-test.js | 8 +- .../create-account-user-fields-test.js | 14 +- .../acceptance/custom-html-set-test.js | 8 +- .../acceptance/custom-html-template-test.js | 4 +- test/javascripts/acceptance/dashboard-test.js | 36 +-- .../acceptance/email-notice-test.js | 8 +- .../acceptance/emoji-picker-test.js | 81 +++--- test/javascripts/acceptance/emoji-test.js | 12 +- .../acceptance/encoded-category-test.js | 14 +- .../acceptance/enforce-second-factor-test.js | 10 +- .../acceptance/forgot-password-test.js | 30 +-- .../acceptance/group-card-mobile-test.js | 2 +- .../javascripts/acceptance/group-card-test.js | 2 +- .../acceptance/group-index-test.js | 6 +- .../group-manage-categories-test.js | 6 +- .../group-manage-interaction-test.js | 12 +- .../acceptance/group-manage-logs-test.js | 32 +-- .../group-manage-membership-test.js | 6 +- .../acceptance/group-manage-profile-test.js | 8 +- .../acceptance/group-manage-tags-test.js | 6 +- .../acceptance/group-requests-test.js | 38 ++- test/javascripts/acceptance/group-test.js | 60 ++--- .../acceptance/groups-index-test.js | 6 +- .../javascripts/acceptance/groups-new-test.js | 20 +- .../acceptance/hamburger-menu-test.js | 4 +- test/javascripts/acceptance/hashtags-test.js | 12 +- .../acceptance/invite-accept-test.js | 10 +- .../invite-show-user-fields-test.js | 18 +- test/javascripts/acceptance/jump-to-test.js | 10 +- .../acceptance/keyboard-shortcuts-test.js | 16 +- .../acceptance/login-redirect-test.js | 8 +- .../acceptance/login-required-test.js | 6 +- ...email-and-hide-email-address-taken-test.js | 14 +- ...in-with-email-and-no-social-logins-test.js | 8 +- .../login-with-email-disabled-test.js | 6 +- .../acceptance/login-with-email-test.js | 20 +- .../acceptance/mobile-discovery-test.js | 2 +- .../acceptance/mobile-sign-in-test.js | 2 +- .../acceptance/mobile-users-test.js | 2 +- test/javascripts/acceptance/modal-test.js | 30 +-- .../acceptance/new-message-test.js | 16 +- test/javascripts/acceptance/new-topic-test.js | 16 +- .../acceptance/notifications-filter-test.js | 8 +- .../acceptance/page-publishing-test.js | 8 +- .../acceptance/password-reset-test.js | 31 +-- .../acceptance/personal-message-test.js | 10 +- .../plugin-keyboard-shortcut-test.js | 14 +- .../plugin-outlet-connector-class-test.js | 12 +- .../plugin-outlet-decorator-test.js | 6 +- .../plugin-outlet-multi-template-test.js | 4 +- .../plugin-outlet-single-template-test.js | 4 +- .../acceptance/post-admin-menu-test.js | 25 +- .../acceptance/preferences-test.js | 88 +++---- .../acceptance/raw-plugin-outlet-test.js | 6 +- .../acceptance/redirect-to-top-test.js | 20 +- test/javascripts/acceptance/reports-test.js | 19 +- test/javascripts/acceptance/review-test.js | 45 +--- .../acceptance/search-full-test.js | 110 ++++---- .../acceptance/search-mobile-test.js | 2 +- test/javascripts/acceptance/search-test.js | 20 +- .../share-and-invite-desktop-test.js | 6 +- .../share-and-invite-mobile-test.js | 6 +- .../acceptance/shared-drafts-test.js | 2 +- test/javascripts/acceptance/sign-in-test.js | 16 +- test/javascripts/acceptance/static-test.js | 2 +- .../javascripts/acceptance/tag-groups-test.js | 8 +- .../acceptance/tags-intersection-test.js | 16 +- test/javascripts/acceptance/tags-test.js | 78 +++--- .../acceptance/topic-admin-menu-test.js | 45 ++-- .../acceptance/topic-anonymous-test.js | 10 +- .../acceptance/topic-discovery-test.js | 18 +- .../acceptance/topic-edit-timer-test.js | 92 ++----- .../topic-footer-buttons-mobile-test.js | 10 +- .../acceptance/topic-list-tracker-test.js | 4 +- .../acceptance/topic-move-posts-test.js | 20 +- .../topic-notifications-button-test.js | 4 +- .../acceptance/topic-quote-button-test.js | 43 +-- test/javascripts/acceptance/topic-test.js | 98 +++---- test/javascripts/acceptance/unknown-test.js | 14 +- .../acceptance/user-anonymous-test.js | 8 +- .../acceptance/user-bookmarks-test.js | 20 +- .../acceptance/user-card-mobile-test.js | 2 +- test/javascripts/acceptance/user-card-test.js | 34 +-- .../acceptance/user-drafts-stream-test.js | 8 +- .../user-preferences-interface-test.js | 36 ++- test/javascripts/acceptance/user-test.js | 18 +- test/javascripts/acceptance/users-test.js | 8 +- .../components/group-list-setting-test.js | 10 +- .../admin/components/themes-list-item-test.js | 22 +- .../admin/components/themes-list-test.js | 36 ++- .../admin-customize-themes-show-test.js | 18 +- .../admin-customize-themes-test.js | 20 +- .../controllers/admin-user-badges-test.js | 18 +- test/javascripts/admin/models/theme-test.js | 2 +- .../javascripts/components/ace-editor-test.js | 13 +- .../components/admin-report-test.js | 40 ++- .../components/badge-title-test.js | 10 +- test/javascripts/components/cook-text-test.js | 10 +- test/javascripts/components/d-button-test.js | 26 +- test/javascripts/components/d-editor-test.js | 123 ++++----- test/javascripts/components/d-icon-test.js | 12 +- .../javascripts/components/date-input-test.js | 6 +- .../components/date-time-input-range-test.js | 2 +- .../components/date-time-input-test.js | 8 +- .../group-membership-button-test.js | 16 +- .../components/highlighted-code-test.js | 15 +- .../components/html-safe-helper-test.js | 2 +- .../components/iframed-html-test.js | 2 +- .../components/image-uploader-test.js | 6 +- .../components/keyboard-shortcuts-test.js | 42 +-- test/javascripts/components/load-more-test.js | 4 +- .../components/secret-value-list-test.js | 6 +- .../components/select-kit/api-test.js | 22 +- .../select-kit/category-chooser-test.js | 18 +- .../select-kit/category-drop-test.js | 59 ++--- .../components/select-kit/combo-box-test.js | 16 +- .../select-kit/dropdown-select-box-test.js | 35 +-- .../select-kit/list-setting-test.js | 2 +- .../select-kit/mini-tag-chooser-test.js | 22 +- .../select-kit/multi-select-test.js | 6 +- .../select-kit/notifications-button-test.js | 4 +- .../select-kit/pinned-options-test.js | 12 +- .../select-kit/single-select-test.js | 44 ++-- .../components/select-kit/tag-drop-test.js | 16 +- .../topic-notifications-button-test.js | 26 +- .../topic-notifications-options-test.js | 18 +- .../select-kit/user-chooser-test.js | 4 +- .../components/share-button-test.js | 2 +- test/javascripts/components/share-button.js | 2 +- .../components/simple-list-test.js | 6 +- .../javascripts/components/text-field-test.js | 16 +- .../javascripts/components/time-input-test.js | 8 +- .../components/user-selector-test.js | 4 +- .../javascripts/components/value-list-test.js | 12 +- .../controllers/avatar-selector-test.js | 8 +- test/javascripts/controllers/bookmark-test.js | 59 ++--- .../controllers/create-account-test.js | 10 +- test/javascripts/controllers/history-test.js | 10 +- .../controllers/preferences-account-test.js | 12 +- .../preferences-second-factor-test.js | 21 +- .../controllers/reorder-categories-test.js | 44 ++-- test/javascripts/controllers/topic-test.js | 76 +++--- test/javascripts/ember/resolver-test.js | 65 ++--- test/javascripts/helpers/component-test.js | 10 +- test/javascripts/helpers/create-pretender.js | 200 +++++++------- test/javascripts/helpers/create-store.js | 10 +- test/javascripts/helpers/d-editor-helper.js | 2 +- test/javascripts/helpers/fixture-pretender.js | 6 +- test/javascripts/helpers/qunit-helpers.js | 30 +-- test/javascripts/helpers/review-pretender.js | 58 ++--- test/javascripts/helpers/select-kit-helper.js | 29 +-- test/javascripts/helpers/site-settings.js | 2 +- test/javascripts/helpers/site.js | 60 ++--- test/javascripts/helpers/store-pretender.js | 54 ++-- .../initializers/localization-test.js | 26 +- test/javascripts/lib/bbcode-test.js | 2 +- test/javascripts/lib/bookmark-test.js | 8 +- test/javascripts/lib/break-string-test.js | 4 +- test/javascripts/lib/category-badge-test.js | 28 +- .../lib/click-track-edit-history-test.js | 16 +- .../lib/click-track-profile-page-test.js | 16 +- test/javascripts/lib/click-track-test.js | 85 +++--- test/javascripts/lib/computed-test.js | 42 +-- test/javascripts/lib/emoji-store-test.js | 10 +- test/javascripts/lib/emoji-test.js | 10 +- test/javascripts/lib/formatter-test.js | 34 +-- test/javascripts/lib/get-url-test.js | 14 +- .../lib/highlight-search-test.js.es6 | 4 +- test/javascripts/lib/i18n-test.js | 86 +++--- test/javascripts/lib/icon-library-test.js | 6 +- test/javascripts/lib/key-value-store-test.js | 4 +- test/javascripts/lib/link-mentions-test.js | 16 +- test/javascripts/lib/load-script-test.js | 2 +- test/javascripts/lib/oneboxer-test.js | 6 +- test/javascripts/lib/preload-store-test.js | 18 +- test/javascripts/lib/pretty-text-test.js | 140 +++++----- test/javascripts/lib/sanitizer-test.js | 12 +- test/javascripts/lib/search-test.js | 12 +- test/javascripts/lib/sharing-test.js | 14 +- test/javascripts/lib/text-direction-test.js | 4 +- test/javascripts/lib/to-markdown-test.js | 44 ++-- test/javascripts/lib/upload-short-url-test.js | 80 +++--- test/javascripts/lib/uploads-test.js | 58 ++--- test/javascripts/lib/url-test.js | 12 +- test/javascripts/lib/user-search-test.js | 59 +++-- test/javascripts/lib/utilities-test.js | 37 ++- test/javascripts/lib/white-lister-test.js | 14 +- .../mixins/grant-badge-controller-test.js | 28 +- .../javascripts/mixins/setting-object-test.js | 16 +- test/javascripts/mixins/singleton-test.js | 18 +- test/javascripts/models/badge-test.js | 24 +- test/javascripts/models/category-test.js | 50 ++-- test/javascripts/models/composer-test.js | 81 +++--- test/javascripts/models/email-log-test.js | 8 +- test/javascripts/models/group-test.js | 2 +- test/javascripts/models/invite-test.js | 2 +- test/javascripts/models/nav-item-test.js | 10 +- test/javascripts/models/post-stream-test.js | 122 ++++----- test/javascripts/models/post-test.js | 22 +- test/javascripts/models/report-test.js | 68 +++-- test/javascripts/models/rest-model-test.js | 30 +-- test/javascripts/models/result-set-test.js | 6 +- test/javascripts/models/session-test.js | 2 +- test/javascripts/models/site-test.js | 10 +- .../models/staff-action-log-test.js | 2 +- test/javascripts/models/store-test.js | 38 +-- test/javascripts/models/topic-details-test.js | 8 +- test/javascripts/models/topic-test.js | 38 +-- .../models/topic-tracking-state-test.js | 88 +++---- test/javascripts/models/user-action-test.js | 10 +- test/javascripts/models/user-badge-test.js | 12 +- test/javascripts/models/user-drafts-test.js | 10 +- test/javascripts/models/user-stream-test.js | 4 +- test/javascripts/models/user-test.js | 16 +- .../services/document-title-test.js | 31 +-- test/javascripts/utils/decorators-test.js | 4 +- .../widgets/actions-summary-test.js | 4 +- test/javascripts/widgets/avatar-flair-test.js | 8 +- test/javascripts/widgets/button-test.js | 6 +- .../widgets/default-notification-item-test.js | 10 +- .../widgets/hamburger-menu-test.js | 48 ++-- test/javascripts/widgets/header-test.js | 8 +- test/javascripts/widgets/home-logo-test.js | 24 +- test/javascripts/widgets/post-links-test.js | 16 +- test/javascripts/widgets/post-menu-test.js | 10 +- test/javascripts/widgets/post-stream-test.js | 24 +- test/javascripts/widgets/post-test.js | 164 ++++++------ test/javascripts/widgets/poster-name-test.js | 12 +- .../widgets/quick-access-item-test.js | 4 +- .../widgets/small-user-list-test.js | 6 +- .../widgets/topic-admin-menu-test.js | 12 +- .../widgets/topic-participant-test.js | 8 +- test/javascripts/widgets/topic-status-test.js | 12 +- test/javascripts/widgets/user-menu-test.js | 24 +- .../widgets/widget-dropdown-test.js | 40 +-- test/javascripts/widgets/widget-test.js | 112 ++++---- 1473 files changed, 9386 insertions(+), 9958 deletions(-) diff --git a/app/assets/javascripts/activate-account.js b/app/assets/javascripts/activate-account.js index b637b277631..3de61ebccd6 100644 --- a/app/assets/javascripts/activate-account.js +++ b/app/assets/javascripts/activate-account.js @@ -1,23 +1,18 @@ // discourse-skip-module -(function() { - setTimeout(function() { +(function () { + setTimeout(function () { const $activateButton = $("#activate-account-button"); - $activateButton.on("click", function() { + $activateButton.on("click", function () { $activateButton.prop("disabled", true); const hpPath = document.getElementById("data-activate-account").dataset .path; $.ajax(hpPath) - .then(function(hp) { + .then(function (hp) { $("#password_confirmation").val(hp.value); - $("#challenge").val( - hp.challenge - .split("") - .reverse() - .join("") - ); + $("#challenge").val(hp.challenge.split("").reverse().join("")); $("#activate-account-form").submit(); }) - .fail(function() { + .fail(function () { $activateButton.prop("disabled", false); }); }); diff --git a/app/assets/javascripts/admin/adapters/api-key.js b/app/assets/javascripts/admin/adapters/api-key.js index 9777518ba22..860e4c50692 100644 --- a/app/assets/javascripts/admin/adapters/api-key.js +++ b/app/assets/javascripts/admin/adapters/api-key.js @@ -9,5 +9,5 @@ export default RESTAdapter.extend({ apiNameFor() { return "key"; - } + }, }); diff --git a/app/assets/javascripts/admin/adapters/build-plugin.js b/app/assets/javascripts/admin/adapters/build-plugin.js index 0297aaa8be7..3a81ab4e573 100644 --- a/app/assets/javascripts/admin/adapters/build-plugin.js +++ b/app/assets/javascripts/admin/adapters/build-plugin.js @@ -6,6 +6,6 @@ export default function buildPluginAdapter(pluginName) { return ( "/admin/plugins/" + pluginName + this._super(store, type, findArgs) ); - } + }, }); } diff --git a/app/assets/javascripts/admin/adapters/customization-base.js b/app/assets/javascripts/admin/adapters/customization-base.js index d1087e70199..272103ee8a8 100644 --- a/app/assets/javascripts/admin/adapters/customization-base.js +++ b/app/assets/javascripts/admin/adapters/customization-base.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ basePath() { return "/admin/customize/"; - } + }, }); diff --git a/app/assets/javascripts/admin/adapters/email-style.js b/app/assets/javascripts/admin/adapters/email-style.js index c9f3865d4c3..12919f04b0d 100644 --- a/app/assets/javascripts/admin/adapters/email-style.js +++ b/app/assets/javascripts/admin/adapters/email-style.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ pathFor() { return "/admin/customize/email_style"; - } + }, }); diff --git a/app/assets/javascripts/admin/adapters/embedding.js b/app/assets/javascripts/admin/adapters/embedding.js index c1d5eceace8..ba3fb816b80 100644 --- a/app/assets/javascripts/admin/adapters/embedding.js +++ b/app/assets/javascripts/admin/adapters/embedding.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ pathFor() { return "/admin/customize/embedding"; - } + }, }); diff --git a/app/assets/javascripts/admin/adapters/staff-action-log.js b/app/assets/javascripts/admin/adapters/staff-action-log.js index 8e0f087c2be..d281f9746be 100644 --- a/app/assets/javascripts/admin/adapters/staff-action-log.js +++ b/app/assets/javascripts/admin/adapters/staff-action-log.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ basePath() { return "/admin/logs/"; - } + }, }); diff --git a/app/assets/javascripts/admin/adapters/tag-group.js b/app/assets/javascripts/admin/adapters/tag-group.js index 2e950aa2c12..4c12654d967 100644 --- a/app/assets/javascripts/admin/adapters/tag-group.js +++ b/app/assets/javascripts/admin/adapters/tag-group.js @@ -1,5 +1,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ - jsonMode: true + jsonMode: true, }); diff --git a/app/assets/javascripts/admin/adapters/theme.js b/app/assets/javascripts/admin/adapters/theme.js index 8609df240bd..cf34ab42f5f 100644 --- a/app/assets/javascripts/admin/adapters/theme.js +++ b/app/assets/javascripts/admin/adapters/theme.js @@ -7,20 +7,20 @@ export default RestAdapter.extend({ afterFindAll(results) { let map = {}; - results.forEach(theme => { + results.forEach((theme) => { map[theme.id] = theme; }); - results.forEach(theme => { + results.forEach((theme) => { let mapped = theme.get("child_themes") || []; - mapped = mapped.map(t => map[t.id]); + mapped = mapped.map((t) => map[t.id]); theme.set("childThemes", mapped); let mappedParents = theme.get("parent_themes") || []; - mappedParents = mappedParents.map(t => map[t.id]); + mappedParents = mappedParents.map((t) => map[t.id]); theme.set("parentThemes", mappedParents); }); return results; }, - jsonMode: true + jsonMode: true, }); diff --git a/app/assets/javascripts/admin/adapters/web-hook-event.js b/app/assets/javascripts/admin/adapters/web-hook-event.js index 4c80ac3ff0c..1acd38386ba 100644 --- a/app/assets/javascripts/admin/adapters/web-hook-event.js +++ b/app/assets/javascripts/admin/adapters/web-hook-event.js @@ -3,5 +3,5 @@ import RESTAdapter from "discourse/adapters/rest"; export default RESTAdapter.extend({ basePath() { return "/admin/api/"; - } + }, }); diff --git a/app/assets/javascripts/admin/adapters/web-hook.js b/app/assets/javascripts/admin/adapters/web-hook.js index 4c80ac3ff0c..1acd38386ba 100644 --- a/app/assets/javascripts/admin/adapters/web-hook.js +++ b/app/assets/javascripts/admin/adapters/web-hook.js @@ -3,5 +3,5 @@ import RESTAdapter from "discourse/adapters/rest"; export default RESTAdapter.extend({ basePath() { return "/admin/api/"; - } + }, }); diff --git a/app/assets/javascripts/admin/components/ace-editor.js b/app/assets/javascripts/admin/components/ace-editor.js index a67d8139654..fe1db1645cb 100644 --- a/app/assets/javascripts/admin/components/ace-editor.js +++ b/app/assets/javascripts/admin/components/ace-editor.js @@ -37,7 +37,7 @@ export default Component.extend({ placeholderChanged() { if (this._editor) { this._editor.setOptions({ - placeholder: this.placeholder + placeholder: this.placeholder, }); } }, @@ -54,13 +54,13 @@ export default Component.extend({ editor.setOptions({ readOnly: disabled, highlightActiveLine: !disabled, - highlightGutterLine: !disabled + highlightGutterLine: !disabled, }); editor.container.parentNode.setAttribute("data-disabled", disabled); } }, - _destroyEditor: on("willDestroyElement", function() { + _destroyEditor: on("willDestroyElement", function () { if (this._editor) { this._editor.destroy(); this._editor = null; @@ -82,7 +82,7 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); loadScript("/javascripts/ace/ace.js?v=1.4.12").then(() => { - window.ace.require(["ace/ace"], loadedAce => { + window.ace.require(["ace/ace"], (loadedAce) => { loadedAce.config.set("loadWorkerFromBlob", false); loadedAce.config.set("workerPath", getURL("/javascripts/ace")); // Do not use CDN for workers @@ -129,6 +129,6 @@ export default Component.extend({ this._editor.focus(); this._editor.navigateFileEnd(); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-backups-logs.js b/app/assets/javascripts/admin/components/admin-backups-logs.js index 76c8cff1ac5..2531a521162 100644 --- a/app/assets/javascripts/admin/components/admin-backups-logs.js +++ b/app/assets/javascripts/admin/components/admin-backups-logs.js @@ -35,7 +35,7 @@ export default Component.extend({ @on("init") @observes("logs.[]") - _updateFormattedLogs: discourseDebounce(function() { + _updateFormattedLogs: discourseDebounce(function () { const logs = this.logs; if (logs.length === 0) return; @@ -49,7 +49,7 @@ export default Component.extend({ // update the formatted logs & cache index this.setProperties({ formattedLogs: formattedLogs, - index: logs.length + index: logs.length, }); // force rerender this.renderLogs(); @@ -70,5 +70,5 @@ export default Component.extend({ } else { this.set("showLoadingSpinner", false); } - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-editable-field.js b/app/assets/javascripts/admin/components/admin-editable-field.js index f2785cffd4e..993a3ed6752 100644 --- a/app/assets/javascripts/admin/components/admin-editable-field.js +++ b/app/assets/javascripts/admin/components/admin-editable-field.js @@ -19,6 +19,6 @@ export default Component.extend({ save() { // Action has to toggle 'editing' property. this.action(this.buffer); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-form-row.js b/app/assets/javascripts/admin/components/admin-form-row.js index b5f78c2a219..6217c6b913f 100644 --- a/app/assets/javascripts/admin/components/admin-form-row.js +++ b/app/assets/javascripts/admin/components/admin-form-row.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - classNames: ["row"] + classNames: ["row"], }); diff --git a/app/assets/javascripts/admin/components/admin-graph.js b/app/assets/javascripts/admin/components/admin-graph.js index be2e0f4e1af..bee93aa1c51 100644 --- a/app/assets/javascripts/admin/components/admin-graph.js +++ b/app/assets/javascripts/admin/components/admin-graph.js @@ -11,15 +11,15 @@ export default Component.extend({ const rawData = this.get("model.data"); var data = { - labels: rawData.map(r => r.x), + labels: rawData.map((r) => r.x), datasets: [ { - data: rawData.map(r => r.y), + data: rawData.map((r) => r.y), label: model.get("title"), backgroundColor: `rgba(200,220,240,${this.type === "bar" ? 1 : 0.3})`, - borderColor: "#08C" - } - ] + borderColor: "#08C", + }, + ], }; const config = { @@ -29,21 +29,21 @@ export default Component.extend({ responsive: true, tooltips: { callbacks: { - title: context => - moment(context[0].xLabel, "YYYY-MM-DD").format("LL") - } + title: (context) => + moment(context[0].xLabel, "YYYY-MM-DD").format("LL"), + }, }, scales: { yAxes: [ { display: true, ticks: { - stepSize: 1 - } - } - ] - } - } + stepSize: 1, + }, + }, + ], + }, + }, }; this._chart = new window.Chart(ctx, config); @@ -53,5 +53,5 @@ export default Component.extend({ loadScript("/javascripts/Chart.min.js").then(() => this.refreshChart.apply(this) ); - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-nav.js b/app/assets/javascripts/admin/components/admin-nav.js index 89720fbbe80..0e6d50b17d4 100644 --- a/app/assets/javascripts/admin/components/admin-nav.js +++ b/app/assets/javascripts/admin/components/admin-nav.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "" + tagName: "", }); diff --git a/app/assets/javascripts/admin/components/admin-report-chart.js b/app/assets/javascripts/admin/components/admin-report-chart.js index 3232b03519d..632d76f2596 100644 --- a/app/assets/javascripts/admin/components/admin-report-chart.js +++ b/app/assets/javascripts/admin/components/admin-report-chart.js @@ -59,13 +59,13 @@ export default Component.extend({ model.get("prevChartData") || model.get("prev_data") ); - const labels = chartData.map(d => d.x); + const labels = chartData.map((d) => d.x); const data = { labels, datasets: [ { - data: chartData.map(d => Math.round(parseFloat(d.y))), + data: chartData.map((d) => Math.round(parseFloat(d.y))), backgroundColor: prevChartData.length ? "transparent" : model.secondary_color, @@ -73,19 +73,19 @@ export default Component.extend({ pointRadius: 3, borderWidth: 1, pointBackgroundColor: model.primary_color, - pointBorderColor: model.primary_color - } - ] + pointBorderColor: model.primary_color, + }, + ], }; if (prevChartData.length) { data.datasets.push({ - data: prevChartData.map(d => Math.round(parseFloat(d.y))), + data: prevChartData.map((d) => Math.round(parseFloat(d.y))), borderColor: model.primary_color, borderDash: [5, 5], backgroundColor: "transparent", borderWidth: 1, - pointRadius: 0 + pointRadius: 0, }); } @@ -110,41 +110,41 @@ export default Component.extend({ options: { tooltips: { callbacks: { - title: tooltipItem => - moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL") - } + title: (tooltipItem) => + moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL"), + }, }, legend: { - display: false + display: false, }, responsive: true, maintainAspectRatio: false, responsiveAnimationDuration: 0, animation: { - duration: 0 + duration: 0, }, layout: { padding: { left: 0, top: 0, right: 0, - bottom: 0 - } + bottom: 0, + }, }, scales: { yAxes: [ { display: true, ticks: { - userCallback: label => { + userCallback: (label) => { if (Math.floor(label) === label) return label; }, - callback: label => number(label), + callback: (label) => number(label), sampleSize: 5, maxRotation: 25, - minRotation: 25 - } - } + minRotation: 25, + }, + }, ], xAxes: [ { @@ -152,17 +152,17 @@ export default Component.extend({ gridLines: { display: false }, type: "time", time: { - unit: this._unitForGrouping(options) + unit: this._unitForGrouping(options), }, ticks: { sampleSize: 5, maxRotation: 50, - minRotation: 50 - } - } - ] - } - } + minRotation: 50, + }, + }, + ], + }, + }, }; }, @@ -192,11 +192,11 @@ export default Component.extend({ const transformedData = [ { x: currentStart.format("YYYY-MM-DD"), - y: 0 - } + y: 0, + }, ]; - data.forEach(d => { + data.forEach((d) => { let date = moment(d.x, "YYYY-MM-DD"); if (!date.isBetween(currentStart, currentEnd)) { @@ -210,7 +210,7 @@ export default Component.extend({ } else { transformedData[currentIndex] = { x: d.x, - y: d.y + y: d.y, }; } }); @@ -231,5 +231,5 @@ export default Component.extend({ default: return "day"; } - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-report-counters.js b/app/assets/javascripts/admin/components/admin-report-counters.js index a66a3804c26..c956b93e359 100644 --- a/app/assets/javascripts/admin/components/admin-report-counters.js +++ b/app/assets/javascripts/admin/components/admin-report-counters.js @@ -2,5 +2,5 @@ import Component from "@ember/component"; export default Component.extend({ classNames: ["admin-report-counters"], - attributeBindings: ["model.description:title"] + attributeBindings: ["model.description:title"], }); diff --git a/app/assets/javascripts/admin/components/admin-report-counts.js b/app/assets/javascripts/admin/components/admin-report-counts.js index 625dd669eef..6d3c0b398b1 100644 --- a/app/assets/javascripts/admin/components/admin-report-counts.js +++ b/app/assets/javascripts/admin/components/admin-report-counts.js @@ -7,5 +7,5 @@ export default Component.extend({ "report.type", /^(time_to_first_response|topics_with_no_response)$/ ), - classNameBindings: ["reverseColors"] + classNameBindings: ["reverseColors"], }); diff --git a/app/assets/javascripts/admin/components/admin-report-inline-table.js b/app/assets/javascripts/admin/components/admin-report-inline-table.js index 38b3d4595e5..753320cc31a 100644 --- a/app/assets/javascripts/admin/components/admin-report-inline-table.js +++ b/app/assets/javascripts/admin/components/admin-report-inline-table.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - classNames: ["admin-report-inline-table"] + classNames: ["admin-report-inline-table"], }); diff --git a/app/assets/javascripts/admin/components/admin-report-per-day-counts.js b/app/assets/javascripts/admin/components/admin-report-per-day-counts.js index b644dbab9f9..7f039c061e1 100644 --- a/app/assets/javascripts/admin/components/admin-report-per-day-counts.js +++ b/app/assets/javascripts/admin/components/admin-report-per-day-counts.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "tr" + tagName: "tr", }); diff --git a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js index 8980c93077f..4b46eec840c 100644 --- a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js +++ b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js @@ -56,14 +56,14 @@ export default Component.extend({ const data = { labels: chartData[0].data.mapBy("x"), - datasets: chartData.map(cd => { + datasets: chartData.map((cd) => { return { label: cd.label, stack: "pageviews-stack", - data: cd.data.map(d => Math.round(parseFloat(d.y))), - backgroundColor: cd.color + data: cd.data.map((d) => Math.round(parseFloat(d.y))), + backgroundColor: cd.color, }; - }) + }), }; loadScript("/javascripts/Chart.min.js").then(() => { @@ -83,30 +83,30 @@ export default Component.extend({ responsiveAnimationDuration: 0, hover: { mode: "index" }, animation: { - duration: 0 + duration: 0, }, tooltips: { mode: "index", intersect: false, callbacks: { - beforeFooter: tooltipItem => { + beforeFooter: (tooltipItem) => { let total = 0; tooltipItem.forEach( - item => (total += parseInt(item.yLabel || 0, 10)) + (item) => (total += parseInt(item.yLabel || 0, 10)) ); return `= ${total}`; }, - title: tooltipItem => - moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL") - } + title: (tooltipItem) => + moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL"), + }, }, layout: { padding: { left: 0, top: 0, right: 0, - bottom: 0 - } + bottom: 0, + }, }, scales: { yAxes: [ @@ -114,15 +114,15 @@ export default Component.extend({ stacked: true, display: true, ticks: { - userCallback: label => { + userCallback: (label) => { if (Math.floor(label) === label) return label; }, - callback: label => number(label), + callback: (label) => number(label), sampleSize: 5, maxRotation: 25, - minRotation: 25 - } - } + minRotation: 25, + }, + }, ], xAxes: [ { @@ -132,17 +132,17 @@ export default Component.extend({ offset: true, time: { parser: "YYYY-MM-DD", - minUnit: "day" + minUnit: "day", }, ticks: { sampleSize: 5, maxRotation: 50, - minRotation: 50 - } - } - ] - } - } + minRotation: 50, + }, + }, + ], + }, + }, }; }, @@ -151,5 +151,5 @@ export default Component.extend({ this._chart.destroy(); this._chart = null; } - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-report-storage-stats.js b/app/assets/javascripts/admin/components/admin-report-storage-stats.js index 0be72566909..b41304ec34a 100644 --- a/app/assets/javascripts/admin/components/admin-report-storage-stats.js +++ b/app/assets/javascripts/admin/components/admin-report-storage-stats.js @@ -39,5 +39,5 @@ export default Component.extend({ @discourseComputed("uploadStats.free_bytes") freeUploadSpace(bytes) { return I18n.toHumanSize(bytes); - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-report-table-cell.js b/app/assets/javascripts/admin/components/admin-report-table-cell.js index e7bf688f2f4..967370ab8e6 100644 --- a/app/assets/javascripts/admin/components/admin-report-table-cell.js +++ b/app/assets/javascripts/admin/components/admin-report-table-cell.js @@ -16,5 +16,5 @@ export default Component.extend({ type: alias("label.type"), property: alias("label.mainProperty"), formatedValue: alias("computedLabel.formatedValue"), - value: alias("computedLabel.value") + value: alias("computedLabel.value"), }); diff --git a/app/assets/javascripts/admin/components/admin-report-table-header.js b/app/assets/javascripts/admin/components/admin-report-table-header.js index bc5633b21d5..f7c91dcab67 100644 --- a/app/assets/javascripts/admin/components/admin-report-table-header.js +++ b/app/assets/javascripts/admin/components/admin-report-table-header.js @@ -15,5 +15,5 @@ export default Component.extend({ @discourseComputed("currentSortDirection") sortIcon(currentSortDirection) { return currentSortDirection === 1 ? "caret-up" : "caret-down"; - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-report-table-row.js b/app/assets/javascripts/admin/components/admin-report-table-row.js index c86f586a082..ff34cb94e8b 100644 --- a/app/assets/javascripts/admin/components/admin-report-table-row.js +++ b/app/assets/javascripts/admin/components/admin-report-table-row.js @@ -2,5 +2,5 @@ import Component from "@ember/component"; export default Component.extend({ tagName: "tr", classNames: ["admin-report-table-row"], - options: null + options: null, }); diff --git a/app/assets/javascripts/admin/components/admin-report-table.js b/app/assets/javascripts/admin/components/admin-report-table.js index aa636224d46..d5c76b23a9d 100644 --- a/app/assets/javascripts/admin/components/admin-report-table.js +++ b/app/assets/javascripts/admin/components/admin-report-table.js @@ -26,7 +26,7 @@ export default Component.extend({ showTotalForSample(totalsForSample, total, datesFiltering) { // check if we have at least one cell which contains a value const sum = totalsForSample - .map(t => t.value) + .map((t) => t.value) .compact() .reduce((s, v) => s + v, 0); @@ -64,7 +64,7 @@ export default Component.extend({ @discourseComputed("totalsForSampleRow", "model.computedLabels") totalsForSample(row, labels) { - return labels.map(label => { + return labels.map((label) => { const computedLabel = label.compute(row); computedLabel.type = label.type; computedLabel.property = label.mainProperty; @@ -78,7 +78,7 @@ export default Component.extend({ let totalsRow = {}; - labels.forEach(label => { + labels.forEach((label) => { const reducer = (sum, row) => { const computedLabel = label.compute(row); const value = computedLabel.value; @@ -137,11 +137,11 @@ export default Component.extend({ pagesIndexes.push(i); } - let pages = pagesIndexes.map(v => { + let pages = pagesIndexes.map((v) => { return { page: v + 1, index: v, - class: v === page ? "is-current" : null + class: v === page ? "is-current" : null, }; }); @@ -165,6 +165,6 @@ export default Component.extend({ } else { this.set("sortLabel", label); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-report-trust-level-counts.js b/app/assets/javascripts/admin/components/admin-report-trust-level-counts.js index b644dbab9f9..7f039c061e1 100644 --- a/app/assets/javascripts/admin/components/admin-report-trust-level-counts.js +++ b/app/assets/javascripts/admin/components/admin-report-trust-level-counts.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "tr" + tagName: "tr", }); diff --git a/app/assets/javascripts/admin/components/admin-report.js b/app/assets/javascripts/admin/components/admin-report.js index aac884dd80f..cafa605230d 100644 --- a/app/assets/javascripts/admin/components/admin-report.js +++ b/app/assets/javascripts/admin/components/admin-report.js @@ -16,7 +16,7 @@ const TABLE_OPTIONS = { perPage: 8, total: true, limit: 20, - formatNumbers: true + formatNumbers: true, }; const CHART_OPTIONS = {}; @@ -46,7 +46,7 @@ export default Component.extend({ "isVisible", "isEnabled", "isLoading", - "dasherizedDataSourceName" + "dasherizedDataSourceName", ], classNames: ["admin-report"], isEnabled: true, @@ -75,14 +75,14 @@ export default Component.extend({ this._reports = []; }, - isHidden: computed("siteSettings.dashboard_hidden_reports", function() { + isHidden: computed("siteSettings.dashboard_hidden_reports", function () { return (this.siteSettings.dashboard_hidden_reports || "") .split("|") .filter(Boolean) .includes(this.dataSourceName); }), - startDate: computed("filters.startDate", function() { + startDate: computed("filters.startDate", function () { if (this.filters && isPresent(this.filters.startDate)) { return moment(this.filters.startDate, "YYYY-MM-DD"); } else { @@ -90,7 +90,7 @@ export default Component.extend({ } }), - endDate: computed("filters.endDate", function() { + endDate: computed("filters.endDate", function () { if (this.filters && isPresent(this.filters.endDate)) { return moment(this.filters.endDate, "YYYY-MM-DD"); } else { @@ -139,7 +139,7 @@ export default Component.extend({ @action changeGrouping(grouping) { this.send("refreshReport", { - chartGrouping: grouping + chartGrouping: grouping, }); }, @@ -147,14 +147,14 @@ export default Component.extend({ displayedModes(currentMode, reportModes, forcedModes) { const modes = forcedModes ? forcedModes.split(",") : reportModes; - return makeArray(modes).map(mode => { + return makeArray(modes).map((mode) => { const base = `btn-default mode-btn ${mode}`; const cssClass = currentMode === mode ? `${base} is-current` : base; return { mode, cssClass, - icon: mode === "table" ? "table" : "signal" + icon: mode === "table" ? "table" : "signal", }; }); }, @@ -187,10 +187,10 @@ export default Component.extend({ customFilters ? JSON.stringify(customFilters, (k, v) => (k ? `${v}` : v)) : null, - SCHEMA_VERSION + SCHEMA_VERSION, ] - .filter(x => x) - .map(x => x.toString()) + .filter((x) => x) + .map((x) => x.toString()) .join(":"); return reportKey; @@ -200,11 +200,11 @@ export default Component.extend({ chartGroupings(chartGrouping) { chartGrouping = chartGrouping || "daily"; - return ["daily", "weekly", "monthly"].map(id => { + return ["daily", "weekly", "monthly"].map((id) => { return { id, label: `admin.dashboard.reports.${id}`, - class: `chart-grouping ${chartGrouping === id ? "active" : "inactive"}` + class: `chart-grouping ${chartGrouping === id ? "active" : "inactive"}`, }; }); }, @@ -213,7 +213,7 @@ export default Component.extend({ onChangeDateRange(range) { this.send("refreshReport", { startDate: range.from, - endDate: range.to + endDate: range.to, }); }, @@ -228,7 +228,7 @@ export default Component.extend({ } this.send("refreshReport", { - filters: customFilters + filters: customFilters, }); }, @@ -250,7 +250,7 @@ export default Component.extend({ filters: typeof options.filters === "undefined" ? this.get("filters.customFilters") - : options.filters + : options.filters, }); }, @@ -259,7 +259,7 @@ export default Component.extend({ const args = { name: this.get("model.type"), start_date: this.startDate.toISOString(true).split("T")[0], - end_date: this.endDate.toISOString(true).split("T")[0] + end_date: this.endDate.toISOString(true).split("T")[0], }; const customFilters = this.get("filters.customFilters"); @@ -275,7 +275,7 @@ export default Component.extend({ this.set("currentMode", mode); this.send("refreshReport", { - chartGrouping: null + chartGrouping: null, }); }, @@ -295,7 +295,7 @@ export default Component.extend({ let filteredReports = this._reports.uniqBy("report_key"); let report; - const sort = r => { + const sort = (r) => { if (r.length > 1) { return r.findBy("type", this.dataSourceName); } else { @@ -307,7 +307,7 @@ export default Component.extend({ report = sort(filteredReports)[0]; } else { report = sort( - filteredReports.filter(r => r.report_key.includes(this.reportKey)) + filteredReports.filter((r) => r.report_key.includes(this.reportKey)) )[0]; if (!report) return; @@ -327,7 +327,7 @@ export default Component.extend({ this.setProperties({ model: report, currentMode, - options: this._buildOptions(currentMode) + options: this._buildOptions(currentMode), }); }, @@ -339,7 +339,7 @@ export default Component.extend({ next(() => { let payload = this._buildPayload(["prev_period"]); - const callback = response => { + const callback = (response) => { if (!this.element || this.isDestroying || this.isDestroyed) { return; } @@ -399,7 +399,7 @@ export default Component.extend({ const chartOptions = JSON.parse(JSON.stringify(CHART_OPTIONS)); return EmberObject.create( Object.assign(chartOptions, this.get("reportOptions.chart") || {}, { - chartGrouping: this.get("reportOptions.chartGrouping") + chartGrouping: this.get("reportOptions.chartGrouping"), }) ); } @@ -409,13 +409,13 @@ export default Component.extend({ Report.fillMissingDates(jsonReport, { filledField: "chartData" }); if (jsonReport.chartData && jsonReport.modes[0] === "stacked_chart") { - jsonReport.chartData = jsonReport.chartData.map(chartData => { + jsonReport.chartData = jsonReport.chartData.map((chartData) => { if (chartData.length > 40) { return { data: collapseWeekly(chartData.data), req: chartData.req, label: chartData.label, - color: chartData.color + color: chartData.color, }; } else { return chartData; @@ -433,7 +433,7 @@ export default Component.extend({ filledField: "prevChartData", dataField: "prev_data", starDate: jsonReport.prev_startDate, - endDate: jsonReport.prev_endDate + endDate: jsonReport.prev_endDate, }); if (jsonReport.prevChartData && jsonReport.prevChartData.length > 40) { @@ -445,5 +445,5 @@ export default Component.extend({ } return Report.create(jsonReport); - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-theme-editor.js b/app/assets/javascripts/admin/components/admin-theme-editor.js index 0ae1d1491b0..4c5eca33cfd 100644 --- a/app/assets/javascripts/admin/components/admin-theme-editor.js +++ b/app/assets/javascripts/admin/components/admin-theme-editor.js @@ -7,7 +7,7 @@ import { fmt } from "discourse/lib/computed"; export default Component.extend({ @discourseComputed("theme.targets", "onlyOverridden", "showAdvanced") visibleTargets(targets, onlyOverridden, showAdvanced) { - return targets.filter(target => { + return targets.filter((target) => { if (target.advanced && !showAdvanced) { return false; } @@ -22,7 +22,7 @@ export default Component.extend({ visibleFields(targetName, onlyOverridden, fields) { fields = fields[targetName]; if (onlyOverridden) { - fields = fields.filter(field => field.edited); + fields = fields.filter((field) => field.edited); } return fields; }, @@ -50,7 +50,7 @@ export default Component.extend({ set(value, fieldName, target, model) { model.setField(target, fieldName, value); return value; - } + }, }, editorId: fmt("fieldName", "currentTargetName", "%@|%@"), @@ -62,7 +62,7 @@ export default Component.extend({ @discourseComputed("currentTargetName", "theme.targets") showAddField(currentTargetName, targets) { - return targets.find(t => t.name === currentTargetName).customNames; + return targets.find((t) => t.name === currentTargetName).customNames; }, @discourseComputed( @@ -95,13 +95,13 @@ export default Component.extend({ this.fieldAdded(this.currentTargetName, name); }, - toggleMaximize: function() { + toggleMaximize: function () { this.toggleProperty("maximized"); next(() => this.appEvents.trigger("ace:resize")); }, onlyOverriddenChanged(value) { this.onlyOverriddenChanged(value); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-user-field-item.js b/app/assets/javascripts/admin/components/admin-user-field-item.js index d59abe44372..999a07db583 100644 --- a/app/assets/javascripts/admin/components/admin-user-field-item.js +++ b/app/assets/javascripts/admin/components/admin-user-field-item.js @@ -10,7 +10,7 @@ import { propertyEqual } from "discourse/lib/computed"; import { i18n } from "discourse/lib/computed"; import discourseComputed, { observes, - on + on, } from "discourse-common/utils/decorators"; export default Component.extend(bufferedProperty("userField"), { @@ -103,6 +103,6 @@ export default Component.extend(bufferedProperty("userField"), { this.rollbackBuffer(); this.set("editing", false); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-watched-word.js b/app/assets/javascripts/admin/components/admin-watched-word.js index fddad89cb3a..061c83d56a8 100644 --- a/app/assets/javascripts/admin/components/admin-watched-word.js +++ b/app/assets/javascripts/admin/components/admin-watched-word.js @@ -19,12 +19,12 @@ export default Component.extend({ .then(() => { this.action(this.word); }) - .catch(e => { + .catch((e) => { bootbox.alert( I18n.t("generic_error_with_reason", { - error: `http: ${e.status} - ${e.body}` + error: `http: ${e.status} - ${e.body}`, }) ); }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js b/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js index 7e76d8f6bd5..98e39518bf6 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js +++ b/app/assets/javascripts/admin/components/admin-web-hook-event-chooser.js @@ -19,7 +19,7 @@ export default Component.extend({ @discourseComputed("model.[]", "typeName") eventTypeExists(eventTypes, typeName) { - return eventTypes.any(event => event.name === typeName); + return eventTypes.any((event) => event.name === typeName); }, @discourseComputed("eventTypeExists") @@ -36,12 +36,12 @@ export default Component.extend({ model.addObject(type); } else { model.removeObjects( - model.filter(eventType => eventType.name === type.name) + model.filter((eventType) => eventType.name === type.name) ); } } return value; - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event.js b/app/assets/javascripts/admin/components/admin-web-hook-event.js index 49d689d8304..20f889037cf 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-event.js +++ b/app/assets/javascripts/admin/components/admin-web-hook-event.js @@ -54,7 +54,7 @@ export default Component.extend({ I18n.t("admin.web_hooks.events.redeliver_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { ajax( `/admin/api/web_hooks/${this.get( @@ -62,7 +62,7 @@ export default Component.extend({ )}/events/${this.get("model.id")}/redeliver`, { type: "POST" } ) - .then(json => { + .then((json) => { this.set("model", json.web_hook_event); }) .catch(popupAjaxError); @@ -78,7 +78,7 @@ export default Component.extend({ let headers = Object.assign( { "Request URL": this.get("model.request_url"), - "Request method": "POST" + "Request method": "POST", }, ensureJSON(this.get("model.headers")) ); @@ -86,7 +86,7 @@ export default Component.extend({ headers: plainJSON(headers), body: prettyJSON(this.get("model.payload")), expandDetails: expandDetailsKey, - bodyLabel: I18n.t("admin.web_hooks.events.payload") + bodyLabel: I18n.t("admin.web_hooks.events.payload"), }); } else { this.set("expandDetails", null); @@ -101,11 +101,11 @@ export default Component.extend({ headers: plainJSON(this.get("model.response_headers")), body: this.get("model.response_body"), expandDetails: expandDetailsKey, - bodyLabel: I18n.t("admin.web_hooks.events.body") + bodyLabel: I18n.t("admin.web_hooks.events.body"), }); } else { this.set("expandDetails", null); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/admin-web-hook-status.js b/app/assets/javascripts/admin/components/admin-web-hook-status.js index 6c1591bc4c4..818970f1256 100644 --- a/app/assets/javascripts/admin/components/admin-web-hook-status.js +++ b/app/assets/javascripts/admin/components/admin-web-hook-status.js @@ -11,7 +11,7 @@ export default Component.extend({ @discourseComputed("deliveryStatuses", "model.last_delivery_status") status(deliveryStatuses, lastDeliveryStatus) { - return deliveryStatuses.find(s => s.id === lastDeliveryStatus); + return deliveryStatuses.find((s) => s.id === lastDeliveryStatus); }, @discourseComputed("status.id", "icons") @@ -34,5 +34,5 @@ export default Component.extend({ "deliveryStatus", I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`) ); - } + }, }); diff --git a/app/assets/javascripts/admin/components/admin-wrapper.js b/app/assets/javascripts/admin/components/admin-wrapper.js index b60ac12855a..5b907c9a04c 100644 --- a/app/assets/javascripts/admin/components/admin-wrapper.js +++ b/app/assets/javascripts/admin/components/admin-wrapper.js @@ -8,5 +8,5 @@ export default Component.extend({ willDestroyElement() { this._super(...arguments); $("body").removeClass("admin-interface"); - } + }, }); diff --git a/app/assets/javascripts/admin/components/cancel-link.js b/app/assets/javascripts/admin/components/cancel-link.js index 89720fbbe80..0e6d50b17d4 100644 --- a/app/assets/javascripts/admin/components/cancel-link.js +++ b/app/assets/javascripts/admin/components/cancel-link.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "" + tagName: "", }); diff --git a/app/assets/javascripts/admin/components/color-input.js b/app/assets/javascripts/admin/components/color-input.js index d1b6102c610..3d7dad5e008 100644 --- a/app/assets/javascripts/admin/components/color-input.js +++ b/app/assets/javascripts/admin/components/color-input.js @@ -18,7 +18,7 @@ export default Component.extend({ styleSelection: true, - maxlength: computed("onlyHex", function() { + maxlength: computed("onlyHex", function () { return this.onlyHex ? 6 : null; }), @@ -28,7 +28,7 @@ export default Component.extend({ }, @observes("hexValue", "brightnessValue", "valid") - hexValueChanged: function() { + hexValueChanged: function () { const hex = this.hexValue; let text = this.element.querySelector("input.hex-input"); @@ -47,7 +47,7 @@ export default Component.extend({ if (this.pickerLoaded) { $(this.element.querySelector(".picker")).spectrum({ - color: "#" + hex + color: "#" + hex, }); } } else { @@ -69,5 +69,5 @@ export default Component.extend({ }); }); schedule("afterRender", () => this.hexValueChanged()); - } + }, }); diff --git a/app/assets/javascripts/admin/components/email-styles-editor.js b/app/assets/javascripts/admin/components/email-styles-editor.js index 35595709914..c40f8a543ed 100644 --- a/app/assets/javascripts/admin/components/email-styles-editor.js +++ b/app/assets/javascripts/admin/components/email-styles-editor.js @@ -28,18 +28,18 @@ export default Component.extend({ set(value, styles, fieldName) { styles.setField(fieldName, value); return value; - } + }, }, actions: { reset() { bootbox.confirm( I18n.t("admin.customize.email_style.reset_confirm", { - fieldName: I18n.t(`admin.customize.email_style.${this.fieldName}`) + fieldName: I18n.t(`admin.customize.email_style.${this.fieldName}`), }), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { this.styles.setField( this.fieldName, @@ -49,6 +49,6 @@ export default Component.extend({ } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/embeddable-host.js b/app/assets/javascripts/admin/components/embeddable-host.js index bfb7d8d146c..3ca70289420 100644 --- a/app/assets/javascripts/admin/components/embeddable-host.js +++ b/app/assets/javascripts/admin/components/embeddable-host.js @@ -60,7 +60,7 @@ export default Component.extend(bufferedProperty("host"), { }, delete() { - bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => { + bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), (result) => { if (result) { this.host.destroyRecord().then(() => { this.deleteHost(this.host); @@ -77,6 +77,6 @@ export default Component.extend(bufferedProperty("host"), { this.rollbackBuffer(); this.set("editToggled", false); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/embedding-setting.js b/app/assets/javascripts/admin/components/embedding-setting.js index 517e37f4f98..8c1a187ac69 100644 --- a/app/assets/javascripts/admin/components/embedding-setting.js +++ b/app/assets/javascripts/admin/components/embedding-setting.js @@ -27,6 +27,6 @@ export default Component.extend({ set(value) { this.set("value", value); return value; - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/flag-user-lists.js b/app/assets/javascripts/admin/components/flag-user-lists.js index a6156a93ad4..8b886047689 100644 --- a/app/assets/javascripts/admin/components/flag-user-lists.js +++ b/app/assets/javascripts/admin/components/flag-user-lists.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - classNames: ["flag-user-lists"] + classNames: ["flag-user-lists"], }); diff --git a/app/assets/javascripts/admin/components/highlighted-code.js b/app/assets/javascripts/admin/components/highlighted-code.js index f458042335d..f5486db8d95 100644 --- a/app/assets/javascripts/admin/components/highlighted-code.js +++ b/app/assets/javascripts/admin/components/highlighted-code.js @@ -7,5 +7,5 @@ export default Component.extend({ @observes("code") _refresh() { highlightSyntax(this.element, this.siteSettings, this.session); - } + }, }); diff --git a/app/assets/javascripts/admin/components/inline-edit-checkbox.js b/app/assets/javascripts/admin/components/inline-edit-checkbox.js index 2d681202b9b..b99f7b4527d 100644 --- a/app/assets/javascripts/admin/components/inline-edit-checkbox.js +++ b/app/assets/javascripts/admin/components/inline-edit-checkbox.js @@ -37,6 +37,6 @@ export default Component.extend({ finished() { this.set("checked", this.checkedInternal); this.action(); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/install-theme-item.js b/app/assets/javascripts/admin/components/install-theme-item.js index 040760db01c..b8d8823109d 100644 --- a/app/assets/javascripts/admin/components/install-theme-item.js +++ b/app/assets/javascripts/admin/components/install-theme-item.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - classNames: ["install-theme-item"] + classNames: ["install-theme-item"], }); diff --git a/app/assets/javascripts/admin/components/ip-lookup.js b/app/assets/javascripts/admin/components/ip-lookup.js index 40979902215..db19cb25c34 100644 --- a/app/assets/javascripts/admin/components/ip-lookup.js +++ b/app/assets/javascripts/admin/components/ip-lookup.js @@ -24,7 +24,9 @@ export default Component.extend({ this.set("show", true); if (!this.location) { - ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(location => + ajax("/admin/users/ip-info", { + data: { ip: this.ip }, + }).then((location) => this.set("location", EmberObject.create(location)) ); } @@ -35,17 +37,17 @@ export default Component.extend({ const data = { ip: this.ip, exclude: this.userId, - order: "trust_level DESC" + order: "trust_level DESC", }; - ajax("/admin/users/total-others-with-same-ip", { data }).then(result => - this.set("totalOthersWithSameIP", result.total) - ); + ajax("/admin/users/total-others-with-same-ip", { + data, + }).then((result) => this.set("totalOthersWithSameIP", result.total)); - AdminUser.findAll("active", data).then(users => { + AdminUser.findAll("active", data).then((users) => { this.setProperties({ other_accounts: users, - otherAccountsLoading: false + otherAccountsLoading: false, }); }); } @@ -91,12 +93,12 @@ export default Component.extend({ I18n.t("ip_lookup.confirm_delete_other_accounts"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { this.setProperties({ other_accounts: null, otherAccountsLoading: true, - totalOthersWithSameIP: null + totalOthersWithSameIP: null, }); ajax("/admin/users/delete-others-with-same-ip.json", { @@ -104,12 +106,12 @@ export default Component.extend({ data: { ip: this.ip, exclude: this.userId, - order: "trust_level DESC" - } + order: "trust_level DESC", + }, }).then(() => this.send("lookup")); } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/moderation-history-item.js b/app/assets/javascripts/admin/components/moderation-history-item.js index b644dbab9f9..7f039c061e1 100644 --- a/app/assets/javascripts/admin/components/moderation-history-item.js +++ b/app/assets/javascripts/admin/components/moderation-history-item.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "tr" + tagName: "tr", }); diff --git a/app/assets/javascripts/admin/components/penalty-post-action.js b/app/assets/javascripts/admin/components/penalty-post-action.js index aeea3406c8b..2b34703fb0c 100644 --- a/app/assets/javascripts/admin/components/penalty-post-action.js +++ b/app/assets/javascripts/admin/components/penalty-post-action.js @@ -13,7 +13,7 @@ export default Component.extend({ @discourseComputed penaltyActions() { - return ACTIONS.map(id => { + return ACTIONS.map((id) => { return { id, name: I18n.t(`admin.user.penalty_post_${id}`) }; }); }, @@ -28,7 +28,7 @@ export default Component.extend({ if (postAction === "edit") { this._focusEditTextarea(); } - } + }, }, @afterRender @@ -37,5 +37,5 @@ export default Component.extend({ const body = elem.closest(".modal-body"); body.scrollTo(0, body.clientHeight); elem.querySelector(".post-editor").focus(); - } + }, }); diff --git a/app/assets/javascripts/admin/components/permalink-form.js b/app/assets/javascripts/admin/components/permalink-form.js index 61a1e963d15..b7238f57005 100644 --- a/app/assets/javascripts/admin/components/permalink-form.js +++ b/app/assets/javascripts/admin/components/permalink-form.js @@ -19,7 +19,7 @@ export default Component.extend({ { id: "post_id", name: I18n.t("admin.permalink.post_id") }, { id: "category_id", name: I18n.t("admin.permalink.category_id") }, { id: "tag_name", name: I18n.t("admin.permalink.tag_name") }, - { id: "external_url", name: I18n.t("admin.permalink.external_url") } + { id: "external_url", name: I18n.t("admin.permalink.external_url") }, ]; }, @@ -27,7 +27,7 @@ export default Component.extend({ this._super(...arguments); schedule("afterRender", () => { - $(this.element.querySelector(".external-url")).keydown(e => { + $(this.element.querySelector(".external-url")).keydown((e) => { // enter key if (e.keyCode === 13) { this.send("submit"); @@ -50,28 +50,28 @@ export default Component.extend({ Permalink.create({ url: this.url, permalink_type: this.permalinkType, - permalink_type_value: this.permalink_type_value + permalink_type_value: this.permalink_type_value, }) .save() .then( - result => { + (result) => { this.setProperties({ url: "", permalink_type_value: "", - formSubmitted: false + formSubmitted: false, }); this.action(Permalink.create(result.permalink)); this.focusPermalink(); }, - e => { + (e) => { this.set("formSubmitted", false); let error; if (e.responseJSON && e.responseJSON.errors) { error = I18n.t("generic_error_with_reason", { - error: e.responseJSON.errors.join(". ") + error: e.responseJSON.errors.join(". "), }); } else { error = I18n.t("generic_error"); @@ -84,6 +84,6 @@ export default Component.extend({ onChangePermalinkType(type) { this.set("permalinkType", type); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/report-filters/bool.js b/app/assets/javascripts/admin/components/report-filters/bool.js index 777e15cfe48..0a752c54e28 100644 --- a/app/assets/javascripts/admin/components/report-filters/bool.js +++ b/app/assets/javascripts/admin/components/report-filters/bool.js @@ -12,5 +12,5 @@ export default FilterComponent.extend({ @action onChange() { this.applyFilter(this.filter.id, !this.checked || undefined); - } + }, }); diff --git a/app/assets/javascripts/admin/components/report-filters/category.js b/app/assets/javascripts/admin/components/report-filters/category.js index 5a5ab52098f..4cbe9651934 100644 --- a/app/assets/javascripts/admin/components/report-filters/category.js +++ b/app/assets/javascripts/admin/components/report-filters/category.js @@ -8,5 +8,5 @@ export default FilterComponent.extend({ @action onChange(categoryId) { this.applyFilter(this.filter.id, categoryId || undefined); - } + }, }); diff --git a/app/assets/javascripts/admin/components/report-filters/filter.js b/app/assets/javascripts/admin/components/report-filters/filter.js index 0c4e0063463..e89fb383865 100644 --- a/app/assets/javascripts/admin/components/report-filters/filter.js +++ b/app/assets/javascripts/admin/components/report-filters/filter.js @@ -5,5 +5,5 @@ export default Component.extend({ @action onChange(value) { this.applyFilter(this.filter.id, value); - } + }, }); diff --git a/app/assets/javascripts/admin/components/report-filters/group.js b/app/assets/javascripts/admin/components/report-filters/group.js index e841800030f..5cf379332b2 100644 --- a/app/assets/javascripts/admin/components/report-filters/group.js +++ b/app/assets/javascripts/admin/components/report-filters/group.js @@ -6,7 +6,7 @@ export default FilterComponent.extend({ @computed get groupOptions() { - return (this.site.groups || []).map(group => { + return (this.site.groups || []).map((group) => { return { name: group["name"], value: group["id"] }; }); }, @@ -14,5 +14,5 @@ export default FilterComponent.extend({ @computed("filter.default") get groupId() { return this.filter.default ? parseInt(this.filter.default, 10) : null; - } + }, }); diff --git a/app/assets/javascripts/admin/components/resumable-upload.js b/app/assets/javascripts/admin/components/resumable-upload.js index 97b6f19875a..0afa189a1d7 100644 --- a/app/assets/javascripts/admin/components/resumable-upload.js +++ b/app/assets/javascripts/admin/components/resumable-upload.js @@ -36,8 +36,8 @@ export default Component.extend({ maxFiles: 1, // only 1 file at a time headers: { "X-CSRF-Token": document.querySelector("meta[name='csrf-token']") - .content - } + .content, + }, }); this.resumable.on("fileAdded", () => { @@ -51,7 +51,7 @@ export default Component.extend({ }); }); - this.resumable.on("fileProgress", file => { + this.resumable.on("fileProgress", (file) => { // update progress later(() => { this.set("progress", parseInt(file.progress() * 100, 10)); @@ -59,7 +59,7 @@ export default Component.extend({ }); }); - this.resumable.on("fileSuccess", file => { + this.resumable.on("fileSuccess", (file) => { later(() => { // mark as not uploading anymore this._reset(); @@ -136,5 +136,5 @@ export default Component.extend({ this.setProperties({ isUploading: false, progress: 0 }); this._updateIcon(); this._updateProgressBar(); - } + }, }); diff --git a/app/assets/javascripts/admin/components/screened-ip-address-form.js b/app/assets/javascripts/admin/components/screened-ip-address-form.js index 711fad2e8fa..86bcc962af4 100644 --- a/app/assets/javascripts/admin/components/screened-ip-address-form.js +++ b/app/assets/javascripts/admin/components/screened-ip-address-form.js @@ -30,20 +30,20 @@ export default Component.extend({ { id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") }, { id: "do_nothing", - name: I18n.t("admin.logs.screened_ips.actions.do_nothing") + name: I18n.t("admin.logs.screened_ips.actions.do_nothing"), }, { id: "allow_admin", - name: I18n.t("admin.logs.screened_ips.actions.allow_admin") - } + name: I18n.t("admin.logs.screened_ips.actions.allow_admin"), + }, ]; } else { return [ { id: "block", name: I18n.t("admin.logs.screened_ips.actions.block") }, { id: "do_nothing", - name: I18n.t("admin.logs.screened_ips.actions.do_nothing") - } + name: I18n.t("admin.logs.screened_ips.actions.do_nothing"), + }, ]; } }, @@ -54,23 +54,23 @@ export default Component.extend({ this.set("formSubmitted", true); const screenedIpAddress = ScreenedIpAddress.create({ ip_address: this.ip_address, - action_name: this.actionName + action_name: this.actionName, }); screenedIpAddress .save() - .then(result => { + .then((result) => { this.setProperties({ ip_address: "", formSubmitted: false }); this.action(ScreenedIpAddress.create(result.screened_ip_address)); schedule("afterRender", () => this.element.querySelector(".ip-address-input").focus() ); }) - .catch(e => { + .catch((e) => { this.set("formSubmitted", false); const msg = e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors ? I18n.t("generic_error_with_reason", { - error: e.jqXHR.responseJSON.errors.join(". ") + error: e.jqXHR.responseJSON.errors.join(". "), }) : I18n.t("generic_error"); bootbox.alert(msg, () => @@ -78,17 +78,17 @@ export default Component.extend({ ); }); } - } + }, }, @on("didInsertElement") _init() { schedule("afterRender", () => { - $(this.element.querySelector(".ip-address-input")).keydown(e => { + $(this.element.querySelector(".ip-address-input")).keydown((e) => { if (e.keyCode === 13) { this.send("submit"); } }); }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/secret-value-list.js b/app/assets/javascripts/admin/components/secret-value-list.js index 399ec5c6e78..b773336bdc6 100644 --- a/app/assets/javascripts/admin/components/secret-value-list.js +++ b/app/assets/javascripts/admin/components/secret-value-list.js @@ -40,7 +40,7 @@ export default Component.extend({ removeValue(value) { this._removeValue(value); - } + }, }, _checkInvalidInput(inputs) { @@ -78,7 +78,7 @@ export default Component.extend({ this.set( "values", this.collection - .map(function(elem) { + .map(function (elem) { return `${elem.key}|${elem.secret}`; }) .join("\n") @@ -89,9 +89,9 @@ export default Component.extend({ if (values && values.length) { const keys = ["key", "secret"]; var res = []; - values.split(delimiter).forEach(function(str) { + values.split(delimiter).forEach(function (str) { var object = {}; - str.split("|").forEach(function(a, i) { + str.split("|").forEach(function (a, i) { object[keys[i]] = a; }); res.push(object); @@ -101,5 +101,5 @@ export default Component.extend({ } else { return []; } - } + }, }); diff --git a/app/assets/javascripts/admin/components/silence-details.js b/app/assets/javascripts/admin/components/silence-details.js index 89720fbbe80..0e6d50b17d4 100644 --- a/app/assets/javascripts/admin/components/silence-details.js +++ b/app/assets/javascripts/admin/components/silence-details.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "" + tagName: "", }); diff --git a/app/assets/javascripts/admin/components/simple-list.js b/app/assets/javascripts/admin/components/simple-list.js index 3f43885d77d..4158447c0fc 100644 --- a/app/assets/javascripts/admin/components/simple-list.js +++ b/app/assets/javascripts/admin/components/simple-list.js @@ -53,5 +53,5 @@ export default Component.extend({ return values && values.length ? values.split(delimiter || "\n").filter(Boolean) : []; - } + }, }); diff --git a/app/assets/javascripts/admin/components/site-setting.js b/app/assets/javascripts/admin/components/site-setting.js index cd768407ff1..af538f70115 100644 --- a/app/assets/javascripts/admin/components/site-setting.js +++ b/app/assets/javascripts/admin/components/site-setting.js @@ -9,7 +9,7 @@ export default Component.extend(BufferedContent, SettingComponent, { _save() { const setting = this.buffered; return SiteSetting.update(setting.get("setting"), setting.get("value"), { - updateExistingUsers: this.updateExistingUsers + updateExistingUsers: this.updateExistingUsers, }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings-image-uploader.js b/app/assets/javascripts/admin/components/site-settings-image-uploader.js index 4ebb3e8e13e..3e19fa8f033 100644 --- a/app/assets/javascripts/admin/components/site-settings-image-uploader.js +++ b/app/assets/javascripts/admin/components/site-settings-image-uploader.js @@ -2,5 +2,5 @@ import ImageUploader from "discourse/components/image-uploader"; export default ImageUploader.extend({ layoutName: "components/image-uploader", - uploadUrlParams: "&for_site_setting=true" + uploadUrlParams: "&for_site_setting=true", }); diff --git a/app/assets/javascripts/admin/components/site-settings/bool.js b/app/assets/javascripts/admin/components/site-settings/bool.js index 88f4387601e..a565648c6db 100644 --- a/app/assets/javascripts/admin/components/site-settings/bool.js +++ b/app/assets/javascripts/admin/components/site-settings/bool.js @@ -14,6 +14,6 @@ export default Component.extend({ set(value) { this.set("value", value ? "true" : "false"); return value; - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/category-list.js b/app/assets/javascripts/admin/components/site-settings/category-list.js index 24e9bb23b96..0369756c088 100644 --- a/app/assets/javascripts/admin/components/site-settings/category-list.js +++ b/app/assets/javascripts/admin/components/site-settings/category-list.js @@ -3,13 +3,13 @@ import Category from "discourse/models/category"; import { computed } from "@ember/object"; export default Component.extend({ - selectedCategories: computed("value", function() { + selectedCategories: computed("value", function () { return Category.findByIds(this.value.split("|").filter(Boolean)); }), actions: { onChangeSelectedCategories(value) { this.set("value", (value || []).mapBy("id").join("|")); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/color.js b/app/assets/javascripts/admin/components/site-settings/color.js index 5b7e40e34c4..5b81fa2f688 100644 --- a/app/assets/javascripts/admin/components/site-settings/color.js +++ b/app/assets/javascripts/admin/components/site-settings/color.js @@ -5,10 +5,7 @@ function RGBToHex(rgb) { // Choose correct separator let sep = rgb.indexOf(",") > -1 ? "," : " "; // Turn "rgb(r,g,b)" into [r,g,b] - rgb = rgb - .substr(4) - .split(")")[0] - .split(sep); + rgb = rgb.substr(4).split(")")[0].split(sep); let r = (+rgb[0]).toString(16), g = (+rgb[1]).toString(16), @@ -22,7 +19,7 @@ function RGBToHex(rgb) { } export default Component.extend({ - valid: computed("value", function() { + valid: computed("value", function () { let value = this.value.toLowerCase(); let testColor = new Option().style; @@ -45,5 +42,5 @@ export default Component.extend({ @action onChangeColor(color) { this.set("value", color); - } + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/compact-list.js b/app/assets/javascripts/admin/components/site-settings/compact-list.js index f68e78b5722..246d56066a9 100644 --- a/app/assets/javascripts/admin/components/site-settings/compact-list.js +++ b/app/assets/javascripts/admin/components/site-settings/compact-list.js @@ -7,24 +7,21 @@ export default Component.extend({ createdChoices: null, - settingValue: computed("value", function() { - return this.value - .toString() - .split(this.tokenSeparator) - .filter(Boolean); + settingValue: computed("value", function () { + return this.value.toString().split(this.tokenSeparator).filter(Boolean); }), settingChoices: computed( "settingValue", "setting.choices.[]", "createdChoices.[]", - function() { + function () { return [ ...new Set([ ...makeArray(this.settingValue), ...makeArray(this.setting.choices), - ...makeArray(this.createdChoices) - ]) + ...makeArray(this.createdChoices), + ]), ]; } ), @@ -36,8 +33,8 @@ export default Component.extend({ onChangeChoices(choices) { this.set("createdChoices", [ - ...new Set([...makeArray(this.createdChoices), ...makeArray(choices)]) + ...new Set([...makeArray(this.createdChoices), ...makeArray(choices)]), ]); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/group-list.js b/app/assets/javascripts/admin/components/site-settings/group-list.js index 41dcdbcb4d5..f7ea8945039 100644 --- a/app/assets/javascripts/admin/components/site-settings/group-list.js +++ b/app/assets/javascripts/admin/components/site-settings/group-list.js @@ -7,19 +7,19 @@ export default Component.extend({ nameProperty: "name", valueProperty: "id", - groupChoices: computed("site.groups", function() { - return (this.site.groups || []).map(g => { + groupChoices: computed("site.groups", function () { + return (this.site.groups || []).map((g) => { return { name: g.name, id: g.id.toString() }; }); }), - settingValue: computed("value", function() { + settingValue: computed("value", function () { return (this.value || "").split(this.tokenSeparator).filter(Boolean); }), actions: { onChangeGroupListSetting(value) { this.set("value", value.join(this.tokenSeparator)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/simple-list.js b/app/assets/javascripts/admin/components/site-settings/simple-list.js index aab078bbe3c..383dfeee421 100644 --- a/app/assets/javascripts/admin/components/site-settings/simple-list.js +++ b/app/assets/javascripts/admin/components/site-settings/simple-list.js @@ -7,5 +7,5 @@ export default Component.extend({ @action onChange(value) { this.set("value", value.join(this.inputDelimiter || "\n")); - } + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/tag-list.js b/app/assets/javascripts/admin/components/site-settings/tag-list.js index 011c734b7db..e5723668d73 100644 --- a/app/assets/javascripts/admin/components/site-settings/tag-list.js +++ b/app/assets/javascripts/admin/components/site-settings/tag-list.js @@ -7,11 +7,11 @@ export default Component.extend({ selectedTags: { get(value) { return value.split("|").filter(Boolean); - } + }, }, @action changeSelectedTags(tags) { this.set("value", tags.join("|")); - } + }, }); diff --git a/app/assets/javascripts/admin/components/site-settings/uploaded-image-list.js b/app/assets/javascripts/admin/components/site-settings/uploaded-image-list.js index 7e705321d04..d66b07e0e8c 100644 --- a/app/assets/javascripts/admin/components/site-settings/uploaded-image-list.js +++ b/app/assets/javascripts/admin/components/site-settings/uploaded-image-list.js @@ -7,10 +7,10 @@ export default Component.extend({ showModal("admin-uploaded-image-list", { admin: true, title: `admin.site_settings.${setting.setting}.title`, - model: { value, setting } + model: { value, setting }, }).setProperties({ - save: v => this.set("value", v) + save: (v) => this.set("value", v), }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/site-text-summary.js b/app/assets/javascripts/admin/components/site-text-summary.js index 23ee2d8aa6b..7a8c57c9b88 100644 --- a/app/assets/javascripts/admin/components/site-text-summary.js +++ b/app/assets/javascripts/admin/components/site-text-summary.js @@ -15,7 +15,7 @@ export default Component.extend({ this.element.querySelector(".site-text-id, .site-text-value"), term, { - className: "text-highlight" + className: "text-highlight", } ); } @@ -36,5 +36,5 @@ export default Component.extend({ } return this.term; - } + }, }); diff --git a/app/assets/javascripts/admin/components/staff-actions.js b/app/assets/javascripts/admin/components/staff-actions.js index fe650878781..a532c439c2e 100644 --- a/app/assets/javascripts/admin/components/staff-actions.js +++ b/app/assets/javascripts/admin/components/staff-actions.js @@ -14,10 +14,10 @@ export default Component.extend({ $(this.element).on( "click.discourse-staff-logs", "[data-link-post-id]", - e => { + (e) => { let postId = $(e.target).attr("data-link-post-id"); - this.store.find("post", postId).then(p => { + this.store.find("post", postId).then((p) => { DiscourseURL.routeTo(p.get("url")); }); return false; @@ -27,7 +27,7 @@ export default Component.extend({ $(this.element).on( "click.discourse-staff-logs", "[data-link-topic-id]", - e => { + (e) => { let topicId = $(e.target).attr("data-link-topic-id"); DiscourseURL.routeTo(`/t/${topicId}`); @@ -35,5 +35,5 @@ export default Component.extend({ return false; } ); - } + }, }); diff --git a/app/assets/javascripts/admin/components/suspension-details.js b/app/assets/javascripts/admin/components/suspension-details.js index 89720fbbe80..0e6d50b17d4 100644 --- a/app/assets/javascripts/admin/components/suspension-details.js +++ b/app/assets/javascripts/admin/components/suspension-details.js @@ -1,4 +1,4 @@ import Component from "@ember/component"; export default Component.extend({ - tagName: "" + tagName: "", }); diff --git a/app/assets/javascripts/admin/components/tags-uploader.js b/app/assets/javascripts/admin/components/tags-uploader.js index 8e0c60c4c5b..3c547adf8d5 100644 --- a/app/assets/javascripts/admin/components/tags-uploader.js +++ b/app/assets/javascripts/admin/components/tags-uploader.js @@ -19,5 +19,5 @@ export default Component.extend(UploadMixin, { this.refresh(); this.closeModal(); }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/theme-setting-editor.js b/app/assets/javascripts/admin/components/theme-setting-editor.js index ec87c4d84f3..cf87683ff7e 100644 --- a/app/assets/javascripts/admin/components/theme-setting-editor.js +++ b/app/assets/javascripts/admin/components/theme-setting-editor.js @@ -13,8 +13,8 @@ export default Component.extend(BufferedContent, SettingComponent, { type: "PUT", data: { name: this.setting.setting, - value: this.get("buffered.value") - } + value: this.get("buffered.value"), + }, }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/theme-setting-relatives-selector.js b/app/assets/javascripts/admin/components/theme-setting-relatives-selector.js index 8ba638076c8..b23760f6657 100644 --- a/app/assets/javascripts/admin/components/theme-setting-relatives-selector.js +++ b/app/assets/javascripts/admin/components/theme-setting-relatives-selector.js @@ -15,12 +15,13 @@ export default Component.extend(BufferedContent, SettingComponent, { return this.get("buffered.value") .split("|") .filter(Boolean) - .map(themeName => { + .map((themeName) => { if (themeName !== "") { - return this.setting.allThemes.find(theme => theme.name === themeName) - .id; + return this.setting.allThemes.find( + (theme) => theme.name === themeName + ).id; } return themeName; }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/theme-translation.js b/app/assets/javascripts/admin/components/theme-translation.js index 361df489afa..6174aeb4eb2 100644 --- a/app/assets/javascripts/admin/components/theme-translation.js +++ b/app/assets/javascripts/admin/components/theme-translation.js @@ -14,5 +14,5 @@ export default Component.extend(BufferedContent, SettingComponent, { this.get("translation.key"), this.get("buffered.value") ); - } + }, }); diff --git a/app/assets/javascripts/admin/components/themes-list-item.js b/app/assets/javascripts/admin/components/themes-list-item.js index 56db74e7e8e..d8af9eabc7e 100644 --- a/app/assets/javascripts/admin/components/themes-list-item.js +++ b/app/assets/javascripts/admin/components/themes-list-item.js @@ -67,7 +67,7 @@ export default Component.extend({ children = this.childrenExpanded ? children : children.slice(0, MAX_COMPONENTS); - return children.map(t => { + return children.map((t) => { const name = escape(t.name); return t.enabled ? name : `${iconHTML("ban")} ${name}`; }); @@ -96,22 +96,22 @@ export default Component.extend({ $list.css("display", ""); $container.animate( { - height: `${$container.height() + $list.outerHeight(true)}px` + height: `${$container.height() + $list.outerHeight(true)}px`, }, { duration, done: () => { $list.css("display", ""); $container.css("height", ""); - } + }, } ); $list.animate( { - opacity: 1 + opacity: 1, }, { - duration + duration, } ); }, @@ -119,22 +119,22 @@ export default Component.extend({ collapseComponentsList($container, $list, duration) { $container.animate( { - height: `${$container.height() - $list.outerHeight(true)}px` + height: `${$container.height() - $list.outerHeight(true)}px`, }, { duration, done: () => { $list.css("display", "none"); $container.css("height", ""); - } + }, } ); $list.animate( { - opacity: 0 + opacity: 0, }, { - duration + duration, } ); }, @@ -142,6 +142,6 @@ export default Component.extend({ actions: { toggleChildrenExpanded() { this.toggleProperty("childrenExpanded"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/themes-list.js b/app/assets/javascripts/admin/components/themes-list.js index d9434e56cdd..cdad5e454aa 100644 --- a/app/assets/javascripts/admin/components/themes-list.js +++ b/app/assets/javascripts/admin/components/themes-list.js @@ -35,10 +35,10 @@ export default Component.extend({ ) inactiveThemes(themes) { if (this.componentsTabActive) { - return themes.filter(theme => theme.get("parent_themes.length") <= 0); + return themes.filter((theme) => theme.get("parent_themes.length") <= 0); } return themes.filter( - theme => !theme.get("user_selectable") && !theme.get("default") + (theme) => !theme.get("user_selectable") && !theme.get("default") ); }, @@ -50,10 +50,10 @@ export default Component.extend({ ) activeThemes(themes) { if (this.componentsTabActive) { - return themes.filter(theme => theme.get("parent_themes.length") > 0); + return themes.filter((theme) => theme.get("parent_themes.length") > 0); } else { return themes - .filter(theme => theme.get("user_selectable") || theme.get("default")) + .filter((theme) => theme.get("user_selectable") || theme.get("default")) .sort((a, b) => { if (a.get("default") && !b.get("default")) { return -1; @@ -76,6 +76,6 @@ export default Component.extend({ }, navigateToTheme(theme) { this.router.transitionTo("adminCustomizeThemes.show", theme); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/components/value-list.js b/app/assets/javascripts/admin/components/value-list.js index 4ab79389d25..dbd7d25bfe7 100644 --- a/app/assets/javascripts/admin/components/value-list.js +++ b/app/assets/javascripts/admin/components/value-list.js @@ -30,7 +30,7 @@ export default Component.extend({ @discourseComputed("choices.[]", "collection.[]") filteredChoices(choices, collection) { - return makeArray(choices).filter(i => collection.indexOf(i) < 0); + return makeArray(choices).filter((i) => collection.indexOf(i) < 0); }, keyDown(event) { @@ -55,7 +55,7 @@ export default Component.extend({ selectChoice(choice) { this._addValue(choice); - } + }, }, _addValue(value) { @@ -98,9 +98,9 @@ export default Component.extend({ _splitValues(values, delimiter) { if (values && values.length) { - return values.split(delimiter).filter(x => x); + return values.split(delimiter).filter((x) => x); } else { return []; } - } + }, }); diff --git a/app/assets/javascripts/admin/components/watched-word-form.js b/app/assets/javascripts/admin/components/watched-word-form.js index 942934c61b3..5dc9d7b8e62 100644 --- a/app/assets/javascripts/admin/components/watched-word-form.js +++ b/app/assets/javascripts/admin/components/watched-word-form.js @@ -6,7 +6,7 @@ import WatchedWord from "admin/models/watched-word"; import bootbox from "bootbox"; import discourseComputed, { on, - observes + observes, } from "discourse-common/utils/decorators"; export default Component.extend({ @@ -33,9 +33,11 @@ export default Component.extend({ @discourseComputed("word") isUniqueWord(word) { const words = this.filteredContent || []; - const filtered = words.filter(content => content.action === this.actionKey); + const filtered = words.filter( + (content) => content.action === this.actionKey + ); return filtered.every( - content => content.word.toLowerCase() !== word.toLowerCase() + (content) => content.word.toLowerCase() !== word.toLowerCase() ); }, @@ -44,7 +46,7 @@ export default Component.extend({ if (!this.isUniqueWord) { this.setProperties({ showMessage: true, - message: I18n.t("admin.watched_words.form.exists") + message: I18n.t("admin.watched_words.form.exists"), }); return; } @@ -54,29 +56,29 @@ export default Component.extend({ const watchedWord = WatchedWord.create({ word: this.word, - action: this.actionKey + action: this.actionKey, }); watchedWord .save() - .then(result => { + .then((result) => { this.setProperties({ word: "", formSubmitted: false, showMessage: true, - message: I18n.t("admin.watched_words.form.success") + message: I18n.t("admin.watched_words.form.success"), }); this.action(WatchedWord.create(result)); schedule("afterRender", () => this.element.querySelector(".watched-word-input").focus() ); }) - .catch(e => { + .catch((e) => { this.set("formSubmitted", false); const msg = e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors ? I18n.t("generic_error_with_reason", { - error: e.jqXHR.responseJSON.errors.join(". ") + error: e.jqXHR.responseJSON.errors.join(". "), }) : I18n.t("generic_error"); bootbox.alert(msg, () => @@ -84,17 +86,17 @@ export default Component.extend({ ); }); } - } + }, }, @on("didInsertElement") _init() { schedule("afterRender", () => { - $(this.element.querySelector(".watched-word-input")).keydown(e => { + $(this.element.querySelector(".watched-word-input")).keydown((e) => { if (e.keyCode === 13) { this.send("submit"); } }); }); - } + }, }); diff --git a/app/assets/javascripts/admin/components/watched-word-uploader.js b/app/assets/javascripts/admin/components/watched-word-uploader.js index fd8c8e62ef7..800c0d49886 100644 --- a/app/assets/javascripts/admin/components/watched-word-uploader.js +++ b/app/assets/javascripts/admin/components/watched-word-uploader.js @@ -25,5 +25,5 @@ export default Component.extend(UploadMixin, { bootbox.alert(I18n.t("admin.watched_words.form.upload_successful")); this.done(); } - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-index.js b/app/assets/javascripts/admin/controllers/admin-api-keys-index.js index 99176791bf2..880a2c6435f 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-index.js +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-index.js @@ -9,6 +9,6 @@ export default Controller.extend({ undoRevokeKey(key) { key.undoRevoke().catch(popupAjaxError); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js index f8590220144..9f9ea6bda64 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js @@ -8,7 +8,7 @@ import showModal from "discourse/lib/show-modal"; export default Controller.extend({ userModes: [ { id: "all", name: I18n.t("admin.api.all_users") }, - { id: "single", name: I18n.t("admin.api.single_user") } + { id: "single", name: I18n.t("admin.api.single_user") }, ], useGlobalKey: false, scopes: null, @@ -37,7 +37,7 @@ export default Controller.extend({ if (!this.useGlobalKey) { const selectedScopes = Object.values(this.scopes) .flat() - .filter(action => { + .filter((action) => { return action.selected; }); @@ -55,9 +55,9 @@ export default Controller.extend({ return showModal("admin-api-key-urls", { admin: true, model: { - urls - } + urls, + }, }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-show.js b/app/assets/javascripts/admin/controllers/admin-api-keys-show.js index b907e51b09f..11251a45e6e 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-show.js +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-show.js @@ -58,9 +58,9 @@ export default Controller.extend(bufferedProperty("model"), { return showModal("admin-api-key-urls", { admin: true, model: { - urls - } + urls, + }, }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-backups-index.js b/app/assets/javascripts/admin/controllers/admin-backups-index.js index 8719be10793..c32e70f6333 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups-index.js +++ b/app/assets/javascripts/admin/controllers/admin-backups-index.js @@ -31,7 +31,7 @@ export default Controller.extend({ I18n.t("admin.backups.read_only.enable.confirm"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { this.set("currentUser.hideReadOnlyAlert", true); this._toggleReadOnlyMode(true); @@ -48,13 +48,13 @@ export default Controller.extend({ ajax(`/admin/backups/${link}`, { type: "PUT" }).then(() => bootbox.alert(I18n.t("admin.backups.operations.download.alert")) ); - } + }, }, _toggleReadOnlyMode(enable) { ajax("/admin/backups/readonly", { type: "PUT", - data: { enable } + data: { enable }, }).then(() => this.site.set("isReadOnly", enable)); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-backups-logs.js b/app/assets/javascripts/admin/controllers/admin-backups-logs.js index 69a81f9b676..8c70f054398 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups-logs.js +++ b/app/assets/javascripts/admin/controllers/admin-backups-logs.js @@ -9,5 +9,5 @@ export default Controller.extend({ this._super(...arguments); this.logs = []; - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-backups.js b/app/assets/javascripts/admin/controllers/admin-backups.js index 7e942d9e9ca..83a93d8898e 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups.js +++ b/app/assets/javascripts/admin/controllers/admin-backups.js @@ -7,5 +7,5 @@ export default Controller.extend({ "model.restoreEnabled", "noOperationIsRunning" ), - rollbackDisabled: not("rollbackEnabled") + rollbackDisabled: not("rollbackEnabled"), }); diff --git a/app/assets/javascripts/admin/controllers/admin-badges-award.js b/app/assets/javascripts/admin/controllers/admin-badges-award.js index 9c37dff9642..f3ef51d7015 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-award.js +++ b/app/assets/javascripts/admin/controllers/admin-badges-award.js @@ -17,7 +17,7 @@ export default Controller.extend({ type: "POST", processData: false, contentType: false, - data: new FormData() + data: new FormData(), }; options.data.append("file", file); @@ -34,6 +34,6 @@ export default Controller.extend({ } else { bootbox.alert(I18n.t("admin.badges.mass_award.aborted")); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-badges-show.js b/app/assets/javascripts/admin/controllers/admin-badges-show.js index 0e087a35dd2..3fec918ba95 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-show.js +++ b/app/assets/javascripts/admin/controllers/admin-badges-show.js @@ -57,7 +57,7 @@ export default Controller.extend(bufferedProperty("model"), { }, @observes("model.id") - _resetSaving: function() { + _resetSaving: function () { this.set("saving", false); this.set("savingStatus", ""); }, @@ -81,12 +81,12 @@ export default Controller.extend(bufferedProperty("model"), { "query", "badge_grouping_id", "trigger", - "badge_type_id" + "badge_type_id", ]; if (this.get("buffered.system")) { let protectedFields = this.protectedSystemFields || []; - fields = fields.filter(f => !protectedFields.includes(f)); + fields = fields.filter((f) => !protectedFields.includes(f)); } this.set("saving", true); @@ -99,12 +99,12 @@ export default Controller.extend(bufferedProperty("model"), { "auto_revoke", "enabled", "show_posts", - "target_posts" + "target_posts", ]; const data = {}; const buffered = this.buffered; - fields.forEach(function(field) { + fields.forEach(function (field) { var d = buffered.get(field); if (boolFields.includes(field)) { d = !!d; @@ -149,7 +149,7 @@ export default Controller.extend(bufferedProperty("model"), { I18n.t("admin.badges.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { model .destroy() @@ -163,6 +163,6 @@ export default Controller.extend(bufferedProperty("model"), { } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-badges.js b/app/assets/javascripts/admin/controllers/admin-badges.js index 4797fb2695e..433c49bac59 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges.js +++ b/app/assets/javascripts/admin/controllers/admin-badges.js @@ -14,5 +14,5 @@ export default Controller.extend({ } else { return this.routing.currentRouteName; } - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js b/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js index 68d7f65cc41..5fa62188396 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-colors-show.js @@ -8,18 +8,18 @@ export default Controller.extend({ @discourseComputed("model.colors", "onlyOverridden") colors(allColors, onlyOverridden) { if (onlyOverridden) { - return allColors.filter(color => color.get("overridden")); + return allColors.filter((color) => color.get("overridden")); } else { return allColors; } }, actions: { - revert: function(color) { + revert: function (color) { color.revert(); }, - undo: function(color) { + undo: function (color) { color.undo(); }, @@ -68,7 +68,7 @@ export default Controller.extend({ }); }, - save: function() { + save: function () { this.model.save(); }, @@ -76,13 +76,13 @@ export default Controller.extend({ this.model.updateUserSelectable(this.get("model.user_selectable")); }, - destroy: function() { + destroy: function () { const model = this.model; return bootbox.confirm( I18n.t("admin.customize.colors.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { model.destroy().then(() => { this.allColors.removeObject(model); @@ -91,6 +91,6 @@ export default Controller.extend({ } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-colors.js b/app/assets/javascripts/admin/controllers/admin-customize-colors.js index 062121fc471..01898b161a1 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-colors.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-colors.js @@ -18,7 +18,7 @@ export default Controller.extend({ @discourseComputed("baseColorScheme") baseColors(baseColorScheme) { const baseColorsHash = EmberObject.create({}); - baseColorScheme.get("colors").forEach(color => { + baseColorScheme.get("colors").forEach((color) => { baseColorsHash.set(color.get("name"), color); }); return baseColorsHash; @@ -30,7 +30,7 @@ export default Controller.extend({ const newColorScheme = base.copy(); newColorScheme.setProperties({ name: I18n.t("admin.customize.colors.new_name"), - base_scheme_id: base.get("base_scheme_id") + base_scheme_id: base.get("base_scheme_id"), }); newColorScheme.save().then(() => { this.model.pushObject(newColorScheme); @@ -42,8 +42,8 @@ export default Controller.extend({ newColorScheme() { showModal("admin-color-scheme-select-base", { model: this.baseColorSchemes, - admin: true + admin: true, }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-email-style-edit.js b/app/assets/javascripts/admin/controllers/admin-customize-email-style-edit.js index b79d8535412..f1190600e8d 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-email-style-edit.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-email-style-edit.js @@ -20,17 +20,17 @@ export default Controller.extend({ this.set("saving", true); this.model .update(this.model.getProperties("html", "css")) - .catch(e => { + .catch((e) => { const msg = e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors ? I18n.t("admin.customize.email_style.save_error_with_reason", { - error: e.jqXHR.responseJSON.errors.join(". ") + error: e.jqXHR.responseJSON.errors.join(". "), }) : I18n.t("generic_error"); bootbox.alert(msg); }) .finally(() => this.set("model.changed", false)); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js b/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js index 5bf8c6a1718..85fc98a449f 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js @@ -45,11 +45,11 @@ export default Controller.extend(bufferedProperty("emailTemplate"), { this.set("saved", false); bootbox.confirm( I18n.t("admin.customize.email_templates.revert_confirm"), - result => { + (result) => { if (result) { this.emailTemplate .revert() - .then(props => { + .then((props) => { const buffered = this.buffered; buffered.setProperties(props); this.commitBuffer(); @@ -58,5 +58,5 @@ export default Controller.extend(bufferedProperty("emailTemplate"), { } } ); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js b/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js index 228c70a975a..415cf1d1579 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-email-templates.js @@ -14,5 +14,5 @@ export default Controller.extend({ @action onSelectTemplate(template) { this.transitionToRoute("adminCustomizeEmailTemplates.edit", template); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js b/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js index a3e43f20382..7da07207441 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-robots-txt.js @@ -14,14 +14,14 @@ export default Controller.extend(bufferedProperty("model"), { save() { this.setProperties({ isSaving: true, - saved: false + saved: false, }); ajax("robots.json", { type: "PUT", - data: { robots_txt: this.buffered.get("robots_txt") } + data: { robots_txt: this.buffered.get("robots_txt") }, }) - .then(data => { + .then((data) => { this.commitBuffer(); this.set("saved", true); this.set("model.overridden", data.overridden); @@ -32,16 +32,16 @@ export default Controller.extend(bufferedProperty("model"), { reset() { this.setProperties({ isSaving: true, - saved: false + saved: false, }); ajax("robots.json", { type: "DELETE" }) - .then(data => { + .then((data) => { this.buffered.set("robots_txt", data.robots_txt); this.commitBuffer(); this.set("saved", true); this.set("model.overridden", false); }) .finally(() => this.set("isSaving", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js b/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js index a6065056920..889d90a9218 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js @@ -12,15 +12,15 @@ export default Controller.extend({ editRouteName: "adminCustomizeThemes.edit", showRouteName: "adminCustomizeThemes.show", - setTargetName: function(name) { - const target = this.get("model.targets").find(t => t.name === name); + setTargetName: function (name) { + const target = this.get("model.targets").find((t) => t.name === name); this.set("currentTarget", target && target.id); }, @discourseComputed("currentTarget") currentTargetName(id) { const target = this.get("model.targets").find( - t => t.id === parseInt(id, 10) + (t) => t.id === parseInt(id, 10) ); return target && target.name; }, @@ -50,9 +50,9 @@ export default Controller.extend({ onlyOverriddenChanged(onlyShowOverridden) { if (onlyShowOverridden) { if (!this.model.hasEdited(this.currentTargetName, this.fieldName)) { - let firstTarget = this.get("model.targets").find(t => t.edited); + let firstTarget = this.get("model.targets").find((t) => t.edited); let firstField = this.get(`model.fields.${firstTarget.name}`).find( - f => f.edited + (f) => f.edited ); this.replaceRoute( @@ -63,6 +63,6 @@ export default Controller.extend({ ); } } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js index 4247956f51f..f38493c5564 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js @@ -5,7 +5,7 @@ import { filterBy, match, mapBy, - notEmpty + notEmpty, } from "@ember/object/computed"; import Controller from "@ember/controller"; import discourseComputed from "discourse-common/utils/decorators"; @@ -38,14 +38,14 @@ export default Controller.extend({ @discourseComputed("model.editedFields") editedFieldsFormatted() { const descriptions = []; - ["common", "desktop", "mobile"].forEach(target => { + ["common", "desktop", "mobile"].forEach((target) => { const fields = this.editedFieldsForTarget(target); if (fields.length < 1) { return; } let resultString = I18n.t("admin.customize.theme." + target); const formattedFields = fields - .map(f => I18n.t("admin.customize.theme." + f.name + ".text")) + .map((f) => I18n.t("admin.customize.theme." + f.name + ".text")) .join(" , "); resultString += `: ${formattedFields}`; descriptions.push(resultString); @@ -64,7 +64,7 @@ export default Controller.extend({ if (available) { const themes = !childThemes ? available - : available.filter(theme => childThemes.indexOf(theme) === -1); + : available.filter((theme) => childThemes.indexOf(theme) === -1); return themes.length === 0 ? null : themes; } }, @@ -83,7 +83,7 @@ export default Controller.extend({ value: this.parentThemesNames.join("|"), defaultValues: this.availableActiveThemesNames.join("|"), allThemes: this.allThemes, - setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes") + setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes"), }); }, @@ -101,7 +101,7 @@ export default Controller.extend({ value: this.childThemesNames.join("|"), defaultValues: this.availableActiveComponentsNames.join("|"), allThemes: this.allThemes, - setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all") + setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all"), }); }, @@ -110,7 +110,7 @@ export default Controller.extend({ if (!this.get("model.component")) { const themeId = this.get("model.id"); return allThemes.filter( - theme => theme.get("id") !== themeId && theme.get("component") + (theme) => theme.get("id") !== themeId && theme.get("component") ); } }, @@ -134,14 +134,14 @@ export default Controller.extend({ @discourseComputed("model.settings") settings(settings) { - return settings.map(setting => ThemeSettings.create(setting)); + return settings.map((setting) => ThemeSettings.create(setting)); }, hasSettings: notEmpty("settings"), @discourseComputed("model.translations") translations(translations) { - return translations.map(setting => ThemeSettings.create(setting)); + return translations.map((setting) => ThemeSettings.create(setting)); }, hasTranslations: notEmpty("translations"), @@ -153,7 +153,7 @@ export default Controller.extend({ editedFieldsForTarget(target) { return this.get("model.editedFields").filter( - field => field.target === target + (field) => field.target === target ); }, @@ -178,10 +178,10 @@ export default Controller.extend({ color_scheme_id: null, user_selectable: false, child_themes: [], - childThemes: [] + childThemes: [], }); - this.get("parentController.model.content").forEach(theme => { + this.get("parentController.model.content").forEach((theme) => { const children = makeArray(theme.get("childThemes")); const rawChildren = makeArray(theme.get("child_themes")); const index = children ? children.indexOf(model) : -1; @@ -190,7 +190,7 @@ export default Controller.extend({ rawChildren.splice(index, 1); theme.setProperties({ childThemes: children, - child_themes: rawChildren + child_themes: rawChildren, }); } }); @@ -245,7 +245,7 @@ export default Controller.extend({ addUpload(info) { let model = this.model; model.setField("common", info.name, "", info.upload_id, THEME_UPLOAD_VAR); - model.saveChanges("theme_fields").catch(e => popupAjaxError(e)); + model.saveChanges("theme_fields").catch((e) => popupAjaxError(e)); }, cancelChangeScheme() { @@ -276,7 +276,7 @@ export default Controller.extend({ if (this.get("model.remote_theme.is_git")) { bootbox.confirm( I18n.t("admin.customize.theme.edit_confirm"), - result => { + (result) => { if (result) { this.transitionToEditRoute(); } @@ -291,7 +291,7 @@ export default Controller.extend({ const model = this.model; model.saveChanges("default").then(() => { if (model.get("default")) { - this.allThemes.forEach(theme => { + this.allThemes.forEach((theme) => { if (theme !== model && theme.get("default")) { theme.set("default", false); } @@ -315,7 +315,7 @@ export default Controller.extend({ I18n.t("admin.customize.theme.delete_upload_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { this.model.removeField(upload); } @@ -332,11 +332,11 @@ export default Controller.extend({ destroy() { return bootbox.confirm( I18n.t("admin.customize.delete_confirm", { - theme_name: this.get("model.name") + theme_name: this.get("model.name"), }), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { const model = this.model; model.setProperties({ recentlyInstalled: false }); @@ -354,14 +354,14 @@ export default Controller.extend({ ? this.parentThemes : this.get("model.childThemes"); if (relatives && relatives.length > 0) { - const names = relatives.map(relative => relative.get("name")); + const names = relatives.map((relative) => relative.get("name")); bootbox.confirm( I18n.t(`${this.convertKey}_alert`, { - relatives: names.join(", ") + relatives: names.join(", "), }), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { this.commitSwitchType(); } @@ -384,6 +384,6 @@ export default Controller.extend({ this.model .saveChanges("enabled") .catch(() => this.model.set("enabled", true)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes.js b/app/assets/javascripts/admin/controllers/admin-customize-themes.js index e99532bf032..3ffe9301f1a 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes.js +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes.js @@ -7,16 +7,16 @@ export default Controller.extend({ @discourseComputed("model", "model.@each.component") fullThemes(themes) { - return themes.filter(t => !t.get("component")); + return themes.filter((t) => !t.get("component")); }, @discourseComputed("model", "model.@each.component") childThemes(themes) { - return themes.filter(t => t.get("component")); + return themes.filter((t) => t.get("component")); }, @discourseComputed("model", "model.@each.component") installedThemes(themes) { - return themes.map(t => t.name); - } + return themes.map((t) => t.name); + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js index 07a940afc79..6878c916d63 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js @@ -11,8 +11,8 @@ import { computed } from "@ember/object"; import getURL from "discourse-common/lib/get-url"; function staticReport(reportType) { - return computed("reports.[]", function() { - return makeArray(this.reports).find(report => report.type === reportType); + return computed("reports.[]", function () { + return makeArray(this.reports).find((report) => report.type === reportType); }); } @@ -27,7 +27,7 @@ export default Controller.extend(PeriodComputationMixin, { return (metrics || "").split("|").filter(Boolean); }, - hiddenReports: computed("siteSettings.dashboard_hidden_reports", function() { + hiddenReports: computed("siteSettings.dashboard_hidden_reports", function () { return (this.siteSettings.dashboard_hidden_reports || "") .split("|") .filter(Boolean); @@ -36,21 +36,21 @@ export default Controller.extend(PeriodComputationMixin, { isActivityMetricsVisible: computed( "activityMetrics", "hiddenReports", - function() { + function () { return ( this.activityMetrics.length && - this.activityMetrics.some(x => !this.hiddenReports.includes(x)) + this.activityMetrics.some((x) => !this.hiddenReports.includes(x)) ); } ), - isSearchReportsVisible: computed("hiddenReports", function() { + isSearchReportsVisible: computed("hiddenReports", function () { return ["top_referred_topics", "trending_search"].some( - x => !this.hiddenReports.includes(x) + (x) => !this.hiddenReports.includes(x) ); }), - isCommunityHealthVisible: computed("hiddenReports", function() { + isCommunityHealthVisible: computed("hiddenReports", function () { return [ "consolidated_page_views", "signups", @@ -58,56 +58,52 @@ export default Controller.extend(PeriodComputationMixin, { "posts", "dau_by_mau", "daily_engaged_users", - "new_contributors" - ].some(x => !this.hiddenReports.includes(x)); + "new_contributors", + ].some((x) => !this.hiddenReports.includes(x)); }), @discourseComputed activityMetricsFilters() { return { startDate: this.lastMonth, - endDate: this.today + endDate: this.today, }; }, @discourseComputed topReferredTopicsOptions() { return { - table: { total: false, limit: 8 } + table: { total: false, limit: 8 }, }; }, @discourseComputed topReferredTopicsFilters() { return { - startDate: moment() - .subtract(6, "days") - .startOf("day"), - endDate: this.today + startDate: moment().subtract(6, "days").startOf("day"), + endDate: this.today, }; }, @discourseComputed trendingSearchFilters() { return { - startDate: moment() - .subtract(1, "month") - .startOf("day"), - endDate: this.today + startDate: moment().subtract(1, "month").startOf("day"), + endDate: this.today, }; }, @discourseComputed trendingSearchOptions() { return { - table: { total: false, limit: 8 } + table: { total: false, limit: 8 }, }; }, @discourseComputed trendingSearchDisabledLabel() { return I18n.t("admin.dashboard.reports.trending_search.disabled", { - basePath: getURL("") + basePath: getURL(""), }); }, @@ -120,23 +116,21 @@ export default Controller.extend(PeriodComputationMixin, { if ( !this.dashboardFetchedAt || - moment() - .subtract(30, "minutes") - .toDate() > this.dashboardFetchedAt + moment().subtract(30, "minutes").toDate() > this.dashboardFetchedAt ) { this.set("isLoading", true); AdminDashboard.fetchGeneral() - .then(adminDashboardModel => { + .then((adminDashboardModel) => { this.setProperties({ dashboardFetchedAt: new Date(), model: adminDashboardModel, - reports: makeArray(adminDashboardModel.reports).map(x => + reports: makeArray(adminDashboardModel.reports).map((x) => Report.create(x) - ) + ), }); }) - .catch(e => { + .catch((e) => { this.exceptionController.set("thrown", e.jqXHR); this.replaceRoute("exception"); }) @@ -151,5 +145,5 @@ export default Controller.extend(PeriodComputationMixin, { _reportsForPeriodURL(period) { return getURL(`/admin?period=${period}`); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-moderation.js b/app/assets/javascripts/admin/controllers/admin-dashboard-moderation.js index f37d8606afe..6781c50bdea 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-moderation.js +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-moderation.js @@ -10,14 +10,14 @@ export default Controller.extend(PeriodComputationMixin, { return { table: { total: false, - perPage: 10 - } + perPage: 10, + }, }; }, isModeratorsActivityVisible: computed( "siteSettings.dashboard_hidden_reports", - function() { + function () { return !(this.siteSettings.dashboard_hidden_reports || "") .split("|") .filter(Boolean) @@ -30,8 +30,8 @@ export default Controller.extend(PeriodComputationMixin, { return { table: { total: false, - perPage: 10 - } + perPage: 10, + }, }; }, @@ -47,5 +47,5 @@ export default Controller.extend(PeriodComputationMixin, { _reportsForPeriodURL(period) { return getURL(`/admin/dashboard/moderation?period=${period}`); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-reports.js b/app/assets/javascripts/admin/controllers/admin-dashboard-reports.js index c096c3e7638..966304a0e56 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-reports.js +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-reports.js @@ -16,7 +16,7 @@ export default Controller.extend({ filterReports(reports, filter) { if (filter) { filter = filter.toLowerCase(); - reports = reports.filter(report => { + reports = reports.filter((report) => { return ( (get(report, "title") || "").toLowerCase().indexOf(filter) > -1 || (get(report, "description") || "").toLowerCase().indexOf(filter) > -1 @@ -27,7 +27,7 @@ export default Controller.extend({ const hiddenReports = (this.siteSettings.dashboard_hidden_reports || "") .split("|") .filter(Boolean); - reports = reports.filter(report => !hiddenReports.includes(report.type)); + reports = reports.filter((report) => !hiddenReports.includes(report.type)); return reports; }, @@ -35,10 +35,10 @@ export default Controller.extend({ actions: { filterReports(filter) { debounce(this, this._performFiltering, filter, INPUT_DELAY); - } + }, }, _performFiltering(filter) { this.set("filter", filter); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard.js b/app/assets/javascripts/admin/controllers/admin-dashboard.js index 5946a1736d6..d91e5c515f3 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard.js +++ b/app/assets/javascripts/admin/controllers/admin-dashboard.js @@ -18,21 +18,21 @@ export default Controller.extend({ return this.currentUser.get("admin") && (problemsLength || 0) > 0; }, - visibleTabs: computed("siteSettings.dashboard_visible_tabs", function() { + visibleTabs: computed("siteSettings.dashboard_visible_tabs", function () { return (this.siteSettings.dashboard_visible_tabs || "") .split("|") .filter(Boolean); }), - isModerationTabVisible: computed("visibleTabs", function() { + isModerationTabVisible: computed("visibleTabs", function () { return this.visibleTabs.includes("moderation"); }), - isSecurityTabVisible: computed("visibleTabs", function() { + isSecurityTabVisible: computed("visibleTabs", function () { return this.visibleTabs.includes("security"); }), - isReportsTabVisible: computed("visibleTabs", function() { + isReportsTabVisible: computed("visibleTabs", function () { return this.visibleTabs.includes("reports"); }), @@ -41,9 +41,8 @@ export default Controller.extend({ if ( !this.problemsFetchedAt || - moment() - .subtract(PROBLEMS_CHECK_MINUTES, "minutes") - .toDate() > this.problemsFetchedAt + moment().subtract(PROBLEMS_CHECK_MINUTES, "minutes").toDate() > + this.problemsFetchedAt ) { this._loadProblems(); } @@ -56,16 +55,14 @@ export default Controller.extend({ if ( !this.dashboardFetchedAt || - moment() - .subtract(30, "minutes") - .toDate() > this.dashboardFetchedAt + moment().subtract(30, "minutes").toDate() > this.dashboardFetchedAt ) { this.set("isLoading", true); AdminDashboard.fetch() - .then(model => { + .then((model) => { let properties = { - dashboardFetchedAt: new Date() + dashboardFetchedAt: new Date(), }; if (versionChecks) { @@ -74,7 +71,7 @@ export default Controller.extend({ this.setProperties(properties); }) - .catch(e => { + .catch((e) => { this.exceptionController.set("thrown", e.jqXHR); this.replaceRoute("exception"); }) @@ -87,24 +84,22 @@ export default Controller.extend({ _loadProblems() { this.setProperties({ loadingProblems: true, - problemsFetchedAt: new Date() + problemsFetchedAt: new Date(), }); AdminDashboard.fetchProblems() - .then(model => this.set("problems", model.problems)) + .then((model) => this.set("problems", model.problems)) .finally(() => this.set("loadingProblems", false)); }, @discourseComputed("problemsFetchedAt") problemsTimestamp(problemsFetchedAt) { - return moment(problemsFetchedAt) - .locale("en") - .format("LLL"); + return moment(problemsFetchedAt).locale("en").format("LLL"); }, actions: { refreshProblems() { this._loadProblems(); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js b/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js index 84433443491..860f276f8ae 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js +++ b/app/assets/javascripts/admin/controllers/admin-email-advanced-test.js @@ -15,17 +15,17 @@ export default Controller.extend({ ajax("/admin/email/advanced-test", { type: "POST", - data: { email: this.email } + data: { email: this.email }, }) - .then(data => { + .then((data) => { this.setProperties({ text: data.text, elided: data.elided, - format: data.format + format: data.format, }); }) .catch(popupAjaxError) .finally(() => this.set("loading", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-bounced.js b/app/assets/javascripts/admin/controllers/admin-email-bounced.js index bc034db4f71..07721cdff09 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-bounced.js +++ b/app/assets/javascripts/admin/controllers/admin-email-bounced.js @@ -5,7 +5,7 @@ import { INPUT_DELAY } from "discourse-common/config/environment"; export default AdminEmailLogsController.extend({ @observes("filter.{status,user,address,type}") - filterEmailLogs: discourseDebounce(function() { + filterEmailLogs: discourseDebounce(function () { this.loadLogs(); - }, INPUT_DELAY) + }, INPUT_DELAY), }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-index.js b/app/assets/javascripts/admin/controllers/admin-email-index.js index af879a3e320..f356731e6d9 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-index.js +++ b/app/assets/javascripts/admin/controllers/admin-email-index.js @@ -19,7 +19,7 @@ export default Controller.extend({ @method testEmailAddressChanged **/ @observes("testEmailAddress") - testEmailAddressChanged: function() { + testEmailAddressChanged: function () { this.set("sentTestEmail", false); }, @@ -29,24 +29,24 @@ export default Controller.extend({ @method sendTestEmail **/ - sendTestEmail: function() { + sendTestEmail: function () { this.setProperties({ sendingEmail: true, - sentTestEmail: false + sentTestEmail: false, }); ajax("/admin/email/test", { type: "POST", - data: { email_address: this.testEmailAddress } + data: { email_address: this.testEmailAddress }, }) - .then(response => + .then((response) => this.set("sentTestEmailMessage", response.sent_test_email_message) ) - .catch(e => { + .catch((e) => { if (e.responseJSON && e.responseJSON.errors) { bootbox.alert( I18n.t("admin.email.error", { - server_error: e.responseJSON.errors[0] + server_error: e.responseJSON.errors[0], }) ); } else { @@ -54,6 +54,6 @@ export default Controller.extend({ } }) .finally(() => this.set("sendingEmail", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-logs.js b/app/assets/javascripts/admin/controllers/admin-email-logs.js index 49a84ea6d11..c0bb4f29f7e 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-logs.js +++ b/app/assets/javascripts/admin/controllers/admin-email-logs.js @@ -15,7 +15,7 @@ export default Controller.extend({ return sourceModel .findAll(this.filter, loadMore ? this.get("model.length") : null) - .then(logs => { + .then((logs) => { if (this.model && loadMore && logs.length < 50) { this.model.set("allLoaded", true); } @@ -32,6 +32,6 @@ export default Controller.extend({ actions: { loadMore() { this.loadLogs(EmailLog, true); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js index 8f8f4b4211e..4b6ba80ce68 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js +++ b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js @@ -26,7 +26,7 @@ export default Controller.extend({ this.set("username", username); } - EmailPreview.findDigest(username, this.lastSeen).then(email => { + EmailPreview.findDigest(username, this.lastSeen).then((email) => { model.setProperties( email.getProperties("html_content", "text_content") ); @@ -43,7 +43,7 @@ export default Controller.extend({ this.set("sentEmail", false); EmailPreview.sendDigest(this.username, this.lastSeen, this.email) - .then(result => { + .then((result) => { if (result.errors) { bootbox.alert(result.errors); } else { @@ -54,6 +54,6 @@ export default Controller.extend({ .finally(() => { this.set("sendingEmail", false); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-received.js b/app/assets/javascripts/admin/controllers/admin-email-received.js index 0942a3dabf6..ab023378666 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-received.js +++ b/app/assets/javascripts/admin/controllers/admin-email-received.js @@ -6,13 +6,13 @@ import { INPUT_DELAY } from "discourse-common/config/environment"; export default AdminEmailLogsController.extend({ @observes("filter.{status,from,to,subject}") - filterIncomingEmails: discourseDebounce(function() { + filterIncomingEmails: discourseDebounce(function () { this.loadLogs(IncomingEmail); }, INPUT_DELAY), actions: { loadMore() { this.loadLogs(IncomingEmail, true); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-rejected.js b/app/assets/javascripts/admin/controllers/admin-email-rejected.js index 01882482e78..2c160648c62 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-rejected.js +++ b/app/assets/javascripts/admin/controllers/admin-email-rejected.js @@ -6,13 +6,13 @@ import { INPUT_DELAY } from "discourse-common/config/environment"; export default AdminEmailLogsController.extend({ @observes("filter.{status,from,to,subject,error}") - filterIncomingEmails: discourseDebounce(function() { + filterIncomingEmails: discourseDebounce(function () { this.loadLogs(IncomingEmail); }, INPUT_DELAY), actions: { loadMore() { this.loadLogs(IncomingEmail, true); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-sent.js b/app/assets/javascripts/admin/controllers/admin-email-sent.js index b76fcf81dc0..2c7890cde82 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-sent.js +++ b/app/assets/javascripts/admin/controllers/admin-email-sent.js @@ -5,7 +5,7 @@ import { INPUT_DELAY } from "discourse-common/config/environment"; export default AdminEmailLogsController.extend({ @observes("filter.{status,user,address,type,reply_key}") - filterEmailLogs: discourseDebounce(function() { + filterEmailLogs: discourseDebounce(function () { this.loadLogs(); - }, INPUT_DELAY) + }, INPUT_DELAY), }); diff --git a/app/assets/javascripts/admin/controllers/admin-email-skipped.js b/app/assets/javascripts/admin/controllers/admin-email-skipped.js index bc034db4f71..07721cdff09 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-skipped.js +++ b/app/assets/javascripts/admin/controllers/admin-email-skipped.js @@ -5,7 +5,7 @@ import { INPUT_DELAY } from "discourse-common/config/environment"; export default AdminEmailLogsController.extend({ @observes("filter.{status,user,address,type}") - filterEmailLogs: discourseDebounce(function() { + filterEmailLogs: discourseDebounce(function () { this.loadLogs(); - }, INPUT_DELAY) + }, INPUT_DELAY), }); diff --git a/app/assets/javascripts/admin/controllers/admin-embedding.js b/app/assets/javascripts/admin/controllers/admin-embedding.js index b71c173e360..df7f856ed56 100644 --- a/app/assets/javascripts/admin/controllers/admin-embedding.js +++ b/app/assets/javascripts/admin/controllers/admin-embedding.js @@ -50,6 +50,6 @@ export default Controller.extend({ deleteHost(host) { this.get("embedding.embeddable_hosts").removeObject(host); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-emojis.js b/app/assets/javascripts/admin/controllers/admin-emojis.js index 255638ea0c7..4019cb188e6 100644 --- a/app/assets/javascripts/admin/controllers/admin-emojis.js +++ b/app/assets/javascripts/admin/controllers/admin-emojis.js @@ -16,7 +16,7 @@ export default Controller.extend({ this.setProperties({ filter: ALL_FILTER, - sorting: ["group", "name"] + sorting: ["group", "name"], }); }, @@ -25,13 +25,13 @@ export default Controller.extend({ emojiGroups: computed("model", { get() { return this.model.mapBy("group").uniq(); - } + }, }), sortingGroups: computed("emojiGroups.[]", { get() { return [ALL_FILTER].concat(this.emojiGroups); - } + }, }), filteredEmojis: computed("model.[]", "filter", { @@ -41,7 +41,7 @@ export default Controller.extend({ } else { return this.model.filterBy("group", this.filter); } - } + }, }), @action @@ -62,15 +62,15 @@ export default Controller.extend({ I18n.t("admin.emoji.delete_confirm", { name: emoji.get("name") }), I18n.t("no_value"), I18n.t("yes_value"), - destroy => { + (destroy) => { if (destroy) { return ajax("/admin/customize/emojis/" + emoji.get("name"), { - type: "DELETE" + type: "DELETE", }).then(() => { this.model.removeObject(emoji); }); } } ); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-logs-screened-emails.js b/app/assets/javascripts/admin/controllers/admin-logs-screened-emails.js index 5b0908c3636..134968eb10f 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-screened-emails.js +++ b/app/assets/javascripts/admin/controllers/admin-logs-screened-emails.js @@ -8,7 +8,7 @@ export default Controller.extend({ actions: { clearBlock(row) { - row.clearBlock().then(function() { + row.clearBlock().then(function () { // feeling lazy window.location.reload(); }); @@ -16,14 +16,14 @@ export default Controller.extend({ exportScreenedEmailList() { exportEntity("screened_email").then(outputExportResult); - } + }, }, show() { this.set("loading", true); - ScreenedEmail.findAll().then(result => { + ScreenedEmail.findAll().then((result) => { this.set("model", result); this.set("loading", false); }); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js b/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js index 8899d010285..11d34dabc30 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js +++ b/app/assets/javascripts/admin/controllers/admin-logs-screened-ip-addresses.js @@ -14,9 +14,9 @@ export default Controller.extend({ savedIpAddress: null, @observes("filter") - show: discourseDebounce(function() { + show: discourseDebounce(function () { this.set("loading", true); - ScreenedIpAddress.findAll(this.filter).then(result => { + ScreenedIpAddress.findAll(this.filter).then((result) => { this.setProperties({ model: result, loading: false }); }); }, INPUT_DELAY), @@ -53,11 +53,11 @@ export default Controller.extend({ record .save() .then(() => this.set("savedIpAddress", null)) - .catch(e => { + .catch((e) => { if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) { bootbox.alert( I18n.t("generic_error_with_reason", { - error: e.jqXHR.responseJSON.errors.join(". ") + error: e.jqXHR.responseJSON.errors.join(". "), }) ); } else { @@ -70,25 +70,25 @@ export default Controller.extend({ destroy(record) { return bootbox.confirm( I18n.t("admin.logs.screened_ips.delete_confirm", { - ip_address: record.get("ip_address") + ip_address: record.get("ip_address"), }), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { record .destroy() - .then(deleted => { + .then((deleted) => { if (deleted) { this.model.removeObject(record); } else { bootbox.alert(I18n.t("generic_error")); } }) - .catch(e => { + .catch((e) => { bootbox.alert( I18n.t("generic_error_with_reason", { - error: `http: ${e.status} - ${e.body}` + error: `http: ${e.status} - ${e.body}`, }) ); }); @@ -106,16 +106,16 @@ export default Controller.extend({ I18n.t("admin.logs.screened_ips.roll_up_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { this.set("loading", true); - return ScreenedIpAddress.rollUp().then(results => { + return ScreenedIpAddress.rollUp().then((results) => { if (results && results.subnets) { if (results.subnets.length > 0) { this.send("show"); bootbox.alert( I18n.t("admin.logs.screened_ips.rolled_up_some_subnets", { - subnets: results.subnets.join(", ") + subnets: results.subnets.join(", "), }) ); } else { @@ -133,6 +133,6 @@ export default Controller.extend({ exportScreenedIpList() { exportEntity("screened_ip").then(outputExportResult); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-logs-screened-urls.js b/app/assets/javascripts/admin/controllers/admin-logs-screened-urls.js index 3f337831840..90d008bb869 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-screened-urls.js +++ b/app/assets/javascripts/admin/controllers/admin-logs-screened-urls.js @@ -8,7 +8,7 @@ export default Controller.extend({ show() { this.set("loading", true); - ScreenedUrl.findAll().then(result => { + ScreenedUrl.findAll().then((result) => { this.set("model", result); this.set("loading", false); }); @@ -17,6 +17,6 @@ export default Controller.extend({ actions: { exportScreenedUrlList() { exportEntity("screened_url").then(outputExportResult); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js b/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js index 3568aaf9824..70496049d1b 100644 --- a/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js +++ b/app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js @@ -24,18 +24,18 @@ export default Controller.extend({ }, _refresh() { - this.store.findAll("staff-action-log", this.filters).then(result => { + this.store.findAll("staff-action-log", this.filters).then((result) => { this.set("model", result); if (!this.userHistoryActions) { this.set( "userHistoryActions", result.extras.user_history_actions - .map(action => ({ + .map((action) => ({ id: action.id, action_id: action.action_id, name: I18n.t("admin.logs.staff_actions.actions." + action.id), - name_raw: action.id + name_raw: action.id, })) .sort((a, b) => a.name.localeCompare(b.name)) ); @@ -50,7 +50,7 @@ export default Controller.extend({ resetFilters() { this.setProperties({ model: EmberObject.create({ loadingMore: true }), - filters: EmberObject.create() + filters: EmberObject.create(), }); this.scheduleRefresh(); }, @@ -62,7 +62,7 @@ export default Controller.extend({ this.set("filters", EmberObject.create()); } - Object.keys(props).forEach(key => { + Object.keys(props).forEach((key) => { if (props[key] === undefined || props[key] === null) { this.filters.set(key, undefined); delete this.filters[key]; @@ -81,7 +81,7 @@ export default Controller.extend({ this.changeFilters({ action_name: filterActionId, action_id: this.userHistoryActions.findBy("id", filterActionId) - .action_id + .action_id, }); } }, @@ -92,7 +92,7 @@ export default Controller.extend({ this.changeFilters({ action_name: null, action_id: null, - custom_type: null + custom_type: null, }); } else { this.changeFilters({ [key]: null }); @@ -108,7 +108,7 @@ export default Controller.extend({ this.changeFilters({ action_name: logItem.get("action_name"), action_id: logItem.get("action"), - custom_type: logItem.get("custom_type") + custom_type: logItem.get("custom_type"), }); }, @@ -130,6 +130,6 @@ export default Controller.extend({ loadMore() { this.model.loadMore(); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-permalinks.js b/app/assets/javascripts/admin/controllers/admin-permalinks.js index e57ad34dac0..729cdab0c85 100644 --- a/app/assets/javascripts/admin/controllers/admin-permalinks.js +++ b/app/assets/javascripts/admin/controllers/admin-permalinks.js @@ -11,8 +11,8 @@ export default Controller.extend({ filter: null, @observes("filter") - show: discourseDebounce(function() { - Permalink.findAll(this.filter).then(result => { + show: discourseDebounce(function () { + Permalink.findAll(this.filter).then((result) => { this.set("model", result); this.set("loading", false); }); @@ -33,28 +33,28 @@ export default Controller.extend({ textArea.remove(); }, - destroy: function(record) { + destroy: function (record) { return bootbox.confirm( I18n.t("admin.permalink.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { record.destroy().then( - deleted => { + (deleted) => { if (deleted) { this.model.removeObject(record); } else { bootbox.alert(I18n.t("generic_error")); } }, - function() { + function () { bootbox.alert(I18n.t("generic_error")); } ); } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-plugins.js b/app/assets/javascripts/admin/controllers/admin-plugins.js index f9b34e70a42..955aaba5c38 100644 --- a/app/assets/javascripts/admin/controllers/admin-plugins.js +++ b/app/assets/javascripts/admin/controllers/admin-plugins.js @@ -3,9 +3,9 @@ import Controller from "@ember/controller"; export default Controller.extend({ @discourseComputed - adminRoutes: function() { + adminRoutes: function () { return this.model - .map(p => { + .map((p) => { if (p.get("enabled")) { return p.admin_route; } @@ -20,6 +20,6 @@ export default Controller.extend({ toggleMenu() { $(".admin-detail").toggleClass("mobile-closed mobile-open"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-reports-show.js b/app/assets/javascripts/admin/controllers/admin-reports-show.js index f3919e4bed8..c20dfc1c2e2 100644 --- a/app/assets/javascripts/admin/controllers/admin-reports-show.js +++ b/app/assets/javascripts/admin/controllers/admin-reports-show.js @@ -19,5 +19,5 @@ export default Controller.extend({ options.chartGrouping = this.chart_grouping; return options; - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-search-logs-index.js b/app/assets/javascripts/admin/controllers/admin-search-logs-index.js index ab58efbfcbb..2e2bcb4f732 100644 --- a/app/assets/javascripts/admin/controllers/admin-search-logs-index.js +++ b/app/assets/javascripts/admin/controllers/admin-search-logs-index.js @@ -13,13 +13,13 @@ export default Controller.extend({ this.searchTypeOptions = [ { id: "all", - name: I18n.t("admin.logs.search_logs.types.all_search_types") + name: I18n.t("admin.logs.search_logs.types.all_search_types"), }, { id: "header", name: I18n.t("admin.logs.search_logs.types.header") }, { id: "full_page", - name: I18n.t("admin.logs.search_logs.types.full_page") - } + name: I18n.t("admin.logs.search_logs.types.full_page"), + }, ]; - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-search-logs-term.js b/app/assets/javascripts/admin/controllers/admin-search-logs-term.js index cd493e35bc9..8ee5dd5df1e 100644 --- a/app/assets/javascripts/admin/controllers/admin-search-logs-term.js +++ b/app/assets/javascripts/admin/controllers/admin-search-logs-term.js @@ -14,17 +14,17 @@ export default Controller.extend({ this.searchTypeOptions = [ { id: "all", - name: I18n.t("admin.logs.search_logs.types.all_search_types") + name: I18n.t("admin.logs.search_logs.types.all_search_types"), }, { id: "header", name: I18n.t("admin.logs.search_logs.types.header") }, { id: "full_page", - name: I18n.t("admin.logs.search_logs.types.full_page") + name: I18n.t("admin.logs.search_logs.types.full_page"), }, { id: "click_through_only", - name: I18n.t("admin.logs.search_logs.types.click_through_only") - } + name: I18n.t("admin.logs.search_logs.types.click_through_only"), + }, ]; - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings-category.js b/app/assets/javascripts/admin/controllers/admin-site-settings-category.js index b2c29730ec2..5a12f1d717e 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings-category.js +++ b/app/assets/javascripts/admin/controllers/admin-site-settings-category.js @@ -13,5 +13,5 @@ export default Controller.extend({ @discourseComputed("category") filteredContent(category) { return category ? category.siteSettings : []; - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js b/app/assets/javascripts/admin/controllers/admin-site-settings.js index 0dab07cf97d..493bf579d03 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings.js +++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js @@ -21,7 +21,7 @@ export default Controller.extend({ filter = this.filter .toLowerCase() .split(" ") - .filter(word => { + .filter((word) => { if (word.length === 0) { return false; } @@ -52,13 +52,13 @@ export default Controller.extend({ const all = { nameKey: "all_results", name: I18n.t("admin.site_settings.categories.all_results"), - siteSettings: [] + siteSettings: [], }; const matchesGroupedByCategory = [all]; const matches = []; - this.allSiteSettings.forEach(settingsCategory => { - const siteSettings = settingsCategory.siteSettings.filter(item => { + this.allSiteSettings.forEach((settingsCategory) => { + const siteSettings = settingsCategory.siteSettings.filter((item) => { if (this.onlyOverridden && !item.get("overridden")) return false; if (pluginFilter && item.plugin !== pluginFilter) return false; if (filter) { @@ -66,10 +66,7 @@ export default Controller.extend({ return ( setting.includes(filter) || setting.replace(/_/g, " ").includes(filter) || - item - .get("description") - .toLowerCase() - .includes(filter) || + item.get("description").toLowerCase().includes(filter) || (item.get("value") || "").toLowerCase().includes(filter) ); } else { @@ -84,7 +81,7 @@ export default Controller.extend({ "admin.site_settings.categories." + settingsCategory.nameKey ), siteSettings, - count: siteSettings.length + count: siteSettings.length, }); } }); @@ -109,7 +106,7 @@ export default Controller.extend({ }, @observes("filter", "onlyOverridden", "model") - filterContent: discourseDebounce(function() { + filterContent: discourseDebounce(function () { if (this._skipBounce) { this.set("_skipBounce", false); } else { @@ -124,6 +121,6 @@ export default Controller.extend({ toggleMenu() { $(".admin-detail").toggleClass("mobile-closed mobile-open"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-site-text-edit.js b/app/assets/javascripts/admin/controllers/admin-site-text-edit.js index 91f1103e011..b33bbe39686 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-text-edit.js +++ b/app/assets/javascripts/admin/controllers/admin-site-text-edit.js @@ -27,11 +27,11 @@ export default Controller.extend(bufferedProperty("siteText"), { revertChanges() { this.set("saved", false); - bootbox.confirm(I18n.t("admin.site_text.revert_confirm"), result => { + bootbox.confirm(I18n.t("admin.site_text.revert_confirm"), (result) => { if (result) { this.siteText .revert() - .then(props => { + .then((props) => { const buffered = this.buffered; buffered.setProperties(props); this.commitBuffer(); @@ -39,6 +39,6 @@ export default Controller.extend(bufferedProperty("siteText"), { .catch(popupAjaxError); } }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-site-text-index.js b/app/assets/javascripts/admin/controllers/admin-site-text-index.js index 1a1b266ae10..e46096c751e 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-text-index.js +++ b/app/assets/javascripts/admin/controllers/admin-site-text-index.js @@ -14,7 +14,7 @@ export default Controller.extend({ _performSearch() { this.store .find("site-text", this.getProperties("q", "overridden")) - .then(results => { + .then((results) => { this.set("siteTexts", results); }) .finally(() => this.set("searching", false)); @@ -38,6 +38,6 @@ export default Controller.extend({ debounce(this, this._performSearch, 400); lastSearch = q; } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-user-badges.js b/app/assets/javascripts/admin/controllers/admin-user-badges.js index e08d5ea4a33..6951a7b562e 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-badges.js +++ b/app/assets/javascripts/admin/controllers/admin-user-badges.js @@ -25,7 +25,7 @@ export default Controller.extend(GrantBadgeController, { const allBadges = this.model; let grouped = {}; - allBadges.forEach(b => { + allBadges.forEach((b) => { grouped[b.badge_id] = grouped[b.badge_id] || []; grouped[b.badge_id].push(b); }); @@ -33,16 +33,16 @@ export default Controller.extend(GrantBadgeController, { let expanded = []; const expandedBadges = allBadges.get("expandedBadges") || []; - Object.values(grouped).forEach(function(badges) { + Object.values(grouped).forEach(function (badges) { let lastGranted = badges[0].granted_at; - badges.forEach(badge => { + badges.forEach((badge) => { lastGranted = lastGranted < badge.granted_at ? badge.granted_at : lastGranted; }); if (badges.length === 1 || expandedBadges.includes(badges[0].badge.id)) { - badges.forEach(badge => expanded.push(badge)); + badges.forEach((badge) => expanded.push(badge)); return; } @@ -51,7 +51,7 @@ export default Controller.extend(GrantBadgeController, { granted_at: lastGranted, badges: badges, count: badges.length, - grouped: true + grouped: true, }; expanded.push(result); @@ -61,7 +61,7 @@ export default Controller.extend(GrantBadgeController, { }, actions: { - expandGroup: function(userBadge) { + expandGroup: function (userBadge) { const model = this.model; model.set("expandedBadges", model.get("expandedBadges") || []); model.get("expandedBadges").pushObject(userBadge.badge.id); @@ -83,7 +83,7 @@ export default Controller.extend(GrantBadgeController, { } }); }, - function(error) { + function (error) { popupAjaxError(error); } ); @@ -94,7 +94,7 @@ export default Controller.extend(GrantBadgeController, { I18n.t("admin.badges.revoke_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { userBadge.revoke().then(() => { this.model.removeObject(userBadge); @@ -102,6 +102,6 @@ export default Controller.extend(GrantBadgeController, { } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-user-fields.js b/app/assets/javascripts/admin/controllers/admin-user-fields.js index 813cc19744e..7800dfc6551 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-fields.js +++ b/app/assets/javascripts/admin/controllers/admin-user-fields.js @@ -21,7 +21,7 @@ export default Controller.extend({ createField() { const f = this.store.createRecord("user-field", { field_type: "text", - position: MAX_FIELDS + position: MAX_FIELDS, }); this.model.pushObject(f); }, @@ -53,12 +53,12 @@ export default Controller.extend({ // Only confirm if we already been saved if (f.get("id")) { - bootbox.confirm(I18n.t("admin.user_fields.delete_confirm"), function( + bootbox.confirm(I18n.t("admin.user_fields.delete_confirm"), function ( result ) { if (result) { f.destroyRecord() - .then(function() { + .then(function () { model.removeObject(f); }) .catch(popupAjaxError); @@ -67,6 +67,6 @@ export default Controller.extend({ } else { model.removeObject(f); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js b/app/assets/javascripts/admin/controllers/admin-user-index.js index aa025a8e36e..92101bce2f2 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js @@ -43,14 +43,14 @@ export default Controller.extend(CanCheckEmails, { if (buffer === null) return false; return buffer.length === original.length - ? buffer.any(id => !original.includes(id)) + ? buffer.any((id) => !original.includes(id)) : true; }, @discourseComputed("model.automaticGroups") automaticGroups(automaticGroups) { return automaticGroups - .map(group => { + .map((group) => { const name = htmlSafe(group.name); return `${name}`; }) @@ -65,7 +65,7 @@ export default Controller.extend(CanCheckEmails, { @discourseComputed("model.associated_accounts") associatedAccounts(associatedAccounts) { return associatedAccounts - .map(provider => `${provider.name} (${provider.description})`) + .map((provider) => `${provider.name} (${provider.description})`) .join(", "); }, @@ -91,11 +91,11 @@ export default Controller.extend(CanCheckEmails, { } if (postCount > this.siteSettings.delete_all_posts_max) { return I18n.t("admin.user.cant_delete_all_too_many_posts", { - count: this.siteSettings.delete_all_posts_max + count: this.siteSettings.delete_all_posts_max, }); } else { return I18n.t("admin.user.cant_delete_all_posts", { - count: this.siteSettings.delete_user_max_post_age + count: this.siteSettings.delete_user_max_post_age, }); } }, @@ -110,7 +110,7 @@ export default Controller.extend(CanCheckEmails, { return I18n.t("admin.user.delete_forbidden_because_staff"); } else { return I18n.t("admin.user.delete_forbidden", { - count: this.siteSettings.delete_user_max_post_age + count: this.siteSettings.delete_user_max_post_age, }); } }, @@ -213,7 +213,7 @@ export default Controller.extend(CanCheckEmails, { promptTargetUser() { showModal("admin-merge-users-prompt", { admin: true, - model: this.model + model: this.model, }); }, @@ -222,8 +222,8 @@ export default Controller.extend(CanCheckEmails, { admin: true, model: { username: this.model.username, - targetUsername - } + targetUsername, + }, }); }, @@ -233,7 +233,7 @@ export default Controller.extend(CanCheckEmails, { viewActionLogs() { this.adminTools.showActionLogs(this, { - target_user: this.get("model.username") + target_user: this.get("model.username"), }); }, showSuspendModal() { @@ -253,7 +253,7 @@ export default Controller.extend(CanCheckEmails, { const path = `/users/${oldUsername.toLowerCase()}/preferences/username`; return ajax(path, { data: { new_username: newUsername }, type: "PUT" }) - .catch(e => { + .catch((e) => { this.set("model.username", oldUsername); popupAjaxError(e); }) @@ -267,7 +267,7 @@ export default Controller.extend(CanCheckEmails, { const path = userPath(`${this.get("model.username").toLowerCase()}.json`); return ajax(path, { data: { name: newName }, type: "PUT" }) - .catch(e => { + .catch((e) => { this.set("model.name", oldName); popupAjaxError(e); }) @@ -281,7 +281,7 @@ export default Controller.extend(CanCheckEmails, { const path = userPath(`${this.get("model.username").toLowerCase()}.json`); return ajax(path, { data: { title: newTitle }, type: "PUT" }) - .catch(e => { + .catch((e) => { this.set("model.title", oldTitle); popupAjaxError(e); }) @@ -294,12 +294,12 @@ export default Controller.extend(CanCheckEmails, { const availableGroups = this.availableGroups; bufferedIds - .filter(id => !currentIds.includes(id)) - .forEach(id => this.groupAdded(availableGroups.findBy("id", id))); + .filter((id) => !currentIds.includes(id)) + .forEach((id) => this.groupAdded(availableGroups.findBy("id", id))); currentIds - .filter(id => !bufferedIds.includes(id)) - .forEach(id => this.groupRemoved(id)); + .filter((id) => !bufferedIds.includes(id)) + .forEach((id) => this.groupRemoved(id)); }, resetCustomGroups() { @@ -312,7 +312,7 @@ export default Controller.extend(CanCheckEmails, { return ajax(path, { type: "PUT", - data: { primary_group_id: primaryGroupId } + data: { primary_group_id: primaryGroupId }, }) .then(() => this.set("originalPrimaryGroupId", primaryGroupId)) .catch(() => bootbox.alert(I18n.t("generic_error"))); @@ -320,6 +320,6 @@ export default Controller.extend(CanCheckEmails, { resetPrimaryGroup() { this.set("model.primary_group_id", this.originalPrimaryGroupId); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-users-list-show.js b/app/assets/javascripts/admin/controllers/admin-users-list-show.js index 9f82545dacb..fd20b6c3080 100644 --- a/app/assets/javascripts/admin/controllers/admin-users-list-show.js +++ b/app/assets/javascripts/admin/controllers/admin-users-list-show.js @@ -32,7 +32,7 @@ export default Controller.extend(CanCheckEmails, { }, @observes("listFilter") - _filterUsers: discourseDebounce(function() { + _filterUsers: discourseDebounce(function () { this.resetFilters(); }, INPUT_DELAY), @@ -55,9 +55,9 @@ export default Controller.extend(CanCheckEmails, { show_emails: this.showEmails, order: this.order, asc: this.asc, - page: this._page + page: this._page, }) - .then(result => { + .then((result) => { if (!result || result.length === 0) { this._canLoadMore = false; } @@ -77,6 +77,6 @@ export default Controller.extend(CanCheckEmails, { toggleEmailVisibility() { this.toggleProperty("showEmails"); this.resetFilters(); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js index 6a692b63ab4..373b3caa028 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js +++ b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js @@ -57,7 +57,7 @@ export default Controller.extend({ schedule("afterRender", () => { // remove from other actions lists let match = null; - this.get("adminWatchedWords.model").forEach(action => { + this.get("adminWatchedWords.model").forEach((action) => { if (match) return; if (action.nameKey !== this.actionNameKey) { @@ -80,7 +80,7 @@ export default Controller.extend({ }, uploadComplete() { - WatchedWord.findAll().then(data => { + WatchedWord.findAll().then((data) => { this.set("adminWatchedWords.model", data); }); }, @@ -91,16 +91,16 @@ export default Controller.extend({ I18n.t(`admin.watched_words.clear_all_confirm_${actionKey}`), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { ajax(`/admin/logs/watched_words/action/${actionKey}.json`, { - type: "DELETE" + type: "DELETE", }).then(() => { const action = this.findAction(actionKey); if (action) { action.setProperties({ words: [], - count: 0 + count: 0, }); } }); @@ -110,13 +110,13 @@ export default Controller.extend({ }, test() { - WatchedWord.findAll().then(data => { + WatchedWord.findAll().then((data) => { this.set("adminWatchedWords.model", data); showModal("admin-watched-word-test", { admin: true, - model: this.currentAction + model: this.currentAction, }); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words.js b/app/assets/javascripts/admin/controllers/admin-watched-words.js index 636358c629c..7a9a4ca8dc2 100644 --- a/app/assets/javascripts/admin/controllers/admin-watched-words.js +++ b/app/assets/javascripts/admin/controllers/admin-watched-words.js @@ -28,8 +28,8 @@ export default Controller.extend({ const matchesByAction = []; - this.allWatchedWords.forEach(wordsForAction => { - const wordRecords = wordsForAction.words.filter(wordRecord => { + this.allWatchedWords.forEach((wordsForAction) => { + const wordRecords = wordsForAction.words.filter((wordRecord) => { return wordRecord.word.indexOf(filter) > -1; }); matchesByAction.pushObject( @@ -37,7 +37,7 @@ export default Controller.extend({ nameKey: wordsForAction.nameKey, name: wordsForAction.name, words: wordRecords, - count: wordRecords.length + count: wordRecords.length, }) ); }); @@ -46,7 +46,7 @@ export default Controller.extend({ }, @observes("filter") - filterContent: discourseDebounce(function() { + filterContent: discourseDebounce(function () { this.filterContentNow(); this.set("filtered", !isEmpty(this.filter)); }, INPUT_DELAY), @@ -58,6 +58,6 @@ export default Controller.extend({ toggleMenu() { $(".admin-detail").toggleClass("mobile-closed mobile-open"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js b/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js index 6cd94efb681..49c87926d21 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show-events.js @@ -22,7 +22,7 @@ export default Controller.extend({ subscribe() { this.messageBus.subscribe( `/web_hook_events/${this.get("model.extras.web_hook_id")}`, - data => { + (data) => { if (data.event_type === "ping") { this.set("pingDisabled", false); } @@ -54,9 +54,9 @@ export default Controller.extend({ ajax( `/admin/api/web_hooks/${this.get("model.extras.web_hook_id")}/ping`, { - type: "POST" + type: "POST", } - ).catch(error => { + ).catch((error) => { this.set("pingDisabled", false); popupAjaxError(error); }); @@ -67,14 +67,14 @@ export default Controller.extend({ ajax(`/admin/api/web_hooks/${webHookId}/events/bulk`, { type: "GET", - data: { ids: this.incomingEventIds } - }).then(data => { - const objects = data.map(event => + data: { ids: this.incomingEventIds }, + }).then((data) => { + const objects = data.map((event) => this.store.createRecord("web-hook-event", event) ); this.model.unshiftObjects(objects); this.set("incomingEventIds", []); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js index 2e92b09189b..f2e9f2178d0 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js @@ -45,14 +45,14 @@ export default Controller.extend({ if (secret.indexOf(" ") !== -1) { return EmberObject.create({ failed: true, - reason: I18n.t("admin.web_hooks.secret_invalid") + reason: I18n.t("admin.web_hooks.secret_invalid"), }); } if (secret.length < 12) { return EmberObject.create({ failed: true, - reason: I18n.t("admin.web_hooks.secret_too_short") + reason: I18n.t("admin.web_hooks.secret_too_short"), }); } } @@ -63,7 +63,7 @@ export default Controller.extend({ if (!isWildcard && isEmpty(eventTypes)) { return EmberObject.create({ failed: true, - reason: I18n.t("admin.web_hooks.event_type_missing") + reason: I18n.t("admin.web_hooks.event_type_missing"), }); } }, @@ -117,7 +117,7 @@ export default Controller.extend({ I18n.t("admin.web_hooks.warn_local_payload_url"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { return saveWebHook(); } @@ -133,7 +133,7 @@ export default Controller.extend({ I18n.t("admin.web_hooks.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { const model = this.model; model @@ -146,6 +146,6 @@ export default Controller.extend({ } } ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks.js b/app/assets/javascripts/admin/controllers/admin-web-hooks.js index 213bb249e2b..cc13ea9e9d4 100644 --- a/app/assets/javascripts/admin/controllers/admin-web-hooks.js +++ b/app/assets/javascripts/admin/controllers/admin-web-hooks.js @@ -10,7 +10,7 @@ export default Controller.extend({ I18n.t("admin.web_hooks.delete_confirm"), I18n.t("no_value"), I18n.t("yes_value"), - result => { + (result) => { if (result) { webhook .destroyRecord() @@ -25,6 +25,6 @@ export default Controller.extend({ loadMore() { this.model.loadMore(); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/admin.js b/app/assets/javascripts/admin/controllers/admin.js index 641643d5732..4c51eb38b72 100644 --- a/app/assets/javascripts/admin/controllers/admin.js +++ b/app/assets/javascripts/admin/controllers/admin.js @@ -20,7 +20,7 @@ export default Controller.extend({ adminContentsClassName(currentPath) { let cssClasses = currentPath .split(".") - .filter(segment => { + .filter((segment) => { return ( segment !== "index" && segment !== "loading" && @@ -37,5 +37,5 @@ export default Controller.extend({ } return cssClasses; - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js index da260b409e8..12b2be4f4ab 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-add-upload.js @@ -50,7 +50,7 @@ const SCSS_VARIABLE_NAMES = [ "danger-low", "danger-medium", "success-low", - "love-low" + "love-low", ]; export default Controller.extend(ModalFunctionality, { @@ -77,7 +77,7 @@ export default Controller.extend(ModalFunctionality, { return I18n.t("admin.customize.theme.variable_name_error.no_overwrite"); } else if ( themeFields.some( - tf => + (tf) => THEME_FIELD_VARIABLE_TYPE_IDS.includes(tf.type_id) && name === tf.name ) @@ -119,24 +119,24 @@ export default Controller.extend(ModalFunctionality, { type: "POST", processData: false, contentType: false, - data: new FormData() + data: new FormData(), }; options.data.append("file", file); ajax(this.uploadUrl, options) - .then(result => { + .then((result) => { const upload = { upload_id: result.upload_id, name: this.name, - original_filename: file.name + original_filename: file.name, }; this.adminCustomizeThemesShow.send("addUpload", upload); this.send("closeModal"); }) - .catch(e => { + .catch((e) => { popupAjaxError(e); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js b/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js index 531d3ea6654..90af87cb735 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-badge-preview.js @@ -27,7 +27,7 @@ export default Controller.extend({ queryPlanHtml(queryPlan) { let output = `
`;
 
-    queryPlan.forEach(linehash => {
+    queryPlan.forEach((linehash) => {
       output += escapeExpression(linehash["QUERY PLAN"]);
       output += "
"; }); @@ -36,7 +36,7 @@ export default Controller.extend({ return output; }, - processedSample: map("model.sample", grant => { + processedSample: map("model.sample", (grant) => { let i18nKey = "admin.badges.preview.grant.with"; const i18nParams = { username: escapeExpression(grant.username) }; @@ -55,5 +55,5 @@ export default Controller.extend({ } return I18n.t(i18nKey, i18nParams); - }) + }), }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js b/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js index 1ea601202d9..07f673728fe 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-color-scheme-select-base.js @@ -22,6 +22,6 @@ export default Controller.extend(ModalFunctionality, { this.selectedBaseThemeId ); this.send("closeModal"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js b/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js index 65eb0d00137..cedbf436320 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-edit-badge-groupings.js @@ -14,7 +14,7 @@ export default Controller.extend(ModalFunctionality, { const store = this.store; if (model) { - model.forEach(o => + model.forEach((o) => copy.pushObject(store.createRecord("badge-grouping", o)) ); } @@ -56,23 +56,23 @@ export default Controller.extend(ModalFunctionality, { add() { const obj = this.store.createRecord("badge-grouping", { editing: true, - name: I18n.t("admin.badges.badge_grouping") + name: I18n.t("admin.badges.badge_grouping"), }); this.workingCopy.pushObject(obj); }, saveAll() { let items = this.workingCopy; - const groupIds = items.map(i => i.get("id") || -1); - const names = items.map(i => i.get("name")); + const groupIds = items.map((i) => i.get("id") || -1); + const names = items.map((i) => i.get("name")); ajax("/admin/badges/badge_groupings", { data: { ids: groupIds, names }, - type: "POST" + type: "POST", }).then( - data => { + (data) => { items = this.model; items.clear(); - data.badge_groupings.forEach(g => { + data.badge_groupings.forEach((g) => { items.pushObject(this.store.createRecord("badge-grouping", g)); }); this.setProperties({ model: null, workingCopy: null }); @@ -80,6 +80,6 @@ export default Controller.extend(ModalFunctionality, { }, () => bootbox.alert(I18n.t("generic_error")) ); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-incoming-email.js b/app/assets/javascripts/admin/controllers/modals/admin-incoming-email.js index cca2cc54bf1..45df8e46288 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-incoming-email.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-incoming-email.js @@ -12,15 +12,15 @@ export default Controller.extend(ModalFunctionality, { }, load(id) { - return IncomingEmail.find(id).then(result => this.set("model", result)); + return IncomingEmail.find(id).then((result) => this.set("model", result)); }, loadFromBounced(id) { return IncomingEmail.findByBounced(id) - .then(result => this.set("model", result)) - .catch(error => { + .then((result) => this.set("model", result)) + .catch((error) => { this.send("closeModal"); popupAjaxError(error); }); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js index 7b74bc99641..4bdb6ca85c5 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js @@ -36,13 +36,13 @@ export default Controller.extend(ModalFunctionality, { this.createTypes = [ { name: I18n.t("admin.customize.theme.theme"), value: THEMES }, - { name: I18n.t("admin.customize.theme.component"), value: COMPONENTS } + { name: I18n.t("admin.customize.theme.component"), value: COMPONENTS }, ]; }, @discourseComputed("themesController.installedThemes") themes(installedThemes) { - return POPULAR_THEMES.map(t => { + return POPULAR_THEMES.map((t) => { if (installedThemes.includes(t.name)) { set(t, "installed", true); } @@ -86,10 +86,10 @@ export default Controller.extend(ModalFunctionality, { if (checked && !this._keyLoading) { this._keyLoading = true; ajax(this.keyGenUrl, { type: "POST" }) - .then(pair => { + .then((pair) => { this.setProperties({ privateKey: pair.private_key, - publicKey: pair.public_key + publicKey: pair.public_key, }); }) .catch(popupAjaxError) @@ -156,7 +156,7 @@ export default Controller.extend(ModalFunctionality, { } let options = { - type: "POST" + type: "POST", }; if (this.local) { @@ -169,7 +169,7 @@ export default Controller.extend(ModalFunctionality, { if (this.remote || this.popular) { options.data = { remote: this.uploadUrl, - branch: this.branch + branch: this.branch, }; if (this.privateChecked) { @@ -184,7 +184,7 @@ export default Controller.extend(ModalFunctionality, { this.set("loading", true); ajax(this.importUrl, options) - .then(result => { + .then((result) => { const theme = this.store.createRecord(this.recordType, result.theme); this.adminCustomizeThemes.send("addTheme", theme); this.send("closeModal"); @@ -194,6 +194,6 @@ export default Controller.extend(ModalFunctionality, { }) .catch(popupAjaxError) .finally(() => this.set("loading", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-merge-users-confirmation.js b/app/assets/javascripts/admin/controllers/modals/admin-merge-users-confirmation.js index 08ac66070c3..f2233c07a3b 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-merge-users-confirmation.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-merge-users-confirmation.js @@ -18,7 +18,7 @@ export default Controller.extend(ModalFunctionality, { text(username, targetUsername) { return I18n.t(`admin.user.merge.confirmation.text`, { username, - targetUsername + targetUsername, }); }, @@ -36,5 +36,5 @@ export default Controller.extend(ModalFunctionality, { @action close() { this.send("closeModal"); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-merge-users-prompt.js b/app/assets/javascripts/admin/controllers/modals/admin-merge-users-prompt.js index 28fd6058e40..baaf7cef7a9 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-merge-users-prompt.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-merge-users-prompt.js @@ -26,5 +26,5 @@ export default Controller.extend(ModalFunctionality, { @action close() { this.send("closeModal"); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-reseed.js b/app/assets/javascripts/admin/controllers/modals/admin-reseed.js index a9f52dc86a7..b29a800aa05 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-reseed.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-reseed.js @@ -12,17 +12,17 @@ export default Controller.extend(ModalFunctionality, { onShow() { ajax("/admin/customize/reseed") - .then(result => { + .then((result) => { this.setProperties({ categories: result.categories, - topics: result.topics + topics: result.topics, }); }) .finally(() => this.set("loading", false)); }, _extractSelectedIds(items) { - return items.filter(item => item.selected).map(item => item.id); + return items.filter((item) => item.selected).map((item) => item.id); }, actions: { @@ -31,15 +31,15 @@ export default Controller.extend(ModalFunctionality, { ajax("/admin/customize/reseed", { data: { category_ids: this._extractSelectedIds(this.categories), - topic_ids: this._extractSelectedIds(this.topics) + topic_ids: this._extractSelectedIds(this.topics), }, - type: "POST" + type: "POST", }) .then( () => this.send("closeModal"), () => bootbox.alert(I18n.t("generic_error")) ) .finally(() => this.set("reseeding", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js b/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js index d15264f46b9..e379b903c2e 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-silence-user.js @@ -31,9 +31,9 @@ export default Controller.extend(PenaltyController, { message: this.message, post_id: this.postId, post_action: this.postAction, - post_edit: this.postEdit + post_edit: this.postEdit, }); }).finally(() => this.set("silencing", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js b/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js index c2136e6cc66..2934f251eee 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js @@ -17,6 +17,6 @@ export default Controller.extend(ModalFunctionality, { cancel() { this.send("closeModal"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js b/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js index 03fa9fbc838..4997f629470 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js @@ -32,9 +32,9 @@ export default Controller.extend(PenaltyController, { message: this.message, post_id: this.postId, post_action: this.postAction, - post_edit: this.postEdit + post_edit: this.postEdit, }); }).finally(() => this.set("suspending", false)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-theme-change.js b/app/assets/javascripts/admin/controllers/modals/admin-theme-change.js index e33284d233e..3f58f36d2e1 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-theme-change.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-theme-change.js @@ -7,9 +7,9 @@ export default Controller.extend(ModalFunctionality, { this.set("loading", true); ajax( "/admin/logs/staff_action_logs/" + this.get("model.id") + "/diff" - ).then(diff => { + ).then((diff) => { this.set("loading", false); this.set("diff", diff.side_by_side); }); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js b/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js index 08e1e178e47..2185b7b137f 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.js @@ -22,6 +22,6 @@ export default Controller.extend(ModalFunctionality, { close() { this.save(this.images.join("\n")); this.send("closeModal"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-watched-word-test.js b/app/assets/javascripts/admin/controllers/modals/admin-watched-word-test.js index a3de68d4cd8..7b269eb3369 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-watched-word-test.js +++ b/app/assets/javascripts/admin/controllers/modals/admin-watched-word-test.js @@ -8,5 +8,5 @@ export default Controller.extend(ModalFunctionality, { if (!value || !regexpString) return; let censorRegexp = new RegExp(regexpString, "ig"); return value.match(censorRegexp); - } + }, }); diff --git a/app/assets/javascripts/admin/controllers/modals/site-setting-default-categories.js b/app/assets/javascripts/admin/controllers/modals/site-setting-default-categories.js index 62e77ed8e68..c46fe08b7ba 100644 --- a/app/assets/javascripts/admin/controllers/modals/site-setting-default-categories.js +++ b/app/assets/javascripts/admin/controllers/modals/site-setting-default-categories.js @@ -15,6 +15,6 @@ export default Controller.extend(ModalFunctionality, { cancel() { this.set("updateExistingUsers", false); this.send("closeModal"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/helpers/check-icon.js b/app/assets/javascripts/admin/helpers/check-icon.js index 4641a15fa2a..51fb238550d 100644 --- a/app/assets/javascripts/admin/helpers/check-icon.js +++ b/app/assets/javascripts/admin/helpers/check-icon.js @@ -2,7 +2,7 @@ import { registerUnbound } from "discourse-common/lib/helpers"; import { renderIcon } from "discourse-common/lib/icon-library"; import { htmlSafe } from "@ember/template"; -registerUnbound("check-icon", function(value) { +registerUnbound("check-icon", function (value) { let icon = value ? "check" : "times"; return htmlSafe(renderIcon("string", icon)); }); diff --git a/app/assets/javascripts/admin/helpers/disposition-icon.js b/app/assets/javascripts/admin/helpers/disposition-icon.js index 0e1ea29a271..03960ff289d 100644 --- a/app/assets/javascripts/admin/helpers/disposition-icon.js +++ b/app/assets/javascripts/admin/helpers/disposition-icon.js @@ -23,5 +23,5 @@ export default Helper.extend({ } } return iconHTML(icon, { title }).htmlSafe(); - } + }, }); diff --git a/app/assets/javascripts/admin/helpers/human-size.js b/app/assets/javascripts/admin/helpers/human-size.js index fe543937f18..06094bed343 100644 --- a/app/assets/javascripts/admin/helpers/human-size.js +++ b/app/assets/javascripts/admin/helpers/human-size.js @@ -1,4 +1,4 @@ import I18n from "I18n"; import { htmlHelper } from "discourse-common/lib/helpers"; -export default htmlHelper(size => I18n.toHumanSize(size)); +export default htmlHelper((size) => I18n.toHumanSize(size)); diff --git a/app/assets/javascripts/admin/helpers/post-action-title.js b/app/assets/javascripts/admin/helpers/post-action-title.js index 53b5922ae51..2d8e3c3fe8e 100644 --- a/app/assets/javascripts/admin/helpers/post-action-title.js +++ b/app/assets/javascripts/admin/helpers/post-action-title.js @@ -3,7 +3,7 @@ import Helper from "@ember/component/helper"; function postActionTitle([id, nameKey]) { let title = I18n.t(`admin.flags.short_names.${nameKey}`, { - defaultValue: null + defaultValue: null, }); // TODO: We can remove this once other translations have been updated diff --git a/app/assets/javascripts/admin/helpers/preserve-newlines.js b/app/assets/javascripts/admin/helpers/preserve-newlines.js index 2c4326dc54f..16639f30ccc 100644 --- a/app/assets/javascripts/admin/helpers/preserve-newlines.js +++ b/app/assets/javascripts/admin/helpers/preserve-newlines.js @@ -1,4 +1,6 @@ import { htmlHelper } from "discourse-common/lib/helpers"; import { escapeExpression } from "discourse/lib/utilities"; -export default htmlHelper(str => escapeExpression(str).replace(/\n/g, "
")); +export default htmlHelper((str) => + escapeExpression(str).replace(/\n/g, "
") +); diff --git a/app/assets/javascripts/admin/helpers/value-at-tl.js b/app/assets/javascripts/admin/helpers/value-at-tl.js index 021f6a83e79..9e6b8c7514e 100644 --- a/app/assets/javascripts/admin/helpers/value-at-tl.js +++ b/app/assets/javascripts/admin/helpers/value-at-tl.js @@ -1,9 +1,9 @@ import { registerUnbound } from "discourse-common/lib/helpers"; -registerUnbound("value-at-tl", function(data, params) { +registerUnbound("value-at-tl", function (data, params) { var tl = parseInt(params.level, 10); if (data) { - var item = data.find(function(d) { + var item = data.find(function (d) { return parseInt(d.x, 10) === tl; }); if (item) { diff --git a/app/assets/javascripts/admin/mixins/penalty-controller.js b/app/assets/javascripts/admin/mixins/penalty-controller.js index ca4069a99c9..caf3aee5596 100644 --- a/app/assets/javascripts/admin/mixins/penalty-controller.js +++ b/app/assets/javascripts/admin/mixins/penalty-controller.js @@ -26,7 +26,7 @@ export default Mixin.create(ModalFunctionality, { postAction: "delete", before: null, successCallback: null, - confirmClose: false + confirmClose: false, }); }, @@ -38,7 +38,7 @@ export default Mixin.create(ModalFunctionality, { (this.message && this.message.length > 1)) ) { this.send("hideModal"); - bootbox.confirm(I18n.t("admin.user.confirm_cancel_penalty"), result => { + bootbox.confirm(I18n.t("admin.user.confirm_cancel_penalty"), (result) => { if (result) { next(() => { this.set("confirmClose", true); @@ -58,7 +58,7 @@ export default Mixin.create(ModalFunctionality, { return promise .then(() => cb()) - .then(result => { + .then((result) => { this.set("confirmClose", true); this.send("closeModal"); let callback = this.successCallback; @@ -67,5 +67,5 @@ export default Mixin.create(ModalFunctionality, { } }) .catch(popupAjaxError); - } + }, }); diff --git a/app/assets/javascripts/admin/mixins/period-computation.js b/app/assets/javascripts/admin/mixins/period-computation.js index c7af0e4cb37..1b6a92c61d0 100644 --- a/app/assets/javascripts/admin/mixins/period-computation.js +++ b/app/assets/javascripts/admin/mixins/period-computation.js @@ -14,10 +14,7 @@ export default Mixin.create({ @discourseComputed("period") startDate(period) { - let fullDay = moment() - .locale("en") - .utc() - .subtract(1, "day"); + let fullDay = moment().locale("en").utc().subtract(1, "day"); switch (period) { case "yearly": @@ -39,42 +36,27 @@ export default Mixin.create({ @discourseComputed() lastWeek() { - return moment() - .locale("en") - .utc() - .endOf("day") - .subtract(1, "week"); + return moment().locale("en").utc().endOf("day").subtract(1, "week"); }, @discourseComputed() lastMonth() { - return moment() - .locale("en") - .utc() - .startOf("day") - .subtract(1, "month"); + return moment().locale("en").utc().startOf("day").subtract(1, "month"); }, @discourseComputed() endDate() { - return moment() - .locale("en") - .utc() - .subtract(1, "day") - .endOf("day"); + return moment().locale("en").utc().subtract(1, "day").endOf("day"); }, @discourseComputed() today() { - return moment() - .locale("en") - .utc() - .endOf("day"); + return moment().locale("en").utc().endOf("day"); }, actions: { changePeriod(period) { DiscourseURL.routeTo(this._reportsForPeriodURL(period)); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/mixins/setting-component.js b/app/assets/javascripts/admin/mixins/setting-component.js index 3b1ec456689..4204c4ec90d 100644 --- a/app/assets/javascripts/admin/mixins/setting-component.js +++ b/app/assets/javascripts/admin/mixins/setting-component.js @@ -26,7 +26,7 @@ const CUSTOM_TYPES = [ "group_list", "tag_list", "color", - "simple_list" + "simple_list", ]; const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"]; @@ -60,7 +60,7 @@ export default Mixin.create({ let category = this.site.get("categories.firstObject"); if (category) { return categoryLinkHTML(category, { - categoryStyle: value + categoryStyle: value, }); } } @@ -124,26 +124,30 @@ export default Mixin.create({ return ( defaultValues && defaultValues.length > 0 && - !defaultValues.every(value => bufferedValues.includes(value)) + !defaultValues.every((value) => bufferedValues.includes(value)) ); }, - _watchEnterKey: on("didInsertElement", function() { - $(this.element).on("keydown.setting-enter", ".input-setting-string", e => { - if (e.keyCode === 13) { - // enter key - this.send("save"); + _watchEnterKey: on("didInsertElement", function () { + $(this.element).on( + "keydown.setting-enter", + ".input-setting-string", + (e) => { + if (e.keyCode === 13) { + // enter key + this.send("save"); + } } - }); + ); }), - _removeBindings: on("willDestroyElement", function() { + _removeBindings: on("willDestroyElement", function () { $(this.element).off("keydown.setting-enter"); }), _save() { warn("You should define a `_save` method", { - id: "discourse.setting-component.missing-save" + id: "discourse.setting-component.missing-save", }); return Promise.resolve(); }, @@ -179,7 +183,7 @@ export default Mixin.create({ "default_tags_muted", "default_tags_watching_first_post", "default_text_size", - "default_title_count_mode" + "default_title_count_mode", ]; const key = this.buffered.get("setting"); @@ -189,17 +193,17 @@ export default Mixin.create({ ajax(`/admin/site_settings/${key}/user_count.json`, { type: "PUT", - data - }).then(result => { + data, + }).then((result) => { const count = result.user_count; if (count > 0) { const controller = showModal("site-setting-default-categories", { model: { count: result.user_count, - key: key.replace(/_/g, " ") + key: key.replace(/_/g, " "), }, - admin: true + admin: true, }); controller.set("onClose", () => { @@ -224,7 +228,7 @@ export default Mixin.create({ this.afterSave(); } }) - .catch(e => { + .catch((e) => { if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) { this.set("validationMessage", e.jqXHR.responseJSON.errors[0]); } else { @@ -248,12 +252,9 @@ export default Mixin.create({ setDefaultValues() { this.set( "buffered.value", - this.bufferedValues - .concat(this.defaultValues) - .uniq() - .join("|") + this.bufferedValues.concat(this.defaultValues).uniq().join("|") ); return false; - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/mixins/setting-object.js b/app/assets/javascripts/admin/mixins/setting-object.js index bfacbedc8e0..f971bfb749f 100644 --- a/app/assets/javascripts/admin/mixins/setting-object.js +++ b/app/assets/javascripts/admin/mixins/setting-object.js @@ -16,7 +16,7 @@ export default Mixin.create({ computedValueProperty: computed( "valueProperty", "validValues.[]", - function() { + function () { if (isPresent(this.valueProperty)) { return this.valueProperty; } @@ -29,7 +29,7 @@ export default Mixin.create({ } ), - computedNameProperty: computed("nameProperty", "validValues.[]", function() { + computedNameProperty: computed("nameProperty", "validValues.[]", function () { if (isPresent(this.nameProperty)) { return this.nameProperty; } @@ -46,7 +46,7 @@ export default Mixin.create({ const vals = [], translateNames = this.translate_names; - validValues.forEach(v => { + validValues.forEach((v) => { if (v.name && v.name.length > 0 && translateNames) { vals.addObject({ name: I18n.t(v.name), value: v.value }); } else { @@ -61,5 +61,5 @@ export default Mixin.create({ if (validValues && validValues.indexOf("") >= 0) { return "admin.settings.none"; } - } + }, }); diff --git a/app/assets/javascripts/admin/models/admin-dashboard.js b/app/assets/javascripts/admin/models/admin-dashboard.js index 756de2cc091..dec30faf2da 100644 --- a/app/assets/javascripts/admin/models/admin-dashboard.js +++ b/app/assets/javascripts/admin/models/admin-dashboard.js @@ -4,14 +4,14 @@ import EmberObject from "@ember/object"; const GENERAL_ATTRIBUTES = [ "updated_at", "discourse_updated_at", - "release_notes_link" + "release_notes_link", ]; const AdminDashboard = EmberObject.extend({}); AdminDashboard.reopenClass({ fetch() { - return ajax("/admin/dashboard.json").then(json => { + return ajax("/admin/dashboard.json").then((json) => { const model = AdminDashboard.create(); model.set("version_check", json.version_check); return model; @@ -19,16 +19,16 @@ AdminDashboard.reopenClass({ }, fetchGeneral() { - return ajax("/admin/dashboard/general.json").then(json => { + return ajax("/admin/dashboard/general.json").then((json) => { const model = AdminDashboard.create(); const attributes = {}; - GENERAL_ATTRIBUTES.forEach(a => (attributes[a] = json[a])); + GENERAL_ATTRIBUTES.forEach((a) => (attributes[a] = json[a])); model.setProperties({ reports: json.reports, attributes, - loaded: true + loaded: true, }); return model; @@ -36,12 +36,12 @@ AdminDashboard.reopenClass({ }, fetchProblems() { - return ajax("/admin/dashboard/problems.json").then(json => { + return ajax("/admin/dashboard/problems.json").then((json) => { const model = AdminDashboard.create(json); model.set("loaded", true); return model; }); - } + }, }); export default AdminDashboard; diff --git a/app/assets/javascripts/admin/models/admin-user.js b/app/assets/javascripts/admin/models/admin-user.js index 8ab76f2947c..5882910093d 100644 --- a/app/assets/javascripts/admin/models/admin-user.js +++ b/app/assets/javascripts/admin/models/admin-user.js @@ -12,12 +12,12 @@ import { Promise } from "rsvp"; import User from "discourse/models/user"; import bootbox from "bootbox"; -const wrapAdmin = user => (user ? AdminUser.create(user) : null); +const wrapAdmin = (user) => (user ? AdminUser.create(user) : null); const AdminUser = User.extend({ adminUserView: true, - customGroups: filter("groups", g => !g.automatic && Group.create(g)), - automaticGroups: filter("groups", g => g.automatic && Group.create(g)), + customGroups: filter("groups", (g) => !g.automatic && Group.create(g)), + automaticGroups: filter("groups", (g) => g.automatic && Group.create(g)), canViewProfile: or("active", "staged"), @@ -52,11 +52,11 @@ const AdminUser = User.extend({ resetBounceScore() { return ajax(`/admin/users/${this.id}/reset_bounce_score`, { - type: "POST" + type: "POST", }).then(() => this.setProperties({ bounce_score: 0, - reset_bounce_score_after: null + reset_bounce_score_after: null, }) ); }, @@ -64,13 +64,13 @@ const AdminUser = User.extend({ groupAdded(added) { return ajax(`/admin/users/${this.id}/groups`, { type: "POST", - data: { group_id: added.id } + data: { group_id: added.id }, }).then(() => this.groups.pushObject(added)); }, groupRemoved(groupId) { return ajax(`/admin/users/${this.id}/groups/${groupId}`, { - type: "DELETE" + type: "DELETE", }).then(() => { this.set("groups.[]", this.groups.rejectBy("id", groupId)); if (this.primary_group_id === groupId) { @@ -86,14 +86,14 @@ const AdminUser = User.extend({ "admin.user.delete_all_posts_confirm_MF", { POSTS: user.get("post_count"), - TOPICS: user.get("topic_count") + TOPICS: user.get("topic_count"), } ); const buttons = [ { label: I18n.t("composer.cancel"), class: "d-modal-cancel", - link: true + link: true, }, { label: @@ -103,8 +103,8 @@ const AdminUser = User.extend({ callback: () => { openProgressModal(); performDelete(); - } - } + }, + }, ]; const openProgressModal = () => { bootbox.dialog( @@ -118,7 +118,7 @@ const AdminUser = User.extend({ const performDelete = () => { let deletedPercentage = 0; return ajax(`/admin/users/${user.get("id")}/delete_posts_batch`, { - type: "PUT" + type: "PUT", }) .then(({ posts_deleted }) => { if (posts_deleted === 0) { @@ -130,15 +130,15 @@ const AdminUser = User.extend({ (deletedPosts * 100) / user.get("post_count") ); $(".delete-posts-progress .progress-bar > span").css({ - width: `${deletedPercentage}%` + width: `${deletedPercentage}%`, }); performDelete(); } }) - .catch(e => { + .catch((e) => { bootbox.hideAll(); let error; - AdminUser.find(user.get("id")).then(u => user.setProperties(u)); + AdminUser.find(user.get("id")).then((u) => user.setProperties(u)); if (e.responseJSON && e.responseJSON.errors) { error = e.responseJSON.errors[0]; } @@ -152,19 +152,19 @@ const AdminUser = User.extend({ revokeAdmin() { return ajax(`/admin/users/${this.id}/revoke_admin`, { - type: "PUT" + type: "PUT", }).then(() => { this.setProperties({ admin: false, can_grant_admin: true, - can_revoke_admin: false + can_revoke_admin: false, }); }); }, grantAdmin() { return ajax(`/admin/users/${this.id}/grant_admin`, { - type: "PUT" + type: "PUT", }) .then(() => { bootbox.alert(I18n.t("admin.user.grant_admin_confirm")); @@ -174,13 +174,13 @@ const AdminUser = User.extend({ revokeModeration() { return ajax(`/admin/users/${this.id}/revoke_moderation`, { - type: "PUT" + type: "PUT", }) .then(() => { this.setProperties({ moderator: false, can_grant_moderation: true, - can_revoke_moderation: false + can_revoke_moderation: false, }); }) .catch(popupAjaxError); @@ -188,13 +188,13 @@ const AdminUser = User.extend({ grantModeration() { return ajax(`/admin/users/${this.id}/grant_moderation`, { - type: "PUT" + type: "PUT", }) .then(() => { this.setProperties({ moderator: true, can_grant_moderation: false, - can_revoke_moderation: true + can_revoke_moderation: true, }); }) .catch(popupAjaxError); @@ -202,7 +202,7 @@ const AdminUser = User.extend({ disableSecondFactor() { return ajax(`/admin/users/${this.id}/disable_second_factor`, { - type: "PUT" + type: "PUT", }) .then(() => { this.set("second_factor_enabled", false); @@ -212,12 +212,12 @@ const AdminUser = User.extend({ approve(approvedBy) { return ajax(`/admin/users/${this.id}/approve`, { - type: "PUT" + type: "PUT", }).then(() => { this.setProperties({ can_approve: false, approved: true, - approved_by: approvedBy + approved_by: approvedBy, }); }); }, @@ -231,10 +231,10 @@ const AdminUser = User.extend({ saveTrustLevel() { return ajax(`/admin/users/${this.id}/trust_level`, { type: "PUT", - data: { level: this.trust_level } + data: { level: this.trust_level }, }) .then(() => window.location.reload()) - .catch(e => { + .catch((e) => { let error; if (e.responseJSON && e.responseJSON.errors) { error = e.responseJSON.errors[0]; @@ -242,7 +242,7 @@ const AdminUser = User.extend({ error = error || I18n.t("admin.user.trust_level_change_failed", { - error: this._formatError(e) + error: this._formatError(e), }); bootbox.alert(error); }); @@ -255,10 +255,10 @@ const AdminUser = User.extend({ lockTrustLevel(locked) { return ajax(`/admin/users/${this.id}/trust_level_lock`, { type: "PUT", - data: { locked: !!locked } + data: { locked: !!locked }, }) .then(() => window.location.reload()) - .catch(e => { + .catch((e) => { let error; if (e.responseJSON && e.responseJSON.errors) { error = e.responseJSON.errors[0]; @@ -266,7 +266,7 @@ const AdminUser = User.extend({ error = error || I18n.t("admin.user.trust_level_change_failed", { - error: this._formatError(e) + error: this._formatError(e), }); bootbox.alert(error); }); @@ -286,30 +286,30 @@ const AdminUser = User.extend({ suspend(data) { return ajax(`/admin/users/${this.id}/suspend`, { type: "PUT", - data - }).then(result => this.setProperties(result.suspension)); + data, + }).then((result) => this.setProperties(result.suspension)); }, unsuspend() { return ajax(`/admin/users/${this.id}/unsuspend`, { - type: "PUT" - }).then(result => this.setProperties(result.suspension)); + type: "PUT", + }).then((result) => this.setProperties(result.suspension)); }, logOut() { return ajax("/admin/users/" + this.id + "/log_out", { type: "POST", - data: { username_or_email: this.username } + data: { username_or_email: this.username }, }).then(() => bootbox.alert(I18n.t("admin.user.logged_out"))); }, impersonate() { return ajax("/admin/impersonate", { type: "POST", - data: { username_or_email: this.username } + data: { username_or_email: this.username }, }) .then(() => (document.location = getURL("/"))) - .catch(e => { + .catch((e) => { if (e.status === 404) { bootbox.alert(I18n.t("admin.impersonate.not_found")); } else { @@ -320,12 +320,12 @@ const AdminUser = User.extend({ activate() { return ajax(`/admin/users/${this.id}/activate`, { - type: "PUT" + type: "PUT", }) .then(() => window.location.reload()) - .catch(e => { + .catch((e) => { const error = I18n.t("admin.user.activate_failed", { - error: this._formatError(e) + error: this._formatError(e), }); bootbox.alert(error); }); @@ -334,12 +334,12 @@ const AdminUser = User.extend({ deactivate() { return ajax(`/admin/users/${this.id}/deactivate`, { type: "PUT", - data: { context: document.location.pathname } + data: { context: document.location.pathname }, }) .then(() => window.location.reload()) - .catch(e => { + .catch((e) => { const error = I18n.t("admin.user.deactivate_failed", { - error: this._formatError(e) + error: this._formatError(e), }); bootbox.alert(error); }); @@ -349,12 +349,12 @@ const AdminUser = User.extend({ this.set("silencingUser", true); return ajax(`/admin/users/${this.id}/unsilence`, { - type: "PUT" + type: "PUT", }) - .then(result => this.setProperties(result.unsilence)) - .catch(e => { + .then((result) => this.setProperties(result.unsilence)) + .catch((e) => { const error = I18n.t("admin.user.unsilence_failed", { - error: this._formatError(e) + error: this._formatError(e), }); bootbox.alert(error); }) @@ -365,12 +365,12 @@ const AdminUser = User.extend({ this.set("silencingUser", true); return ajax(`/admin/users/${this.id}/silence`, { type: "PUT", - data + data, }) - .then(result => this.setProperties(result.silence)) - .catch(e => { + .then((result) => this.setProperties(result.silence)) + .catch((e) => { const error = I18n.t("admin.user.silence_failed", { - error: this._formatError(e) + error: this._formatError(e), }); bootbox.alert(error); }) @@ -380,7 +380,7 @@ const AdminUser = User.extend({ sendActivationEmail() { return ajax(userPath("action/send_activation_email"), { type: "POST", - data: { username: this.username } + data: { username: this.username }, }) .then(() => bootbox.alert(I18n.t("admin.user.activation_email_sent"))) .catch(popupAjaxError); @@ -390,11 +390,11 @@ const AdminUser = User.extend({ const user = this; const message = I18n.t("admin.user.anonymize_confirm"); - const performAnonymize = function() { + const performAnonymize = function () { return ajax(`/admin/users/${user.get("id")}/anonymize.json`, { - type: "PUT" + type: "PUT", }) - .then(function(data) { + .then(function (data) { if (data.success) { if (data.username) { document.location = getURL( @@ -417,17 +417,17 @@ const AdminUser = User.extend({ { label: I18n.t("composer.cancel"), class: "cancel", - link: true + link: true, }, { label: `${iconHTML("exclamation-triangle")} ` + I18n.t("admin.user.anonymize_yes"), class: "btn btn-danger", - callback: function() { + callback: function () { performAnonymize(); - } - } + }, + }, ]; bootbox.dialog(message, buttons, { classes: "delete-user-modal" }); @@ -438,7 +438,7 @@ const AdminUser = User.extend({ const message = I18n.t("admin.user.delete_confirm"); const location = document.location.pathname; - const performDestroy = function(block) { + const performDestroy = function (block) { bootbox.dialog(I18n.t("admin.user.deleting_user")); let formData = { context: location }; if (block) { @@ -451,9 +451,9 @@ const AdminUser = User.extend({ } return ajax(`/admin/users/${user.get("id")}.json`, { type: "DELETE", - data: formData + data: formData, }) - .then(function(data) { + .then(function (data) { if (data.deleted) { if (/^\/admin\/users\/list\//.test(location)) { document.location = location; @@ -467,8 +467,8 @@ const AdminUser = User.extend({ } } }) - .catch(function() { - AdminUser.find(user.get("id")).then(u => user.setProperties(u)); + .catch(function () { + AdminUser.find(user.get("id")).then((u) => user.setProperties(u)); bootbox.alert(I18n.t("admin.user.delete_failed")); }); }; @@ -477,24 +477,24 @@ const AdminUser = User.extend({ { label: I18n.t("composer.cancel"), class: "btn", - link: true + link: true, }, { label: `${iconHTML("exclamation-triangle")} ` + I18n.t("admin.user.delete_and_block"), class: "btn btn-danger", - callback: function() { + callback: function () { performDestroy(true); - } + }, }, { label: I18n.t("admin.user.delete_dont_block"), class: "btn btn-primary", - callback: function() { + callback: function () { performDestroy(false); - } - } + }, + }, ]; bootbox.dialog(message, buttons, { classes: "delete-user-modal" }); @@ -513,9 +513,9 @@ const AdminUser = User.extend({ return ajax(`/admin/users/${user.id}/merge.json`, { type: "POST", - data: formData + data: formData, }) - .then(data => { + .then((data) => { if (data.merged) { if (/^\/admin\/users\/list\//.test(location)) { DiscourseURL.redirectTo(location); @@ -532,7 +532,7 @@ const AdminUser = User.extend({ } }) .catch(() => { - AdminUser.find(user.id).then(u => user.setProperties(u)); + AdminUser.find(user.id).then((u) => user.setProperties(u)); bootbox.alert(I18n.t("admin.user.merge_failed")); }); }, @@ -542,7 +542,7 @@ const AdminUser = User.extend({ return Promise.resolve(this); } - return AdminUser.find(this.id).then(result => { + return AdminUser.find(this.id).then((result) => { const userProperties = Object.assign(result, { loadedDetails: true }); this.setProperties(userProperties); }); @@ -566,12 +566,12 @@ const AdminUser = User.extend({ _formatError(event) { return `http: ${event.status} - ${event.body}`; - } + }, }); AdminUser.reopenClass({ find(user_id) { - return ajax(`/admin/users/${user_id}.json`).then(result => { + return ajax(`/admin/users/${user_id}.json`).then((result) => { result.loadedDetails = true; return AdminUser.create(result); }); @@ -579,9 +579,9 @@ AdminUser.reopenClass({ findAll(query, userFilter) { return ajax(`/admin/users/list/${query}.json`, { - data: userFilter - }).then(users => users.map(u => AdminUser.create(u))); - } + data: userFilter, + }).then((users) => users.map((u) => AdminUser.create(u))); + }, }); export default AdminUser; diff --git a/app/assets/javascripts/admin/models/api-key.js b/app/assets/javascripts/admin/models/api-key.js index e5f9724feef..b9d6c07d2a3 100644 --- a/app/assets/javascripts/admin/models/api-key.js +++ b/app/assets/javascripts/admin/models/api-key.js @@ -17,7 +17,7 @@ const ApiKey = RestModel.extend({ this.set("_user", value); } return this._user; - } + }, }), @discourseComputed("description") @@ -30,14 +30,14 @@ const ApiKey = RestModel.extend({ revoke() { return ajax(`${this.basePath}/revoke`, { - type: "POST" - }).then(result => this.setProperties(result.api_key)); + type: "POST", + }).then((result) => this.setProperties(result.api_key)); }, undoRevoke() { return ajax(`${this.basePath}/undo-revoke`, { - type: "POST" - }).then(result => this.setProperties(result.api_key)); + type: "POST", + }).then((result) => this.setProperties(result.api_key)); }, createProperties() { @@ -49,7 +49,7 @@ const ApiKey = RestModel.extend({ return this.store .adapterFor("api-key") .pathFor(this.store, "api-key", this.id); - } + }, }); export default ApiKey; diff --git a/app/assets/javascripts/admin/models/backup-status.js b/app/assets/javascripts/admin/models/backup-status.js index 62c360b5326..474c3c16889 100644 --- a/app/assets/javascripts/admin/models/backup-status.js +++ b/app/assets/javascripts/admin/models/backup-status.js @@ -8,5 +8,5 @@ export default EmberObject.extend({ @discourseComputed("allowRestore", "isOperationRunning") restoreEnabled(allowRestore, isOperationRunning) { return allowRestore && !isOperationRunning; - } + }, }); diff --git a/app/assets/javascripts/admin/models/backup.js b/app/assets/javascripts/admin/models/backup.js index e44a945bf0e..4112b06f2b7 100644 --- a/app/assets/javascripts/admin/models/backup.js +++ b/app/assets/javascripts/admin/models/backup.js @@ -14,19 +14,19 @@ const Backup = EmberObject.extend({ restore() { return ajax("/admin/backups/" + this.filename + "/restore", { type: "POST", - data: { client_id: MessageBus.clientId } + data: { client_id: MessageBus.clientId }, }); - } + }, }); Backup.reopenClass({ find() { return ajax("/admin/backups.json") - .then(backups => backups.map(backup => Backup.create(backup))) - .catch(error => { + .then((backups) => backups.map((backup) => Backup.create(backup))) + .catch((error) => { bootbox.alert( I18n.t("admin.backups.backup_storage_error", { - error_message: extractError(error) + error_message: extractError(error), }) ); return []; @@ -41,9 +41,9 @@ Backup.reopenClass({ type: "POST", data: { with_uploads: withUploads, - client_id: MessageBus.clientId - } - }).then(result => { + client_id: MessageBus.clientId, + }, + }).then((result) => { if (!result.success) { bootbox.alert(result.message); } @@ -52,8 +52,8 @@ Backup.reopenClass({ cancel() { return ajax("/admin/backups/cancel.json", { - type: "DELETE" - }).then(result => { + type: "DELETE", + }).then((result) => { if (!result.success) { bootbox.alert(result.message); } @@ -62,8 +62,8 @@ Backup.reopenClass({ rollback() { return ajax("/admin/backups/rollback.json", { - type: "POST" - }).then(result => { + type: "POST", + }).then((result) => { if (!result.success) { bootbox.alert(result.message); } else { @@ -71,7 +71,7 @@ Backup.reopenClass({ window.location = getURL("/"); } }); - } + }, }); export default Backup; diff --git a/app/assets/javascripts/admin/models/color-scheme-color.js b/app/assets/javascripts/admin/models/color-scheme-color.js index e55fa258f80..98cdfa13f4f 100644 --- a/app/assets/javascripts/admin/models/color-scheme-color.js +++ b/app/assets/javascripts/admin/models/color-scheme-color.js @@ -1,7 +1,7 @@ import I18n from "I18n"; import discourseComputed, { observes, - on + on, } from "discourse-common/utils/decorators"; import { propertyNotEqual } from "discourse/lib/computed"; import EmberObject from "@ember/object"; @@ -98,7 +98,7 @@ const ColorSchemeColor = EmberObject.extend({ @discourseComputed("hex") valid(hex) { return hex.match(/^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/) !== null; - } + }, }); export default ColorSchemeColor; diff --git a/app/assets/javascripts/admin/models/color-scheme.js b/app/assets/javascripts/admin/models/color-scheme.js index 28457d9d287..aa160835cfb 100644 --- a/app/assets/javascripts/admin/models/color-scheme.js +++ b/app/assets/javascripts/admin/models/color-scheme.js @@ -25,7 +25,7 @@ const ColorScheme = EmberObject.extend({ schemeJson() { const buffer = []; - this.colors.forEach(c => { + this.colors.forEach((c) => { buffer.push(` "${c.get("name")}": "${c.get("hex")}"`); }); @@ -36,9 +36,9 @@ const ColorScheme = EmberObject.extend({ const newScheme = ColorScheme.create({ name: this.name, can_edit: true, - colors: A() + colors: A(), }); - this.colors.forEach(c => { + this.colors.forEach((c) => { newScheme.colors.pushObject( ColorSchemeColor.create(c.getProperties("name", "hex", "default_hex")) ); @@ -50,7 +50,7 @@ const ColorScheme = EmberObject.extend({ changed(name) { if (!this.originals) return false; if (this.originals.name !== name) return true; - if (this.colors.any(c => c.get("changed"))) return true; + if (this.colors.any((c) => c.get("changed"))) return true; return false; }, @@ -61,7 +61,7 @@ const ColorScheme = EmberObject.extend({ return false; } - return !changed || this.saving || this.colors.any(c => !c.get("valid")); + return !changed || this.saving || this.colors.any((c) => !c.get("valid")); }, newRecord: not("id"), @@ -77,7 +77,7 @@ const ColorScheme = EmberObject.extend({ data.name = this.name; data.base_scheme_id = this.base_scheme_id; data.colors = []; - this.colors.forEach(c => { + this.colors.forEach((c) => { if (!this.id || c.get("changed")) { data.colors.pushObject(c.getProperties("name", "hex")); } @@ -90,16 +90,16 @@ const ColorScheme = EmberObject.extend({ data: JSON.stringify({ color_scheme: data }), type: this.id ? "PUT" : "POST", dataType: "json", - contentType: "application/json" + contentType: "application/json", } - ).then(result => { + ).then((result) => { if (result.id) { this.set("id", result.id); } if (!opts || !opts.enabledOnly) { this.startTrackingChanges(); - this.colors.forEach(c => c.startTrackingChanges()); + this.colors.forEach((c) => c.startTrackingChanges()); } this.setProperties({ savingStatus: I18n.t("saved"), saving: false }); @@ -114,7 +114,7 @@ const ColorScheme = EmberObject.extend({ data: JSON.stringify({ color_scheme: { user_selectable: value } }), type: "PUT", dataType: "json", - contentType: "application/json" + contentType: "application/json", }); }, @@ -122,7 +122,7 @@ const ColorScheme = EmberObject.extend({ if (this.id) { return ajax(`/admin/color_schemes/${this.id}`, { type: "DELETE" }); } - } + }, }); const ColorSchemes = ArrayProxy.extend({}); @@ -130,8 +130,8 @@ const ColorSchemes = ArrayProxy.extend({}); ColorScheme.reopenClass({ findAll() { const colorSchemes = ColorSchemes.create({ content: [], loading: true }); - return ajax("/admin/color_schemes").then(all => { - all.forEach(colorScheme => { + return ajax("/admin/color_schemes").then((all) => { + all.forEach((colorScheme) => { colorSchemes.pushObject( ColorScheme.create({ id: colorScheme.id, @@ -141,20 +141,20 @@ ColorScheme.reopenClass({ theme_name: colorScheme.theme_name, base_scheme_id: colorScheme.base_scheme_id, user_selectable: colorScheme.user_selectable, - colors: colorScheme.colors.map(c => { + colors: colorScheme.colors.map((c) => { return ColorSchemeColor.create({ name: c.name, hex: c.hex, default_hex: c.default_hex, - is_advanced: c.is_advanced + is_advanced: c.is_advanced, }); - }) + }), }) ); }); return colorSchemes; }); - } + }, }); export default ColorScheme; diff --git a/app/assets/javascripts/admin/models/email-log.js b/app/assets/javascripts/admin/models/email-log.js index 9e1f0f5472d..18406ceb7a6 100644 --- a/app/assets/javascripts/admin/models/email-log.js +++ b/app/assets/javascripts/admin/models/email-log.js @@ -28,9 +28,9 @@ EmailLog.reopenClass({ delete filter.status; return ajax(`/admin/email/${status}.json?offset=${offset}`, { - data: filter - }).then(logs => logs.map(log => EmailLog.create(log))); - } + data: filter, + }).then((logs) => logs.map((log) => EmailLog.create(log))); + }, }); export default EmailLog; diff --git a/app/assets/javascripts/admin/models/email-preview.js b/app/assets/javascripts/admin/models/email-preview.js index 42b7ab58789..893fb5b4fb8 100644 --- a/app/assets/javascripts/admin/models/email-preview.js +++ b/app/assets/javascripts/admin/models/email-preview.js @@ -4,24 +4,21 @@ import EmberObject from "@ember/object"; const EmailPreview = EmberObject.extend({}); export function oneWeekAgo() { - return moment() - .locale("en") - .subtract(7, "days") - .format("YYYY-MM-DD"); + return moment().locale("en").subtract(7, "days").format("YYYY-MM-DD"); } EmailPreview.reopenClass({ findDigest(username, lastSeenAt) { return ajax("/admin/email/preview-digest.json", { - data: { last_seen_at: lastSeenAt || oneWeekAgo(), username } - }).then(result => EmailPreview.create(result)); + data: { last_seen_at: lastSeenAt || oneWeekAgo(), username }, + }).then((result) => EmailPreview.create(result)); }, sendDigest(username, lastSeenAt, email) { return ajax("/admin/email/send-digest.json", { - data: { last_seen_at: lastSeenAt || oneWeekAgo(), username, email } + data: { last_seen_at: lastSeenAt || oneWeekAgo(), username, email }, }); - } + }, }); export default EmailPreview; diff --git a/app/assets/javascripts/admin/models/email-settings.js b/app/assets/javascripts/admin/models/email-settings.js index 1730aae7c94..52ac14acec9 100644 --- a/app/assets/javascripts/admin/models/email-settings.js +++ b/app/assets/javascripts/admin/models/email-settings.js @@ -4,11 +4,11 @@ import EmberObject from "@ember/object"; const EmailSettings = EmberObject.extend({}); EmailSettings.reopenClass({ - find: function() { - return ajax("/admin/email.json").then(function(settings) { + find: function () { + return ajax("/admin/email.json").then(function (settings) { return EmailSettings.create(settings); }); - } + }, }); export default EmailSettings; diff --git a/app/assets/javascripts/admin/models/email-style.js b/app/assets/javascripts/admin/models/email-style.js index 29d7568aba0..3dd991d70ac 100644 --- a/app/assets/javascripts/admin/models/email-style.js +++ b/app/assets/javascripts/admin/models/email-style.js @@ -6,5 +6,5 @@ export default RestModel.extend({ setField(fieldName, value) { this.set(`${fieldName}`, value); this.set("changed", true); - } + }, }); diff --git a/app/assets/javascripts/admin/models/email-template.js b/app/assets/javascripts/admin/models/email-template.js index 550148e0abe..b58da0457f7 100644 --- a/app/assets/javascripts/admin/models/email-template.js +++ b/app/assets/javascripts/admin/models/email-template.js @@ -5,9 +5,9 @@ const { getProperties } = Ember; export default RestModel.extend({ revert() { return ajax(`/admin/customize/email_templates/${this.id}`, { - type: "DELETE" - }).then(result => + type: "DELETE", + }).then((result) => getProperties(result.email_template, "subject", "body", "can_revert") ); - } + }, }); diff --git a/app/assets/javascripts/admin/models/flag-type.js b/app/assets/javascripts/admin/models/flag-type.js index 1079110045f..607cb755d85 100644 --- a/app/assets/javascripts/admin/models/flag-type.js +++ b/app/assets/javascripts/admin/models/flag-type.js @@ -6,5 +6,5 @@ export default RestModel.extend({ @discourseComputed("id") name(id) { return I18n.t(`admin.flags.summary.action_type_${id}`, { count: 1 }); - } + }, }); diff --git a/app/assets/javascripts/admin/models/incoming-email.js b/app/assets/javascripts/admin/models/incoming-email.js index a5054c5d88b..42eb995f851 100644 --- a/app/assets/javascripts/admin/models/incoming-email.js +++ b/app/assets/javascripts/admin/models/incoming-email.js @@ -31,15 +31,15 @@ IncomingEmail.reopenClass({ delete filter.status; return ajax(`/admin/email/${status}.json?offset=${offset}`, { - data: filter - }).then(incomings => - incomings.map(incoming => IncomingEmail.create(incoming)) + data: filter, + }).then((incomings) => + incomings.map((incoming) => IncomingEmail.create(incoming)) ); }, loadRawEmail(id) { return ajax(`/admin/email/incoming/${id}/raw.json`); - } + }, }); export default IncomingEmail; diff --git a/app/assets/javascripts/admin/models/permalink.js b/app/assets/javascripts/admin/models/permalink.js index b13dcd6f529..de61b27fd40 100644 --- a/app/assets/javascripts/admin/models/permalink.js +++ b/app/assets/javascripts/admin/models/permalink.js @@ -5,42 +5,42 @@ import Category from "discourse/models/category"; import EmberObject from "@ember/object"; const Permalink = EmberObject.extend({ - save: function() { + save: function () { return ajax("/admin/permalinks.json", { type: "POST", data: { url: this.url, permalink_type: this.permalink_type, - permalink_type_value: this.permalink_type_value - } + permalink_type_value: this.permalink_type_value, + }, }); }, @discourseComputed("category_id") - category: function(category_id) { + category: function (category_id) { return Category.findById(category_id); }, @discourseComputed("external_url") - linkIsExternal: function(external_url) { + linkIsExternal: function (external_url) { return !DiscourseURL.isInternal(external_url); }, - destroy: function() { + destroy: function () { return ajax("/admin/permalinks/" + this.id + ".json", { - type: "DELETE" + type: "DELETE", }); - } + }, }); Permalink.reopenClass({ - findAll: function(filter) { + findAll: function (filter) { return ajax("/admin/permalinks.json", { data: { filter: filter } }).then( - function(permalinks) { - return permalinks.map(p => Permalink.create(p)); + function (permalinks) { + return permalinks.map((p) => Permalink.create(p)); } ); - } + }, }); export default Permalink; diff --git a/app/assets/javascripts/admin/models/report.js b/app/assets/javascripts/admin/models/report.js index 508fb4d959c..7713c06c4f4 100644 --- a/app/assets/javascripts/admin/models/report.js +++ b/app/assets/javascripts/admin/models/report.js @@ -10,7 +10,7 @@ import round from "discourse/lib/round"; import { fillMissingDates, formatUsername, - toNumber + toNumber, } from "discourse/lib/utilities"; import { number, durationTiny } from "discourse/lib/formatter"; import { renderAvatar } from "discourse/helpers/user-avatar"; @@ -28,15 +28,9 @@ const Report = EmberObject.extend({ @discourseComputed("type", "start_date", "end_date") reportUrl(type, start_date, end_date) { - start_date = moment - .utc(start_date) - .locale("en") - .format("YYYY-MM-DD"); + start_date = moment.utc(start_date).locale("en").format("YYYY-MM-DD"); - end_date = moment - .utc(end_date) - .locale("en") - .format("YYYY-MM-DD"); + end_date = moment.utc(end_date).locale("en").format("YYYY-MM-DD"); return getURL( `/admin/reports/${type}?start_date=${start_date}&end_date=${end_date}` @@ -49,7 +43,7 @@ const Report = EmberObject.extend({ .subtract(numDaysAgo, "days") .locale("en") .format("YYYY-MM-DD"); - const item = this.data.find(d => d.x === wantedDate); + const item = this.data.find((d) => d.x === wantedDate); if (item) { return item.y; } @@ -59,16 +53,12 @@ const Report = EmberObject.extend({ valueFor(startDaysAgo, endDaysAgo) { if (this.data) { - const earliestDate = moment() - .subtract(endDaysAgo, "days") - .startOf("day"); - const latestDate = moment() - .subtract(startDaysAgo, "days") - .startOf("day"); + const earliestDate = moment().subtract(endDaysAgo, "days").startOf("day"); + const latestDate = moment().subtract(startDaysAgo, "days").startOf("day"); let d, sum = 0, count = 0; - this.data.forEach(datum => { + this.data.forEach((datum) => { d = moment(datum.x); if (d >= earliestDate && d <= latestDate) { sum += datum.y; @@ -218,7 +208,7 @@ const Report = EmberObject.extend({ return I18n.t("admin.dashboard.reports.trend_title", { percent, prev, - current + current, }); }, @@ -268,7 +258,7 @@ const Report = EmberObject.extend({ @discourseComputed("labels") computedLabels(labels) { - return labels.map(label => { + return labels.map((label) => { const type = label.type || "string"; let mainProperty; @@ -317,9 +307,9 @@ const Report = EmberObject.extend({ value, type, property: mainProperty, - formatedValue: value ? escapeExpression(value) : "—" + formatedValue: value ? escapeExpression(value) : "—", }; - } + }, }; }); }, @@ -333,7 +323,7 @@ const Report = EmberObject.extend({ const user = EmberObject.create({ username, name: formatUsername(username), - avatar_template: row[properties.avatar] + avatar_template: row[properties.avatar], }); const href = getURL(`/admin/users/${userId}/${username}`); @@ -341,7 +331,7 @@ const Report = EmberObject.extend({ const avatarImg = renderAvatar(user, { imageSize: "tiny", ignoreTitle: true, - siteSettings: this.siteSettings + siteSettings: this.siteSettings, }); return `${avatarImg}${user.name}`; @@ -349,7 +339,7 @@ const Report = EmberObject.extend({ return { value: username, - formatedValue: username ? formatedValue() : "—" + formatedValue: username ? formatedValue() : "—", }; }, @@ -364,7 +354,7 @@ const Report = EmberObject.extend({ return { value: topicTitle, - formatedValue: topicTitle ? formatedValue() : "—" + formatedValue: topicTitle ? formatedValue() : "—", }; }, @@ -380,21 +370,21 @@ const Report = EmberObject.extend({ formatedValue: postTitle && href ? `${escapeExpression(postTitle)}` - : "—" + : "—", }; }, _secondsLabel(value) { return { value: toNumber(value), - formatedValue: durationTiny(value) + formatedValue: durationTiny(value), }; }, _percentLabel(value) { return { value: toNumber(value), - formatedValue: value ? `${value}%` : "—" + formatedValue: value ? `${value}%` : "—", }; }, @@ -407,21 +397,21 @@ const Report = EmberObject.extend({ return { value: toNumber(value), - formatedValue: value ? formatedValue() : "—" + formatedValue: value ? formatedValue() : "—", }; }, _bytesLabel(value) { return { value: toNumber(value), - formatedValue: I18n.toHumanSize(value) + formatedValue: I18n.toHumanSize(value), }; }, _dateLabel(value, date, format = "LL") { return { value, - formatedValue: value ? date.format(format) : "—" + formatedValue: value ? date.format(format) : "—", }; }, @@ -430,7 +420,7 @@ const Report = EmberObject.extend({ return { value, - formatedValue: value ? escaped : "—" + formatedValue: value ? escaped : "—", }; }, @@ -445,7 +435,7 @@ const Report = EmberObject.extend({ return { value, - formatedValue: value ? formatedValue(value, row[properties[1]]) : "—" + formatedValue: value ? formatedValue(value, row[properties[1]]) : "—", }; }, @@ -482,7 +472,7 @@ const Report = EmberObject.extend({ default: return "minus"; } - } + }, }); Report.reopenClass({ @@ -503,7 +493,7 @@ Report.reopenClass({ .format("YYYY-MM-DD"); if (report.modes[0] === "stacked_chart") { - report[filledField] = report[dataField].map(rep => { + report[filledField] = report[dataField].map((rep) => { return { req: rep.req, label: rep.label, @@ -512,7 +502,7 @@ Report.reopenClass({ JSON.parse(JSON.stringify(rep.data)), startDateFormatted, endDateFormatted - ) + ), }; }); } else { @@ -531,9 +521,9 @@ Report.reopenClass({ start_date: startDate, end_date: endDate, category_id: categoryId, - group_id: groupId - } - }).then(json => { + group_id: groupId, + }, + }).then((json) => { // don’t fill for large multi column tables // which are not date based const modes = json.report.modes; @@ -547,7 +537,7 @@ Report.reopenClass({ if (json.report.related_report) { // TODO: fillMissingDates if xaxis is date const related = Report.create({ - type: json.report.related_report.type + type: json.report.related_report.type, }); related.setProperties(json.report.related_report); model.set("relatedReport", related); @@ -555,7 +545,7 @@ Report.reopenClass({ return model; }); - } + }, }); export default Report; diff --git a/app/assets/javascripts/admin/models/screened-email.js b/app/assets/javascripts/admin/models/screened-email.js index df2fa40ff96..4e902488d17 100644 --- a/app/assets/javascripts/admin/models/screened-email.js +++ b/app/assets/javascripts/admin/models/screened-email.js @@ -9,23 +9,23 @@ const ScreenedEmail = EmberObject.extend({ return I18n.t("admin.logs.screened_actions." + action); }, - clearBlock: function() { + clearBlock: function () { return ajax("/admin/logs/screened_emails/" + this.id, { - type: "DELETE" + type: "DELETE", }); - } + }, }); ScreenedEmail.reopenClass({ - findAll: function() { - return ajax("/admin/logs/screened_emails.json").then(function( + findAll: function () { + return ajax("/admin/logs/screened_emails.json").then(function ( screened_emails ) { - return screened_emails.map(function(b) { + return screened_emails.map(function (b) { return ScreenedEmail.create(b); }); }); - } + }, }); export default ScreenedEmail; diff --git a/app/assets/javascripts/admin/models/screened-ip-address.js b/app/assets/javascripts/admin/models/screened-ip-address.js index 585acb9b790..33e2b443178 100644 --- a/app/assets/javascripts/admin/models/screened-ip-address.js +++ b/app/assets/javascripts/admin/models/screened-ip-address.js @@ -26,29 +26,31 @@ const ScreenedIpAddress = EmberObject.extend({ type: this.id ? "PUT" : "POST", data: { ip_address: this.ip_address, - action_name: this.action_name - } + action_name: this.action_name, + }, } ); }, destroy() { return ajax("/admin/logs/screened_ip_addresses/" + this.id + ".json", { - type: "DELETE" + type: "DELETE", }); - } + }, }); ScreenedIpAddress.reopenClass({ findAll(filter) { return ajax("/admin/logs/screened_ip_addresses.json", { - data: { filter: filter } - }).then(screened_ips => screened_ips.map(b => ScreenedIpAddress.create(b))); + data: { filter: filter }, + }).then((screened_ips) => + screened_ips.map((b) => ScreenedIpAddress.create(b)) + ); }, rollUp() { return ajax("/admin/logs/screened_ip_addresses/roll_up", { type: "POST" }); - } + }, }); export default ScreenedIpAddress; diff --git a/app/assets/javascripts/admin/models/screened-url.js b/app/assets/javascripts/admin/models/screened-url.js index 4cde3d12618..a7bc7cfa6f8 100644 --- a/app/assets/javascripts/admin/models/screened-url.js +++ b/app/assets/javascripts/admin/models/screened-url.js @@ -7,17 +7,19 @@ const ScreenedUrl = EmberObject.extend({ @discourseComputed("action") actionName(action) { return I18n.t("admin.logs.screened_actions." + action); - } + }, }); ScreenedUrl.reopenClass({ - findAll: function() { - return ajax("/admin/logs/screened_urls.json").then(function(screened_urls) { - return screened_urls.map(function(b) { + findAll: function () { + return ajax("/admin/logs/screened_urls.json").then(function ( + screened_urls + ) { + return screened_urls.map(function (b) { return ScreenedUrl.create(b); }); }); - } + }, }); export default ScreenedUrl; diff --git a/app/assets/javascripts/admin/models/site-setting.js b/app/assets/javascripts/admin/models/site-setting.js index a131e6dfde9..2c982fd4493 100644 --- a/app/assets/javascripts/admin/models/site-setting.js +++ b/app/assets/javascripts/admin/models/site-setting.js @@ -7,21 +7,21 @@ const SiteSetting = EmberObject.extend(Setting, {}); SiteSetting.reopenClass({ findAll() { - return ajax("/admin/site_settings").then(function(settings) { + return ajax("/admin/site_settings").then(function (settings) { // Group the results by category const categories = {}; - settings.site_settings.forEach(function(s) { + settings.site_settings.forEach(function (s) { if (!categories[s.category]) { categories[s.category] = []; } categories[s.category].pushObject(SiteSetting.create(s)); }); - return Object.keys(categories).map(function(n) { + return Object.keys(categories).map(function (n) { return { nameKey: n, name: I18n.t("admin.site_settings.categories." + n), - siteSettings: categories[n] + siteSettings: categories[n], }; }); }); @@ -36,7 +36,7 @@ SiteSetting.reopenClass({ } return ajax(`/admin/site_settings/${key}`, { type: "PUT", data }); - } + }, }); export default SiteSetting; diff --git a/app/assets/javascripts/admin/models/site-text.js b/app/assets/javascripts/admin/models/site-text.js index 793ab33b546..7dcd614402f 100644 --- a/app/assets/javascripts/admin/models/site-text.js +++ b/app/assets/javascripts/admin/models/site-text.js @@ -5,7 +5,7 @@ const { getProperties } = Ember; export default RestModel.extend({ revert() { return ajax(`/admin/customize/site_texts/${this.id}`, { - type: "DELETE" - }).then(result => getProperties(result.site_text, "value", "can_revert")); - } + type: "DELETE", + }).then((result) => getProperties(result.site_text, "value", "can_revert")); + }, }); diff --git a/app/assets/javascripts/admin/models/staff-action-log.js b/app/assets/javascripts/admin/models/staff-action-log.js index 5dc942da957..09d84b67910 100644 --- a/app/assets/javascripts/admin/models/staff-action-log.js +++ b/app/assets/javascripts/admin/models/staff-action-log.js @@ -56,7 +56,7 @@ const StaffActionLog = RestModel.extend({ format("admin.logs.ip_address", ipAddress), format("admin.logs.topic_id", topicLink, false), format("admin.logs.post_id", postLink, false), - format("admin.logs.category_id", categoryId) + format("admin.logs.category_id", categoryId), ]; if (!useCustomModalForDetails) { @@ -70,7 +70,7 @@ const StaffActionLog = RestModel.extend({ lines = [...lines, ...escapeExpression(details).split("\n")]; } - const formatted = lines.filter(l => l.length > 0).join("
"); + const formatted = lines.filter((l) => l.length > 0).join("
"); return formatted.length > 0 ? formatted + "
" : ""; }, @@ -82,7 +82,7 @@ const StaffActionLog = RestModel.extend({ @discourseComputed("action_name") useCustomModalForDetails(actionName) { return ["change_theme", "delete_theme"].includes(actionName); - } + }, }); StaffActionLog.reopenClass({ @@ -97,15 +97,17 @@ StaffActionLog.reopenClass({ }, findAll(data) { - return ajax("/admin/logs/staff_action_logs.json", { data }).then(result => { - return { - staff_action_logs: result.staff_action_logs.map(s => - StaffActionLog.create(s) - ), - user_history_actions: result.user_history_actions - }; - }); - } + return ajax("/admin/logs/staff_action_logs.json", { data }).then( + (result) => { + return { + staff_action_logs: result.staff_action_logs.map((s) => + StaffActionLog.create(s) + ), + user_history_actions: result.user_history_actions, + }; + } + ); + }, }); export default StaffActionLog; diff --git a/app/assets/javascripts/admin/models/theme.js b/app/assets/javascripts/admin/models/theme.js index 32bcdb2cc06..f3daec98e95 100644 --- a/app/assets/javascripts/admin/models/theme.js +++ b/app/assets/javascripts/admin/models/theme.js @@ -37,16 +37,16 @@ const Theme = RestModel.extend({ name: "translations", icon: "globe", advanced: true, - customNames: true + customNames: true, }, { id: 5, name: "extra_scss", icon: "paint-brush", advanced: true, - customNames: true - } - ].map(target => { + customNames: true, + }, + ].map((target) => { target["edited"] = this.hasEdited(target.name); target["error"] = this.hasError(target.name); return target; @@ -61,12 +61,12 @@ const Theme = RestModel.extend({ "header", "after_header", "body_tag", - "footer" + "footer", ]; const scss_fields = (this.theme_fields || []) - .filter(f => f.target === "extra_scss" && f.name !== "") - .map(f => f.name); + .filter((f) => f.target === "extra_scss" && f.name !== "") + .map((f) => f.name); if (scss_fields.length < 1) { scss_fields.push("importable_scss"); @@ -80,10 +80,10 @@ const Theme = RestModel.extend({ translations: [ "en", ...(this.theme_fields || []) - .filter(f => f.target === "translations" && f.name !== "en") - .map(f => f.name) + .filter((f) => f.target === "translations" && f.name !== "en") + .map((f) => f.name), ], - extra_scss: scss_fields + extra_scss: scss_fields, }; }, @@ -94,12 +94,12 @@ const Theme = RestModel.extend({ ) fields(fieldNames) { const hash = {}; - Object.keys(fieldNames).forEach(target => { - hash[target] = fieldNames[target].map(fieldName => { + Object.keys(fieldNames).forEach((target) => { + hash[target] = fieldNames[target].map((fieldName) => { const field = { name: fieldName, edited: this.hasEdited(target, fieldName), - error: this.hasError(target, fieldName) + error: this.hasError(target, fieldName), }; if (target === "translations" || target === "extra_scss") { @@ -129,7 +129,7 @@ const Theme = RestModel.extend({ } let hash = {}; - fields.forEach(field => { + fields.forEach((field) => { if (!field.type_id || FIELDS_IDS.includes(field.type_id)) { hash[this.getKey(field)] = field; } @@ -143,19 +143,21 @@ const Theme = RestModel.extend({ return []; } return fields.filter( - f => f.target === "common" && f.type_id === THEME_UPLOAD_VAR + (f) => f.target === "common" && f.type_id === THEME_UPLOAD_VAR ); }, @discourseComputed("theme_fields", "theme_fields.@each.error") isBroken(fields) { - return fields && fields.any(field => field.error && field.error.length > 0); + return ( + fields && fields.any((field) => field.error && field.error.length > 0) + ); }, @discourseComputed("theme_fields.[]") editedFields(fields) { return fields.filter( - field => !isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID + (field) => !isBlank(field.value) && field.type_id !== SETTINGS_TYPE_ID ); }, @@ -176,15 +178,15 @@ const Theme = RestModel.extend({ } else { let fields = this.theme_fields || []; return fields.any( - field => field.target === target && !isEmpty(field.value) + (field) => field.target === target && !isEmpty(field.value) ); } }, hasError(target, name) { return this.theme_fields - .filter(f => f.target === target && (!name || name === f.name)) - .any(f => f.error); + .filter((f) => f.target === target && (!name || name === f.name)) + .any((f) => f.error); }, getError(target, name) { @@ -219,7 +221,7 @@ const Theme = RestModel.extend({ if (type_id && type_id > 1) { let fields = this.theme_fields; let existing = fields.find( - f => f.target === target && f.name === name && f.type_id === type_id + (f) => f.target === target && f.name === name && f.type_id === type_id ); if (existing) { existing.value = value; @@ -253,7 +255,7 @@ const Theme = RestModel.extend({ @discourseComputed("childThemes.[]") child_theme_ids(childThemes) { if (childThemes) { - return childThemes.map(theme => get(theme, "id")); + return childThemes.map((theme) => get(theme, "id")); } }, @@ -290,11 +292,11 @@ const Theme = RestModel.extend({ }, updateToLatest() { - return ajax(this.diffLocalChangesUrl).then(json => { + return ajax(this.diffLocalChangesUrl).then((json) => { if (json && json.error) { bootbox.alert( I18n.t("generic_error_with_reason", { - error: json.error + error: json.error, }) ); } else if (json && json.diff) { @@ -305,7 +307,7 @@ const Theme = RestModel.extend({ )}
`, I18n.t("cancel"), I18n.t("admin.customize.theme.update_confirm_yes"), - result => { + (result) => { if (result) { return this.save({ remote_update: true }).then(() => this.set("changed", false) @@ -340,7 +342,7 @@ const Theme = RestModel.extend({ saveTranslation(name, value) { return this.save({ translations: { [name]: value } }); - } + }, }); export default Theme; diff --git a/app/assets/javascripts/admin/models/tl3-requirements.js b/app/assets/javascripts/admin/models/tl3-requirements.js index 6331333de7c..a6b31363b9b 100644 --- a/app/assets/javascripts/admin/models/tl3-requirements.js +++ b/app/assets/javascripts/admin/models/tl3-requirements.js @@ -69,7 +69,7 @@ export default EmberObject.extend({ this.num_likes_received_users >= this.min_likes_received_users, level_locked: this.trust_level_locked, silenced: this.get("penalty_counts.silenced") === 0, - suspended: this.get("penalty_counts.suspended") === 0 + suspended: this.get("penalty_counts.suspended") === 0, }; - } + }, }); diff --git a/app/assets/javascripts/admin/models/user-field.js b/app/assets/javascripts/admin/models/user-field.js index 78c004d4183..495be7a08d0 100644 --- a/app/assets/javascripts/admin/models/user-field.js +++ b/app/assets/javascripts/admin/models/user-field.js @@ -5,7 +5,7 @@ import { i18n } from "discourse/lib/computed"; const UserField = RestModel.extend(); const UserFieldType = EmberObject.extend({ - name: i18n("id", "admin.user_fields.field_types.%@") + name: i18n("id", "admin.user_fields.field_types.%@"), }); UserField.reopenClass({ @@ -14,7 +14,7 @@ UserField.reopenClass({ this._fieldTypes = [ UserFieldType.create({ id: "text" }), UserFieldType.create({ id: "confirm" }), - UserFieldType.create({ id: "dropdown", hasOptions: true }) + UserFieldType.create({ id: "dropdown", hasOptions: true }), ]; } @@ -23,7 +23,7 @@ UserField.reopenClass({ fieldTypeById(id) { return this.fieldTypes().findBy("id", id); - } + }, }); export default UserField; diff --git a/app/assets/javascripts/admin/models/version-check.js b/app/assets/javascripts/admin/models/version-check.js index cc888b25884..53882d6eca4 100644 --- a/app/assets/javascripts/admin/models/version-check.js +++ b/app/assets/javascripts/admin/models/version-check.js @@ -30,13 +30,15 @@ const VersionCheck = EmberObject.extend({ if (installedSHA) { return installedSHA.substr(0, 10); } - } + }, }); VersionCheck.reopenClass({ find() { - return ajax("/admin/version_check").then(json => VersionCheck.create(json)); - } + return ajax("/admin/version_check").then((json) => + VersionCheck.create(json) + ); + }, }); export default VersionCheck; diff --git a/app/assets/javascripts/admin/models/watched-word.js b/app/assets/javascripts/admin/models/watched-word.js index 6713a8a6055..938b25f7bc6 100644 --- a/app/assets/javascripts/admin/models/watched-word.js +++ b/app/assets/javascripts/admin/models/watched-word.js @@ -9,47 +9,47 @@ const WatchedWord = EmberObject.extend({ { type: this.id ? "PUT" : "POST", data: { word: this.word, action_key: this.action }, - dataType: "json" + dataType: "json", } ); }, destroy() { return ajax("/admin/logs/watched_words/" + this.id + ".json", { - type: "DELETE" + type: "DELETE", }); - } + }, }); WatchedWord.reopenClass({ findAll() { - return ajax("/admin/logs/watched_words.json").then(list => { + return ajax("/admin/logs/watched_words.json").then((list) => { const actions = {}; - list.words.forEach(s => { + list.words.forEach((s) => { if (!actions[s.action]) { actions[s.action] = []; } actions[s.action].pushObject(WatchedWord.create(s)); }); - list.actions.forEach(a => { + list.actions.forEach((a) => { if (!actions[a]) { actions[a] = []; } }); - return Object.keys(actions).map(n => { + return Object.keys(actions).map((n) => { return EmberObject.create({ nameKey: n, name: I18n.t("admin.watched_words.actions." + n), words: actions[n], count: actions[n].length, regularExpressions: list.regular_expressions, - compiledRegularExpression: list.compiled_regular_expressions[n] + compiledRegularExpression: list.compiled_regular_expressions[n], }); }); }); - } + }, }); export default WatchedWord; diff --git a/app/assets/javascripts/admin/models/web-hook.js b/app/assets/javascripts/admin/models/web-hook.js index b727ea59d10..677d76aa88d 100644 --- a/app/assets/javascripts/admin/models/web-hook.js +++ b/app/assets/javascripts/admin/models/web-hook.js @@ -21,7 +21,7 @@ export default RestModel.extend({ }, set(value) { this.set("wildcard_web_hook", value === "wildcard"); - } + }, }, @discourseComputed("category_ids") @@ -51,7 +51,7 @@ export default RestModel.extend({ description(isWildcardWebHook, types) { let desc = ""; - types.forEach(type => { + types.forEach((type) => { const name = `${type.name.toLowerCase()}_event`; desc += desc !== "" ? `, ${name}` : name; }); @@ -61,7 +61,7 @@ export default RestModel.extend({ createProperties() { const types = this.web_hook_event_types; - const categoryIds = this.categories.map(c => c.id); + const categoryIds = this.categories.map((c) => c.id); const tagNames = this.tag_names; // Hack as {{group-selector}} accepts a comma-separated string as data source, but @@ -79,7 +79,7 @@ export default RestModel.extend({ active: this.active, web_hook_event_type_ids: isEmpty(types) ? [null] - : types.map(type => type.id), + : types.map((type) => type.id), category_ids: isEmpty(categoryIds) ? [null] : categoryIds, tag_names: isEmpty(tagNames) ? [null] : tagNames, group_ids: @@ -90,11 +90,11 @@ export default RestModel.extend({ groupIds.push(g.id); } return groupIds; - }, []) + }, []), }; }, updateProperties() { return this.createProperties(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-api-index.js b/app/assets/javascripts/admin/routes/admin-api-index.js index f770f90c913..05c999b6323 100644 --- a/app/assets/javascripts/admin/routes/admin-api-index.js +++ b/app/assets/javascripts/admin/routes/admin-api-index.js @@ -3,5 +3,5 @@ import Route from "@ember/routing/route"; export default Route.extend({ beforeModel() { this.transitionTo("adminApiKeys"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-api-keys-index.js b/app/assets/javascripts/admin/routes/admin-api-keys-index.js index 25f6df3e4af..cdf77212133 100644 --- a/app/assets/javascripts/admin/routes/admin-api-keys-index.js +++ b/app/assets/javascripts/admin/routes/admin-api-keys-index.js @@ -3,5 +3,5 @@ import Route from "@ember/routing/route"; export default Route.extend({ model() { return this.store.findAll("api-key"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-api-keys-new.js b/app/assets/javascripts/admin/routes/admin-api-keys-new.js index 63b248cd1a7..af26a308485 100644 --- a/app/assets/javascripts/admin/routes/admin-api-keys-new.js +++ b/app/assets/javascripts/admin/routes/admin-api-keys-new.js @@ -7,11 +7,11 @@ export default Route.extend({ }, setupController(controller, model) { - ajax("/admin/api/keys/scopes.json").then(data => { + ajax("/admin/api/keys/scopes.json").then((data) => { controller.setProperties({ scopes: data.scopes, - model + model, }); }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-api-keys-show.js b/app/assets/javascripts/admin/routes/admin-api-keys-show.js index 0355241c037..37d9b24119e 100644 --- a/app/assets/javascripts/admin/routes/admin-api-keys-show.js +++ b/app/assets/javascripts/admin/routes/admin-api-keys-show.js @@ -3,5 +3,5 @@ import Route from "@ember/routing/route"; export default Route.extend({ model(params) { return this.store.find("api-key", params.api_key_id); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-api-keys.js b/app/assets/javascripts/admin/routes/admin-api-keys.js index 1b3f3067fcc..bc733cc2bf4 100644 --- a/app/assets/javascripts/admin/routes/admin-api-keys.js +++ b/app/assets/javascripts/admin/routes/admin-api-keys.js @@ -8,6 +8,6 @@ export default Route.extend({ new() { this.transitionTo("adminApiKeys.new"); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-backups-index.js b/app/assets/javascripts/admin/routes/admin-backups-index.js index d463819a2aa..aee755b7051 100644 --- a/app/assets/javascripts/admin/routes/admin-backups-index.js +++ b/app/assets/javascripts/admin/routes/admin-backups-index.js @@ -3,10 +3,10 @@ import Backup from "admin/models/backup"; export default Route.extend({ activate() { - this.messageBus.subscribe("/admin/backups", backups => + this.messageBus.subscribe("/admin/backups", (backups) => this.controller.set( "model", - backups.map(backup => Backup.create(backup)) + backups.map((backup) => Backup.create(backup)) ) ); }, @@ -17,5 +17,5 @@ export default Route.extend({ deactivate() { this.messageBus.unsubscribe("/admin/backups"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-backups-logs.js b/app/assets/javascripts/admin/routes/admin-backups-logs.js index 2535a730bc4..e2e3a933c8b 100644 --- a/app/assets/javascripts/admin/routes/admin-backups-logs.js +++ b/app/assets/javascripts/admin/routes/admin-backups-logs.js @@ -8,15 +8,15 @@ export default Route.extend({ beforeModel() { const logs = this.controllerFor("adminBackupsLogs").get("logs"); // preload the logs if any - PreloadStore.getAndRemove("logs").then(function(preloadedLogs) { + PreloadStore.getAndRemove("logs").then(function (preloadedLogs) { if (preloadedLogs && preloadedLogs.length) { // we need to filter out message like: "[SUCCESS]" // and convert POJOs to Ember Objects const newLogs = preloadedLogs - .filter(log => { + .filter((log) => { return log.message.length > 0 && log.message[0] !== "["; }) - .map(log => EmberObject.create(log)); + .map((log) => EmberObject.create(log)); logs.pushObjects(newLogs); } }); @@ -24,5 +24,5 @@ export default Route.extend({ setupController() { /* prevent default behavior */ - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-backups.js b/app/assets/javascripts/admin/routes/admin-backups.js index 10dd19e06b6..41c6cb0f8b5 100644 --- a/app/assets/javascripts/admin/routes/admin-backups.js +++ b/app/assets/javascripts/admin/routes/admin-backups.js @@ -14,16 +14,14 @@ const LOG_CHANNEL = "/admin/backups/logs"; export default DiscourseRoute.extend({ activate() { - this.messageBus.subscribe(LOG_CHANNEL, log => { + this.messageBus.subscribe(LOG_CHANNEL, (log) => { if (log.message === "[STARTED]") { User.currentProp("hideReadOnlyAlert", true); this.controllerFor("adminBackups").set( "model.isOperationRunning", true ); - this.controllerFor("adminBackupsLogs") - .get("logs") - .clear(); + this.controllerFor("adminBackupsLogs").get("logs").clear(); } else if (log.message === "[FAILED]") { this.controllerFor("adminBackups").set( "model.isOperationRunning", @@ -31,7 +29,7 @@ export default DiscourseRoute.extend({ ); bootbox.alert( I18n.t("admin.backups.operations.failed", { - operation: log.operation + operation: log.operation, }) ); } else if (log.message === "[SUCCESS]") { @@ -55,11 +53,11 @@ export default DiscourseRoute.extend({ model() { return PreloadStore.getAndRemove("operations_status", () => ajax("/admin/backups/status.json") - ).then(status => + ).then((status) => BackupStatus.create({ isOperationRunning: status.is_operation_running, canRollback: status.can_rollback, - allowRestore: status.allow_restore + allowRestore: status.allow_restore, }) ); }, @@ -84,13 +82,15 @@ export default DiscourseRoute.extend({ I18n.t("admin.backups.operations.destroy.confirm"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { - backup.destroy().then(() => - this.controllerFor("adminBackupsIndex") - .get("model") - .removeObject(backup) - ); + backup + .destroy() + .then(() => + this.controllerFor("adminBackupsIndex") + .get("model") + .removeObject(backup) + ); } } ); @@ -101,7 +101,7 @@ export default DiscourseRoute.extend({ I18n.t("admin.backups.operations.restore.confirm"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { this.transitionTo("admin.backups.logs"); backup.restore(); @@ -115,7 +115,7 @@ export default DiscourseRoute.extend({ I18n.t("admin.backups.operations.cancel.confirm"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { Backup.cancel().then(() => { this.controllerFor("adminBackups").set( @@ -133,7 +133,7 @@ export default DiscourseRoute.extend({ I18n.t("admin.backups.operations.rollback.confirm"), I18n.t("no_value"), I18n.t("yes_value"), - confirmed => { + (confirmed) => { if (confirmed) { Backup.rollback(); } @@ -152,12 +152,12 @@ export default DiscourseRoute.extend({ }, remoteUploadSuccess() { - Backup.find().then(backups => { + Backup.find().then((backups) => { this.controllerFor("adminBackupsIndex").set( "model", - backups.map(backup => Backup.create(backup)) + backups.map((backup) => Backup.create(backup)) ); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-badges-award.js b/app/assets/javascripts/admin/routes/admin-badges-award.js index 90a4cba17f8..ee6cf4b8257 100644 --- a/app/assets/javascripts/admin/routes/admin-badges-award.js +++ b/app/assets/javascripts/admin/routes/admin-badges-award.js @@ -8,5 +8,5 @@ export default Route.extend({ parseInt(params.badge_id, 10) ); } - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-badges-index.js b/app/assets/javascripts/admin/routes/admin-badges-index.js index 36a44148777..0f44e83d048 100644 --- a/app/assets/javascripts/admin/routes/admin-badges-index.js +++ b/app/assets/javascripts/admin/routes/admin-badges-index.js @@ -5,20 +5,20 @@ const badgeIntroLinks = [ { text: "admin.badges.badge_intro.what_are_badges_title", href: "https://meta.discourse.org/t/32540", - icon: "book" + icon: "book", }, { text: "admin.badges.badge_intro.badge_query_examples_title", href: "https://meta.discourse.org/t/18978", - icon: "book" - } + icon: "book", + }, ]; export default Route.extend({ setupController(controller) { controller.setProperties({ badgeIntroLinks, - badgeIntroEmoji: emojiUrlFor("woman_student:t4") + badgeIntroEmoji: emojiUrlFor("woman_student:t4"), }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-badges-show.js b/app/assets/javascripts/admin/routes/admin-badges-show.js index 125ae9430c0..c95cae8afa2 100644 --- a/app/assets/javascripts/admin/routes/admin-badges-show.js +++ b/app/assets/javascripts/admin/routes/admin-badges-show.js @@ -14,7 +14,7 @@ export default Route.extend({ model(params) { if (params.badge_id === "new") { return Badge.create({ - name: I18n.t("admin.badges.new_badge") + name: I18n.t("admin.badges.new_badge"), }); } return this.modelFor("adminBadges").findBy( @@ -28,7 +28,7 @@ export default Route.extend({ let msg = I18n.t("generic_error"); if (e.responseJSON && e.responseJSON.errors) { msg = I18n.t("generic_error_with_reason", { - error: e.responseJSON.errors.join(". ") + error: e.responseJSON.errors.join(". "), }); } bootbox.alert(msg); @@ -47,19 +47,19 @@ export default Route.extend({ sql: badge.get("query"), target_posts: !!badge.get("target_posts"), trigger: badge.get("trigger"), - explain - } + explain, + }, }) - .then(function(model) { + .then(function (model) { badge.set("preview_loading", false); showModal("admin-badge-preview", { model, admin: true }); }) - .catch(function(error) { + .catch(function (error) { badge.set("preview_loading", false); // eslint-disable-next-line no-console console.error(error); bootbox.alert("Network error"); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-badges.js b/app/assets/javascripts/admin/routes/admin-badges.js index ab6de98504b..59bc0944cbf 100644 --- a/app/assets/javascripts/admin/routes/admin-badges.js +++ b/app/assets/javascripts/admin/routes/admin-badges.js @@ -8,7 +8,7 @@ export default DiscourseRoute.extend({ _json: null, model() { - return ajax("/admin/badges.json").then(json => { + return ajax("/admin/badges.json").then((json) => { this._json = json; return Badge.createFromJson(json); }); @@ -19,15 +19,15 @@ export default DiscourseRoute.extend({ const badgeTriggers = []; const badgeGroupings = []; - Object.keys(json.admin_badges.triggers).forEach(k => { + Object.keys(json.admin_badges.triggers).forEach((k) => { const id = json.admin_badges.triggers[k]; badgeTriggers.push({ id, - name: I18n.t("admin.badges.trigger_type." + k) + name: I18n.t("admin.badges.trigger_type." + k), }); }); - json.badge_groupings.forEach(function(badgeGroupingJson) { + json.badge_groupings.forEach(function (badgeGroupingJson) { badgeGroupings.push(BadgeGrouping.create(badgeGroupingJson)); }); @@ -36,7 +36,7 @@ export default DiscourseRoute.extend({ badgeTypes: json.badge_types, protectedSystemFields: json.admin_badges.protected_system_fields, badgeTriggers, - model + model, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-colors-show.js b/app/assets/javascripts/admin/routes/admin-customize-colors-show.js index 8807df2c566..35353d31f73 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-colors-show.js +++ b/app/assets/javascripts/admin/routes/admin-customize-colors-show.js @@ -13,5 +13,5 @@ export default Route.extend({ setupController(controller, model) { controller.set("model", model); controller.set("allColors", this.modelFor("adminCustomize.colors")); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-colors.js b/app/assets/javascripts/admin/routes/admin-customize-colors.js index 835814df077..b2d4f2c16bc 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-colors.js +++ b/app/assets/javascripts/admin/routes/admin-customize-colors.js @@ -8,5 +8,5 @@ export default Route.extend({ setupController(controller, model) { controller.set("model", model); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-email-style-edit.js b/app/assets/javascripts/admin/routes/admin-customize-email-style-edit.js index 9953da2344b..4453dbe672e 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-email-style-edit.js +++ b/app/assets/javascripts/admin/routes/admin-customize-email-style-edit.js @@ -6,14 +6,14 @@ export default Route.extend({ model(params) { return { model: this.modelFor("adminCustomizeEmailStyle"), - fieldName: params.field_name + fieldName: params.field_name, }; }, setupController(controller, model) { controller.setProperties({ fieldName: model.fieldName, - model: model.model + model: model.model, }); this._shouldAlertUnsavedChanges = true; }, @@ -30,7 +30,7 @@ export default Route.extend({ I18n.t("admin.customize.theme.unsaved_changes_alert"), I18n.t("admin.customize.theme.discard"), I18n.t("admin.customize.theme.stay"), - result => { + (result) => { if (!result) { this._shouldAlertUnsavedChanges = false; transition.retry(); @@ -38,6 +38,6 @@ export default Route.extend({ } ); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-email-style-index.js b/app/assets/javascripts/admin/routes/admin-customize-email-style-index.js index a6ba0628295..baeca3d8c69 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-email-style-index.js +++ b/app/assets/javascripts/admin/routes/admin-customize-email-style-index.js @@ -3,5 +3,5 @@ import Route from "@ember/routing/route"; export default Route.extend({ beforeModel() { this.replaceWith("adminCustomizeEmailStyle.edit", "html"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-email-style.js b/app/assets/javascripts/admin/routes/admin-customize-email-style.js index 3ec7b6e1bba..209b1b75519 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-email-style.js +++ b/app/assets/javascripts/admin/routes/admin-customize-email-style.js @@ -3,5 +3,5 @@ import Route from "@ember/routing/route"; export default Route.extend({ model() { return this.store.find("email-style"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-email-templates-edit.js b/app/assets/javascripts/admin/routes/admin-customize-email-templates-edit.js index 0d511fa908e..ae1e228d767 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-email-templates-edit.js +++ b/app/assets/javascripts/admin/routes/admin-customize-email-templates-edit.js @@ -14,5 +14,5 @@ export default Route.extend({ deactivate() { this.controller.set("emailTemplate", null); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-email-templates.js b/app/assets/javascripts/admin/routes/admin-customize-email-templates.js index 32340df5a1d..217de52502c 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-email-templates.js +++ b/app/assets/javascripts/admin/routes/admin-customize-email-templates.js @@ -22,5 +22,5 @@ export default Route.extend({ this.controller.get("sortedTemplates.firstObject") ); } - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-index.js b/app/assets/javascripts/admin/routes/admin-customize-index.js index 9c593b7e25f..931867c40ce 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-index.js +++ b/app/assets/javascripts/admin/routes/admin-customize-index.js @@ -2,5 +2,5 @@ import Route from "@ember/routing/route"; export default Route.extend({ beforeModel() { this.transitionTo("adminCustomizeThemes"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-robots-txt.js b/app/assets/javascripts/admin/routes/admin-customize-robots-txt.js index 866d7cf8ecc..99f9724bded 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-robots-txt.js +++ b/app/assets/javascripts/admin/routes/admin-customize-robots-txt.js @@ -4,5 +4,5 @@ import { ajax } from "discourse/lib/ajax"; export default Route.extend({ model() { return ajax("/admin/customize/robots"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js b/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js index 44b8e9fb17b..1576fac0ec4 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js +++ b/app/assets/javascripts/admin/routes/admin-customize-themes-edit.js @@ -10,7 +10,7 @@ export default Route.extend({ ? { model, target: params.target, - field_name: params.field_name + field_name: params.field_name, } : this.replaceWith("adminCustomizeThemes.index"); }, @@ -20,12 +20,14 @@ export default Route.extend({ model: wrapper.model, target: wrapper.target || "common", field_name: wrapper.field_name || "scss", - theme_id: wrapper.model.get("id") + theme_id: wrapper.model.get("id"), }; }, setupController(controller, wrapper) { - const fields = wrapper.model.get("fields")[wrapper.target].map(f => f.name); + const fields = wrapper.model + .get("fields") + [wrapper.target].map((f) => f.name); if (!fields.includes(wrapper.field_name)) { this.transitionTo( "adminCustomizeThemes.edit", @@ -54,7 +56,7 @@ export default Route.extend({ I18n.t("admin.customize.theme.unsaved_changes_alert"), I18n.t("admin.customize.theme.discard"), I18n.t("admin.customize.theme.stay"), - result => { + (result) => { if (!result) { this.set("shouldAlertUnsavedChanges", false); transition.retry(); @@ -62,6 +64,6 @@ export default Route.extend({ } ); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes-index.js b/app/assets/javascripts/admin/routes/admin-customize-themes-index.js index 425a04617a0..5e0af70da5b 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-themes-index.js +++ b/app/assets/javascripts/admin/routes/admin-customize-themes-index.js @@ -5,18 +5,18 @@ const externalResources = [ { key: "admin.customize.theme.beginners_guide_title", link: "https://meta.discourse.org/t/91966", - icon: "book" + icon: "book", }, { key: "admin.customize.theme.developers_guide_title", link: "https://meta.discourse.org/t/93648", - icon: "book" + icon: "book", }, { key: "admin.customize.theme.browse_themes", link: "https://meta.discourse.org/c/theme", - icon: "paint-brush" - } + icon: "paint-brush", + }, ]; export default Route.extend({ @@ -25,7 +25,7 @@ export default Route.extend({ this.controllerFor("adminCustomizeThemes").set("editingTheme", false); controller.setProperties({ externalResources, - womanArtistEmojiURL: emojiUrlFor("woman_artist:t5") + womanArtistEmojiURL: emojiUrlFor("woman_artist:t5"), }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes-show.js b/app/assets/javascripts/admin/routes/admin-customize-themes-show.js index ee175a9df82..feaf0ef7aef 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-themes-show.js +++ b/app/assets/javascripts/admin/routes/admin-customize-themes-show.js @@ -21,7 +21,7 @@ export default Route.extend({ parentController.setProperties({ editingTheme: false, - currentTab: model.get("component") ? COMPONENTS : THEMES + currentTab: model.get("component") ? COMPONENTS : THEMES, }); controller.setProperties({ @@ -30,7 +30,7 @@ export default Route.extend({ allThemes: parentController.get("model"), colorSchemeId: model.get("color_scheme_id"), colorSchemes: parentController.get("model.extras.color_schemes"), - editingName: false + editingName: false, }); this.handleHighlight(model); @@ -42,8 +42,8 @@ export default Route.extend({ handleHighlight(theme) { this.get("controller.allThemes") - .filter(t => t.get("selected")) - .forEach(t => t.set("selected", false)); + .filter((t) => t.get("selected")) + .forEach((t) => t.set("selected", false)); if (theme) { theme.set("selected", true); } @@ -61,7 +61,7 @@ export default Route.extend({ I18n.t("admin.customize.theme.unsaved_parent_themes"), I18n.t("admin.customize.theme.discard"), I18n.t("admin.customize.theme.stay"), - result => { + (result) => { if (!result) { this.controller.model.setProperties({ recentlyInstalled: false }); transition.retry(); @@ -69,6 +69,6 @@ export default Route.extend({ } ); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes.js b/app/assets/javascripts/admin/routes/admin-customize-themes.js index 7413057253c..2da0266f429 100644 --- a/app/assets/javascripts/admin/routes/admin-customize-themes.js +++ b/app/assets/javascripts/admin/routes/admin-customize-themes.js @@ -20,6 +20,6 @@ export default Route.extend({ this.refresh(); theme.setProperties({ recentlyInstalled: true }); this.transitionTo("adminCustomizeThemes.show", theme.get("id")); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-dashboard-general.js b/app/assets/javascripts/admin/routes/admin-dashboard-general.js index 1ee1b22121d..b13cd8f4412 100644 --- a/app/assets/javascripts/admin/routes/admin-dashboard-general.js +++ b/app/assets/javascripts/admin/routes/admin-dashboard-general.js @@ -3,5 +3,5 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ activate() { this.controllerFor("admin-dashboard-general").fetchDashboard(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-dashboard-reports.js b/app/assets/javascripts/admin/routes/admin-dashboard-reports.js index b1eff77998c..79d03646644 100644 --- a/app/assets/javascripts/admin/routes/admin-dashboard-reports.js +++ b/app/assets/javascripts/admin/routes/admin-dashboard-reports.js @@ -8,5 +8,5 @@ export default DiscourseRoute.extend({ setupController(controller, model) { controller.setProperties({ model: model.reports, filter: null }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-dashboard.js b/app/assets/javascripts/admin/routes/admin-dashboard.js index 905a148bc74..d6c9442a76d 100644 --- a/app/assets/javascripts/admin/routes/admin-dashboard.js +++ b/app/assets/javascripts/admin/routes/admin-dashboard.js @@ -6,5 +6,5 @@ export default DiscourseRoute.extend({ this.controllerFor("admin-dashboard").fetchProblems(); this.controllerFor("admin-dashboard").fetchDashboard(); scrollTop(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-email-bounced.js b/app/assets/javascripts/admin/routes/admin-email-bounced.js index a6dd27c7627..041b25fc058 100644 --- a/app/assets/javascripts/admin/routes/admin-email-bounced.js +++ b/app/assets/javascripts/admin/routes/admin-email-bounced.js @@ -8,6 +8,6 @@ export default AdminEmailLogs.extend({ showIncomingEmail(id) { showModal("admin-incoming-email", { admin: true }); this.controllerFor("modals/admin-incoming-email").loadFromBounced(id); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-email-incomings.js b/app/assets/javascripts/admin/routes/admin-email-incomings.js index aa86f7f31d6..09118ea430f 100644 --- a/app/assets/javascripts/admin/routes/admin-email-incomings.js +++ b/app/assets/javascripts/admin/routes/admin-email-incomings.js @@ -9,5 +9,5 @@ export default DiscourseRoute.extend({ setupController(controller, model) { controller.set("model", model); controller.set("filter", { status: this.status }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-email-index.js b/app/assets/javascripts/admin/routes/admin-email-index.js index 878885f9836..3a5eec63bba 100644 --- a/app/assets/javascripts/admin/routes/admin-email-index.js +++ b/app/assets/javascripts/admin/routes/admin-email-index.js @@ -4,5 +4,5 @@ import EmailSettings from "admin/models/email-settings"; export default DiscourseRoute.extend({ model() { return EmailSettings.find(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-email-logs.js b/app/assets/javascripts/admin/routes/admin-email-logs.js index 8ebfebd1996..24a0b94a6b6 100644 --- a/app/assets/javascripts/admin/routes/admin-email-logs.js +++ b/app/assets/javascripts/admin/routes/admin-email-logs.js @@ -4,7 +4,7 @@ export default DiscourseRoute.extend({ setupController(controller) { controller.setProperties({ loading: true, - filter: { status: this.status } + filter: { status: this.status }, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-email-preview-digest.js b/app/assets/javascripts/admin/routes/admin-email-preview-digest.js index 56464eaf8bf..03d72f0f826 100644 --- a/app/assets/javascripts/admin/routes/admin-email-preview-digest.js +++ b/app/assets/javascripts/admin/routes/admin-email-preview-digest.js @@ -12,7 +12,7 @@ export default DiscourseRoute.extend({ model, username: this.currentUser.get("username"), lastSeen: oneWeekAgo(), - showHtml: true + showHtml: true, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-email-rejected.js b/app/assets/javascripts/admin/routes/admin-email-rejected.js index 5945accc7c4..e5d45015497 100644 --- a/app/assets/javascripts/admin/routes/admin-email-rejected.js +++ b/app/assets/javascripts/admin/routes/admin-email-rejected.js @@ -8,6 +8,6 @@ export default AdminEmailIncomings.extend({ showIncomingEmail(id) { showModal("admin-incoming-email", { admin: true }); this.controllerFor("modals/admin-incoming-email").load(id); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-embedding.js b/app/assets/javascripts/admin/routes/admin-embedding.js index 080dce20831..6fb8704832e 100644 --- a/app/assets/javascripts/admin/routes/admin-embedding.js +++ b/app/assets/javascripts/admin/routes/admin-embedding.js @@ -6,5 +6,5 @@ export default Route.extend({ setupController(controller, model) { controller.set("embedding", model); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-emojis.js b/app/assets/javascripts/admin/routes/admin-emojis.js index dd7e94d40a3..5db8760a517 100644 --- a/app/assets/javascripts/admin/routes/admin-emojis.js +++ b/app/assets/javascripts/admin/routes/admin-emojis.js @@ -3,11 +3,11 @@ import DiscourseRoute from "discourse/routes/discourse"; import { ajax } from "discourse/lib/ajax"; export default DiscourseRoute.extend({ - model: function() { - return ajax("/admin/customize/emojis.json").then(function(emojis) { - return emojis.map(function(emoji) { + model: function () { + return ajax("/admin/customize/emojis.json").then(function (emojis) { + return emojis.map(function (emoji) { return EmberObject.create(emoji); }); }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-flags-posts-active.js b/app/assets/javascripts/admin/routes/admin-flags-posts-active.js index 1a1d01a0911..f637489bd3c 100644 --- a/app/assets/javascripts/admin/routes/admin-flags-posts-active.js +++ b/app/assets/javascripts/admin/routes/admin-flags-posts-active.js @@ -3,5 +3,5 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ model() { return this.store.findAll("flagged-post", { filter: "active" }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-flags-posts-old.js b/app/assets/javascripts/admin/routes/admin-flags-posts-old.js index a4157d57146..81a14cfa8c8 100644 --- a/app/assets/javascripts/admin/routes/admin-flags-posts-old.js +++ b/app/assets/javascripts/admin/routes/admin-flags-posts-old.js @@ -3,5 +3,5 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ model() { return this.store.findAll("flagged-post", { filter: "old" }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-flags-topics-index.js b/app/assets/javascripts/admin/routes/admin-flags-topics-index.js index 5fb295d6480..2f609050494 100644 --- a/app/assets/javascripts/admin/routes/admin-flags-topics-index.js +++ b/app/assets/javascripts/admin/routes/admin-flags-topics-index.js @@ -7,5 +7,5 @@ export default DiscourseRoute.extend({ setupController(controller, model) { controller.set("flaggedTopics", model); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-logs-index.js b/app/assets/javascripts/admin/routes/admin-logs-index.js index d003b429b68..db287d0533f 100644 --- a/app/assets/javascripts/admin/routes/admin-logs-index.js +++ b/app/assets/javascripts/admin/routes/admin-logs-index.js @@ -1,7 +1,7 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ - redirect: function() { + redirect: function () { this.transitionTo("adminLogs.staffActionLogs"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-logs-screened-emails.js b/app/assets/javascripts/admin/routes/admin-logs-screened-emails.js index 2016a961889..9f3841ee048 100644 --- a/app/assets/javascripts/admin/routes/admin-logs-screened-emails.js +++ b/app/assets/javascripts/admin/routes/admin-logs-screened-emails.js @@ -1,11 +1,11 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ - renderTemplate: function() { + renderTemplate: function () { this.render("admin/templates/logs/screened-emails", { into: "adminLogs" }); }, - setupController: function() { + setupController: function () { return this.controllerFor("adminLogsScreenedEmails").show(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-logs-screened-ip-addresses.js b/app/assets/javascripts/admin/routes/admin-logs-screened-ip-addresses.js index 4343785594c..ef886355181 100644 --- a/app/assets/javascripts/admin/routes/admin-logs-screened-ip-addresses.js +++ b/app/assets/javascripts/admin/routes/admin-logs-screened-ip-addresses.js @@ -3,11 +3,11 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ renderTemplate() { this.render("admin/templates/logs/screened-ip-addresses", { - into: "adminLogs" + into: "adminLogs", }); }, setupController() { return this.controllerFor("adminLogsScreenedIpAddresses").show(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-logs-screened-urls.js b/app/assets/javascripts/admin/routes/admin-logs-screened-urls.js index ba0b76c9c5b..99677710ca6 100644 --- a/app/assets/javascripts/admin/routes/admin-logs-screened-urls.js +++ b/app/assets/javascripts/admin/routes/admin-logs-screened-urls.js @@ -1,11 +1,11 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ - renderTemplate: function() { + renderTemplate: function () { this.render("admin/templates/logs/screened-urls", { into: "adminLogs" }); }, - setupController: function() { + setupController: function () { return this.controllerFor("adminLogsScreenedUrls").show(); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-logs-staff-action-logs.js b/app/assets/javascripts/admin/routes/admin-logs-staff-action-logs.js index 0c91a9a74a5..a3c3f196e0c 100644 --- a/app/assets/javascripts/admin/routes/admin-logs-staff-action-logs.js +++ b/app/assets/javascripts/admin/routes/admin-logs-staff-action-logs.js @@ -4,7 +4,7 @@ import EmberObject from "@ember/object"; export default DiscourseRoute.extend({ queryParams: { - filters: { refreshModel: true } + filters: { refreshModel: true }, }, deserializeQueryParam(value, urlKey, defaultValueType) { @@ -37,7 +37,7 @@ export default DiscourseRoute.extend({ // TODO: make this automatic using an `{{outlet}}` renderTemplate() { this.render("admin/templates/logs/staff-action-logs", { - into: "adminLogs" + into: "adminLogs", }); }, @@ -58,9 +58,9 @@ export default DiscourseRoute.extend({ this.transitionTo("adminLogs.staffActionLogs"); } else { this.transitionTo("adminLogs.staffActionLogs", { - queryParams: { filters } + queryParams: { filters }, }); } - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-permalinks.js b/app/assets/javascripts/admin/routes/admin-permalinks.js index 996b90aaa8e..8ff655465a9 100644 --- a/app/assets/javascripts/admin/routes/admin-permalinks.js +++ b/app/assets/javascripts/admin/routes/admin-permalinks.js @@ -8,5 +8,5 @@ export default DiscourseRoute.extend({ setupController(controller, model) { controller.set("model", model); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-plugins.js b/app/assets/javascripts/admin/routes/admin-plugins.js index 261610a97e6..d028590f436 100644 --- a/app/assets/javascripts/admin/routes/admin-plugins.js +++ b/app/assets/javascripts/admin/routes/admin-plugins.js @@ -17,6 +17,6 @@ export default Route.extend({ controller.filterContentNow("plugins"); } }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-reports-index.js b/app/assets/javascripts/admin/routes/admin-reports-index.js index 864f1a3fb29..89cda3f7ace 100644 --- a/app/assets/javascripts/admin/routes/admin-reports-index.js +++ b/app/assets/javascripts/admin/routes/admin-reports-index.js @@ -3,5 +3,5 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ beforeModel() { this.transitionTo("admin.dashboardReports"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-reports-show.js b/app/assets/javascripts/admin/routes/admin-reports-show.js index 234c30a039e..192158122e6 100644 --- a/app/assets/javascripts/admin/routes/admin-reports-show.js +++ b/app/assets/javascripts/admin/routes/admin-reports-show.js @@ -5,7 +5,7 @@ export default DiscourseRoute.extend({ start_date: { refreshModel: true }, end_date: { refreshModel: true }, filters: { refreshModel: true }, - chart_grouping: { refreshModel: true } + chart_grouping: { refreshModel: true }, }, model(params) { @@ -22,10 +22,7 @@ export default DiscourseRoute.extend({ delete params.start_date; params.endDate = - params.end_date || - moment() - .endOf("day") - .format("YYYY-MM-DD"); + params.end_date || moment().endOf("day").format("YYYY-MM-DD"); delete params.end_date; params.chartGrouping = params.chart_grouping || "daily"; @@ -65,10 +62,10 @@ export default DiscourseRoute.extend({ filters: params.filters, end_date: params.endDate ? params.endDate.toISOString(true).split("T")[0] - : null + : null, }; this.transitionTo("adminReports.show", { queryParams }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-route-map.js b/app/assets/javascripts/admin/routes/admin-route-map.js index 8297380e05e..bdc27d133f0 100644 --- a/app/assets/javascripts/admin/routes/admin-route-map.js +++ b/app/assets/javascripts/admin/routes/admin-route-map.js @@ -1,28 +1,28 @@ -export default function() { - this.route("admin", { resetNamespace: true }, function() { - this.route("dashboard", { path: "/" }, function() { +export default function () { + this.route("admin", { resetNamespace: true }, function () { + this.route("dashboard", { path: "/" }, function () { this.route("general", { path: "/" }); this.route("admin.dashboardModeration", { path: "/dashboard/moderation", - resetNamespace: true + resetNamespace: true, }); this.route("admin.dashboardSecurity", { path: "/dashboard/security", - resetNamespace: true + resetNamespace: true, }); this.route("admin.dashboardReports", { path: "/dashboard/reports", - resetNamespace: true + resetNamespace: true, }); }); this.route( "adminSiteSettings", { path: "/site_settings", resetNamespace: true }, - function() { + function () { this.route("adminSiteSettingsCategory", { path: "category/:category_id", - resetNamespace: true + resetNamespace: true, }); } ); @@ -30,7 +30,7 @@ export default function() { this.route( "adminEmail", { path: "/email", resetNamespace: true }, - function() { + function () { this.route("sent"); this.route("skipped"); this.route("bounced"); @@ -44,15 +44,15 @@ export default function() { this.route( "adminCustomize", { path: "/customize", resetNamespace: true }, - function() { - this.route("colors", function() { + function () { + this.route("colors", function () { this.route("show", { path: "/:scheme_id" }); }); this.route( "adminCustomizeThemes", { path: "themes", resetNamespace: true }, - function() { + function () { this.route("show", { path: "/:theme_id" }); this.route("edit", { path: "/:theme_id/:target/:field_name/edit" }); } @@ -61,50 +61,50 @@ export default function() { this.route( "adminSiteText", { path: "/site_texts", resetNamespace: true }, - function() { + function () { this.route("edit", { path: "/:id" }); } ); this.route("adminUserFields", { path: "/user_fields", - resetNamespace: true + resetNamespace: true, }); this.route("adminEmojis", { path: "/emojis", resetNamespace: true }); this.route("adminPermalinks", { path: "/permalinks", - resetNamespace: true + resetNamespace: true, }); this.route("adminEmbedding", { path: "/embedding", - resetNamespace: true + resetNamespace: true, }); this.route( "adminCustomizeEmailTemplates", { path: "/email_templates", resetNamespace: true }, - function() { + function () { this.route("edit", { path: "/:id" }); } ); this.route("adminCustomizeRobotsTxt", { path: "/robots", - resetNamespace: true + resetNamespace: true, }); this.route( "adminCustomizeEmailStyle", { path: "/email_style", resetNamespace: true }, - function() { + function () { this.route("edit", { path: "/:field_name" }); } ); } ); - this.route("adminApi", { path: "/api", resetNamespace: true }, function() { + this.route("adminApi", { path: "/api", resetNamespace: true }, function () { this.route( "adminApiKeys", { path: "/keys", resetNamespace: true }, - function() { + function () { this.route("show", { path: "/:api_key_id" }); this.route("new", { path: "/new" }); } @@ -113,7 +113,7 @@ export default function() { this.route( "adminWebHooks", { path: "/web_hooks", resetNamespace: true }, - function() { + function () { this.route("show", { path: "/:web_hook_id" }); this.route("showEvents", { path: "/:web_hook_id/events" }); } @@ -123,7 +123,7 @@ export default function() { this.route( "admin.backups", { path: "/backups", resetNamespace: true }, - function() { + function () { this.route("logs"); } ); @@ -131,7 +131,7 @@ export default function() { this.route( "adminReports", { path: "/reports", resetNamespace: true }, - function() { + function () { this.route("show", { path: ":type" }); } ); @@ -139,7 +139,7 @@ export default function() { this.route( "adminLogs", { path: "/logs", resetNamespace: true }, - function() { + function () { this.route("staffActionLogs", { path: "/staff_action_logs" }); this.route("screenedEmails", { path: "/screened_emails" }); this.route("screenedIpAddresses", { path: "/screened_ip_addresses" }); @@ -147,7 +147,7 @@ export default function() { this.route( "adminSearchLogs", { path: "/search_logs", resetNamespace: true }, - function() { + function () { this.route("index", { path: "/" }); this.route("term", { path: "/term" }); } @@ -155,7 +155,7 @@ export default function() { this.route( "adminWatchedWords", { path: "/watched_words", resetNamespace: true }, - function() { + function () { this.route("index", { path: "/" }); this.route("action", { path: "/action/:action_id" }); } @@ -166,11 +166,11 @@ export default function() { this.route( "adminUsers", { path: "/users", resetNamespace: true }, - function() { + function () { this.route( "adminUser", { path: "/:user_id/:username", resetNamespace: true }, - function() { + function () { this.route("badges"); this.route("tl3Requirements", { path: "/tl3_requirements" }); } @@ -179,7 +179,7 @@ export default function() { this.route( "adminUsersList", { path: "/list", resetNamespace: true }, - function() { + function () { this.route("show", { path: "/:filter" }); } ); @@ -189,7 +189,7 @@ export default function() { this.route( "adminBadges", { path: "/badges", resetNamespace: true }, - function() { + function () { this.route("award", { path: "/award/:badge_id" }); this.route("show", { path: "/:badge_id" }); } @@ -198,7 +198,7 @@ export default function() { this.route( "adminPlugins", { path: "/plugins", resetNamespace: true }, - function() { + function () { this.route("index", { path: "/" }); } ); diff --git a/app/assets/javascripts/admin/routes/admin-search-logs-index.js b/app/assets/javascripts/admin/routes/admin-search-logs-index.js index 8244c0f2af6..c688b8ebbaa 100644 --- a/app/assets/javascripts/admin/routes/admin-search-logs-index.js +++ b/app/assets/javascripts/admin/routes/admin-search-logs-index.js @@ -5,15 +5,15 @@ import { ajax } from "discourse/lib/ajax"; export default DiscourseRoute.extend({ queryParams: { period: { refreshModel: true }, - searchType: { refreshModel: true } + searchType: { refreshModel: true }, }, model(params) { this._params = params; return ajax("/admin/logs/search_logs.json", { - data: { period: params.period, search_type: params.searchType } - }).then(search_logs => { - return search_logs.map(sl => EmberObject.create(sl)); + data: { period: params.period, search_type: params.searchType }, + }).then((search_logs) => { + return search_logs.map((sl) => EmberObject.create(sl)); }); }, @@ -22,7 +22,7 @@ export default DiscourseRoute.extend({ controller.setProperties({ model, period: params.period, - searchType: params.searchType + searchType: params.searchType, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-search-logs-term.js b/app/assets/javascripts/admin/routes/admin-search-logs-term.js index 7c9c8f274c8..989d2583843 100644 --- a/app/assets/javascripts/admin/routes/admin-search-logs-term.js +++ b/app/assets/javascripts/admin/routes/admin-search-logs-term.js @@ -8,7 +8,7 @@ export default DiscourseRoute.extend({ queryParams: { term: { refreshModel: true }, period: { refreshModel: true }, - searchType: { refreshModel: true } + searchType: { refreshModel: true }, }, model(params) { @@ -18,9 +18,9 @@ export default DiscourseRoute.extend({ data: { period: params.period, search_type: params.searchType, - term: params.term - } - }).then(json => { + term: params.term, + }, + }).then((json) => { // Add zero values for missing dates if (json.term.data.length > 0) { const startDate = @@ -46,7 +46,7 @@ export default DiscourseRoute.extend({ model, term: params.term, period: params.period, - searchType: params.searchType + searchType: params.searchType, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-site-settings-category.js b/app/assets/javascripts/admin/routes/admin-site-settings-category.js index e8a9b853d40..be2a2180d28 100644 --- a/app/assets/javascripts/admin/routes/admin-site-settings-category.js +++ b/app/assets/javascripts/admin/routes/admin-site-settings-category.js @@ -18,7 +18,7 @@ export default DiscourseRoute.extend({ name: I18n.t("admin.site_settings.categories." + params.category_id), siteSettings: this.controllerFor("adminSiteSettingsCategory").get( "filteredContent" - ) + ), }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-site-settings-index.js b/app/assets/javascripts/admin/routes/admin-site-settings-index.js index 88a091c4b9b..75580cb404d 100644 --- a/app/assets/javascripts/admin/routes/admin-site-settings-index.js +++ b/app/assets/javascripts/admin/routes/admin-site-settings-index.js @@ -11,5 +11,5 @@ export default DiscourseRoute.extend({ this.controllerFor("adminSiteSettings").get("visibleSiteSettings")[0] .nameKey ); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-site-settings.js b/app/assets/javascripts/admin/routes/admin-site-settings.js index ab687a4585c..b97bc621bc1 100644 --- a/app/assets/javascripts/admin/routes/admin-site-settings.js +++ b/app/assets/javascripts/admin/routes/admin-site-settings.js @@ -3,7 +3,7 @@ import SiteSetting from "admin/models/site-setting"; export default DiscourseRoute.extend({ queryParams: { - filter: { replace: true } + filter: { replace: true }, }, model() { @@ -20,9 +20,9 @@ export default DiscourseRoute.extend({ actions: { refreshAll() { - SiteSetting.findAll().then(settings => { + SiteSetting.findAll().then((settings) => { this.controllerFor("adminSiteSettings").set("model", settings); }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-site-text-edit.js b/app/assets/javascripts/admin/routes/admin-site-text-edit.js index c423eae45ab..fe720907c7c 100644 --- a/app/assets/javascripts/admin/routes/admin-site-text-edit.js +++ b/app/assets/javascripts/admin/routes/admin-site-text-edit.js @@ -6,5 +6,5 @@ export default Route.extend({ setupController(controller, siteText) { controller.setProperties({ siteText, saved: false }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-site-text-index.js b/app/assets/javascripts/admin/routes/admin-site-text-index.js index 815dd1c0842..036438235d5 100644 --- a/app/assets/javascripts/admin/routes/admin-site-text-index.js +++ b/app/assets/javascripts/admin/routes/admin-site-text-index.js @@ -5,7 +5,7 @@ import { getProperties } from "@ember/object"; export default Route.extend({ queryParams: { q: { replace: true }, - overridden: { replace: true } + overridden: { replace: true }, }, model(params) { @@ -22,6 +22,6 @@ export default Route.extend({ actions: { showReseedModal() { showModal("admin-reseed", { admin: true }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-user-badges.js b/app/assets/javascripts/admin/routes/admin-user-badges.js index cce32753d1c..f15649f92d4 100644 --- a/app/assets/javascripts/admin/routes/admin-user-badges.js +++ b/app/assets/javascripts/admin/routes/admin-user-badges.js @@ -11,7 +11,7 @@ export default DiscourseRoute.extend({ setupController(controller, model) { // Find all badges. controller.set("loading", true); - Badge.findAll().then(function(badges) { + Badge.findAll().then(function (badges) { controller.set("badges", badges); if (badges.length > 0) { var grantableBadges = controller.get("grantableBadges"); @@ -23,5 +23,5 @@ export default DiscourseRoute.extend({ }); // Set the model. controller.set("model", model); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-user-fields.js b/app/assets/javascripts/admin/routes/admin-user-fields.js index ea4e0adef05..25e7eb0188b 100644 --- a/app/assets/javascripts/admin/routes/admin-user-fields.js +++ b/app/assets/javascripts/admin/routes/admin-user-fields.js @@ -2,11 +2,11 @@ import DiscourseRoute from "discourse/routes/discourse"; import UserField from "admin/models/user-field"; export default DiscourseRoute.extend({ - model: function() { + model: function () { return this.store.findAll("user-field"); }, - setupController: function(controller, model) { + setupController: function (controller, model) { controller.setProperties({ model, fieldTypes: UserField.fieldTypes() }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-user-index.js b/app/assets/javascripts/admin/routes/admin-user-index.js index a0aeadd590d..d3a426bd605 100644 --- a/app/assets/javascripts/admin/routes/admin-user-index.js +++ b/app/assets/javascripts/admin/routes/admin-user-index.js @@ -8,7 +8,7 @@ export default DiscourseRoute.extend({ afterModel(model) { if (this.currentUser.admin) { - return Group.findAll().then(groups => { + return Group.findAll().then((groups) => { this._availableGroups = groups.filterBy("automatic", false); return model; }); @@ -20,7 +20,7 @@ export default DiscourseRoute.extend({ originalPrimaryGroupId: model.primary_group_id, availableGroups: this._availableGroups, customGroupIdsBuffer: model.customGroups.mapBy("id"), - model + model, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-user-tl3-requirements.js b/app/assets/javascripts/admin/routes/admin-user-tl3-requirements.js index 17cd54dc8a2..07919ecef88 100644 --- a/app/assets/javascripts/admin/routes/admin-user-tl3-requirements.js +++ b/app/assets/javascripts/admin/routes/admin-user-tl3-requirements.js @@ -3,5 +3,5 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ model() { return this.modelFor("adminUser"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-user.js b/app/assets/javascripts/admin/routes/admin-user.js index 563c63d0a5e..90436dabd43 100644 --- a/app/assets/javascripts/admin/routes/admin-user.js +++ b/app/assets/javascripts/admin/routes/admin-user.js @@ -6,7 +6,7 @@ export default DiscourseRoute.extend({ serialize(model) { return { user_id: model.get("id"), - username: model.get("username").toLowerCase() + username: model.get("username").toLowerCase(), }; }, @@ -19,9 +19,9 @@ export default DiscourseRoute.extend({ }, afterModel(adminUser) { - return adminUser.loadDetails().then(function() { + return adminUser.loadDetails().then(function () { adminUser.setOriginalTrustLevel(); return adminUser; }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-users-index.js b/app/assets/javascripts/admin/routes/admin-users-index.js index 7549cb230cf..90a3f8a271a 100644 --- a/app/assets/javascripts/admin/routes/admin-users-index.js +++ b/app/assets/javascripts/admin/routes/admin-users-index.js @@ -1,7 +1,7 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ - redirect: function() { + redirect: function () { this.transitionTo("adminUsersList"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-users-list-index.js b/app/assets/javascripts/admin/routes/admin-users-list-index.js index 9f15d72cff3..e2e45b16a32 100644 --- a/app/assets/javascripts/admin/routes/admin-users-list-index.js +++ b/app/assets/javascripts/admin/routes/admin-users-list-index.js @@ -1,7 +1,7 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ - beforeModel: function() { + beforeModel: function () { this.transitionTo("adminUsersList.show", "active"); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-users-list-show.js b/app/assets/javascripts/admin/routes/admin-users-list-show.js index c16591d37f3..d4f71e6120c 100644 --- a/app/assets/javascripts/admin/routes/admin-users-list-show.js +++ b/app/assets/javascripts/admin/routes/admin-users-list-show.js @@ -3,7 +3,7 @@ import DiscourseRoute from "discourse/routes/discourse"; export default DiscourseRoute.extend({ queryParams: { order: { refreshModel: true }, - asc: { refreshModel: true } + asc: { refreshModel: true }, }, // TODO: this has been introduced to fix a bug in admin-users-list-show @@ -12,7 +12,7 @@ export default DiscourseRoute.extend({ const routeName = "adminUsersList.show"; if (transition.targetName === routeName) { - const params = transition.routeInfos.find(a => a.name === routeName) + const params = transition.routeInfos.find((a) => a.name === routeName) .params; const controller = this.controllerFor(routeName); if (controller) { @@ -20,11 +20,11 @@ export default DiscourseRoute.extend({ order: transition.to.queryParams.order, asc: transition.to.queryParams.asc, query: params.filter, - refreshing: false + refreshing: false, }); controller.resetFilters(); } } - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-users-list.js b/app/assets/javascripts/admin/routes/admin-users-list.js index 9e520d17353..db8106a8ed5 100644 --- a/app/assets/javascripts/admin/routes/admin-users-list.js +++ b/app/assets/javascripts/admin/routes/admin-users-list.js @@ -7,7 +7,7 @@ export default DiscourseRoute.extend({ actions: { exportUsers() { exportEntity("user_list", { - trust_level: this.controllerFor("admin-users-list-show").get("query") + trust_level: this.controllerFor("admin-users-list-show").get("query"), }).then(outputExportResult); }, @@ -17,6 +17,6 @@ export default DiscourseRoute.extend({ deleteUser(user) { AdminUser.create(user).destroy({ deletePosts: true }); - } - } + }, + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-watched-words-action.js b/app/assets/javascripts/admin/routes/admin-watched-words-action.js index af416c48ded..3c770f7e093 100644 --- a/app/assets/javascripts/admin/routes/admin-watched-words-action.js +++ b/app/assets/javascripts/admin/routes/admin-watched-words-action.js @@ -14,7 +14,7 @@ export default DiscourseRoute.extend({ return EmberObject.create({ nameKey: params.action_id, name: I18n.t("admin.watched_words.actions." + params.action_id), - words: filteredContent + words: filteredContent, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-watched-words-index.js b/app/assets/javascripts/admin/routes/admin-watched-words-index.js index a957c11478b..4015e117c11 100644 --- a/app/assets/javascripts/admin/routes/admin-watched-words-index.js +++ b/app/assets/javascripts/admin/routes/admin-watched-words-index.js @@ -6,5 +6,5 @@ export default DiscourseRoute.extend({ "adminWatchedWords.action", this.modelFor("adminWatchedWords")[0].nameKey ); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-watched-words.js b/app/assets/javascripts/admin/routes/admin-watched-words.js index 924ab49779e..d995d09d454 100644 --- a/app/assets/javascripts/admin/routes/admin-watched-words.js +++ b/app/assets/javascripts/admin/routes/admin-watched-words.js @@ -3,7 +3,7 @@ import WatchedWord from "admin/models/watched-word"; export default DiscourseRoute.extend({ queryParams: { - filter: { replace: true } + filter: { replace: true }, }, model() { @@ -22,5 +22,5 @@ export default DiscourseRoute.extend({ "allWatchedWords", watchedWordsList ); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-web-hooks-show-events.js b/app/assets/javascripts/admin/routes/admin-web-hooks-show-events.js index 64f28d3652c..b07b390d404 100644 --- a/app/assets/javascripts/admin/routes/admin-web-hooks-show-events.js +++ b/app/assets/javascripts/admin/routes/admin-web-hooks-show-events.js @@ -17,5 +17,5 @@ export default DiscourseRoute.extend({ renderTemplate() { this.render("admin/templates/web-hooks-show-events", { into: "adminApi" }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-web-hooks-show.js b/app/assets/javascripts/admin/routes/admin-web-hooks-show.js index f0860e79f71..a5eb3dd8735 100644 --- a/app/assets/javascripts/admin/routes/admin-web-hooks-show.js +++ b/app/assets/javascripts/admin/routes/admin-web-hooks-show.js @@ -26,5 +26,5 @@ export default DiscourseRoute.extend({ renderTemplate() { this.render("admin/templates/web-hooks-show", { into: "adminApi" }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin-web-hooks.js b/app/assets/javascripts/admin/routes/admin-web-hooks.js index 30daf6b6cbb..4b207311360 100644 --- a/app/assets/javascripts/admin/routes/admin-web-hooks.js +++ b/app/assets/javascripts/admin/routes/admin-web-hooks.js @@ -10,7 +10,7 @@ export default Route.extend({ eventTypes: model.extras.event_types, defaultEventTypes: model.extras.default_event_types, contentTypes: model.extras.content_types, - deliveryStatuses: model.extras.delivery_statuses + deliveryStatuses: model.extras.delivery_statuses, }); - } + }, }); diff --git a/app/assets/javascripts/admin/routes/admin.js b/app/assets/javascripts/admin/routes/admin.js index 0a7ae99fdd2..c84051d1718 100644 --- a/app/assets/javascripts/admin/routes/admin.js +++ b/app/assets/javascripts/admin/routes/admin.js @@ -9,11 +9,11 @@ export default DiscourseRoute.extend({ activate() { this.controllerFor("application").setProperties({ showTop: false, - showFooter: false + showFooter: false, }); }, deactivate() { this.controllerFor("application").set("showTop", true); - } + }, }); diff --git a/app/assets/javascripts/admin/services/admin-tools.js b/app/assets/javascripts/admin/services/admin-tools.js index 61a77a33d5e..fc02b998fe9 100644 --- a/app/assets/javascripts/admin/services/admin-tools.js +++ b/app/assets/javascripts/admin/services/admin-tools.js @@ -30,18 +30,19 @@ export default Service.extend({ }, checkSpammer(userId) { - return AdminUser.find(userId).then(au => this.spammerDetails(au)); + return AdminUser.find(userId).then((au) => this.spammerDetails(au)); }, deleteUser(id) { - AdminUser.find(id).then(user => user.destroy({ deletePosts: true })); + AdminUser.find(id).then((user) => user.destroy({ deletePosts: true })); }, spammerDetails(adminUser) { return { deleteUser: () => this._deleteSpammer(adminUser), canDelete: - adminUser.get("can_be_deleted") && adminUser.get("can_delete_all_posts") + adminUser.get("can_be_deleted") && + adminUser.get("can_delete_all_posts"), }; }, @@ -50,19 +51,19 @@ export default Service.extend({ let controller = showModal(`admin-${type}-user`, { admin: true, - modalClass: `${type}-user-modal` + modalClass: `${type}-user-modal`, }); controller.setProperties({ postId: opts.postId, postEdit: opts.postEdit }); return (user.adminUserView ? Promise.resolve(user) : AdminUser.find(user.get("id")) - ).then(loadedUser => { + ).then((loadedUser) => { controller.setProperties({ user: loadedUser, loadingUser: false, before: opts.before, - successCallback: opts.successCallback + successCallback: opts.successCallback, }); }); }, @@ -88,7 +89,7 @@ export default Service.extend({ email: adminUser.get("email") || I18n.t("flagging.hidden_email_address"), ip_address: - adminUser.get("ip_address") || I18n.t("flagging.ip_address_missing") + adminUser.get("ip_address") || I18n.t("flagging.ip_address_missing"), }); let userId = adminUser.get("id"); @@ -98,7 +99,7 @@ export default Service.extend({ { label: I18n.t("composer.cancel"), class: "d-modal-cancel", - link: true + link: true, }, { label: @@ -114,10 +115,10 @@ export default Service.extend({ block_urls: true, block_ip: true, delete_as_spammer: true, - context: window.location.pathname - } + context: window.location.pathname, + }, }) - .then(result => { + .then((result) => { if (result.deleted) { resolve(); } else { @@ -128,14 +129,14 @@ export default Service.extend({ bootbox.alert(I18n.t("admin.user.delete_failed")); reject(); }); - } - } + }, + }, ]; bootbox.dialog(message, buttons, { - classes: "flagging-delete-spammer" + classes: "flagging-delete-spammer", }); }); }); - } + }, }); diff --git a/app/assets/javascripts/app-boot.js b/app/assets/javascripts/app-boot.js index 870551b5093..95ec3c3cb73 100644 --- a/app/assets/javascripts/app-boot.js +++ b/app/assets/javascripts/app-boot.js @@ -1,6 +1,6 @@ // discourse-skip-module -(function() { +(function () { if (window.unsupportedBrowser) { throw "Unsupported browser detected"; } @@ -12,7 +12,7 @@ ).__DISCOURSE_RAW_TEMPLATES; // required for select kit to work without Ember CLI - Object.keys(Ember.TEMPLATES).forEach(k => { + Object.keys(Ember.TEMPLATES).forEach((k) => { if (k.indexOf("select-kit") === 0) { let template = Ember.TEMPLATES[k]; define(k, () => template); diff --git a/app/assets/javascripts/auto-redirect.js b/app/assets/javascripts/auto-redirect.js index 0308edbb2e3..f9c2f3ded81 100644 --- a/app/assets/javascripts/auto-redirect.js +++ b/app/assets/javascripts/auto-redirect.js @@ -1,7 +1,7 @@ // discourse-skip-module -(function() { +(function () { const path = document.getElementById("data-auto-redirect").dataset.path; - setTimeout(function() { + setTimeout(function () { window.location.href = path; }, 2000); })(); diff --git a/app/assets/javascripts/confirm-new-email/bootstrap.js b/app/assets/javascripts/confirm-new-email/bootstrap.js index 5754bc233ce..db93c5ee55f 100644 --- a/app/assets/javascripts/confirm-new-email/bootstrap.js +++ b/app/assets/javascripts/confirm-new-email/bootstrap.js @@ -1,4 +1,4 @@ // discourse-skip-module -(function() { +(function () { require("confirm-new-email/confirm-new-email"); })(); diff --git a/app/assets/javascripts/confirm-new-email/confirm-new-email.js b/app/assets/javascripts/confirm-new-email/confirm-new-email.js index 8a61d76df8e..eeec4e045ae 100644 --- a/app/assets/javascripts/confirm-new-email/confirm-new-email.js +++ b/app/assets/javascripts/confirm-new-email/confirm-new-email.js @@ -2,23 +2,21 @@ import { getWebauthnCredential } from "discourse/lib/webauthn"; const security = document.getElementById("submit-security-key"); if (security) { - security.onclick = function(e) { + security.onclick = function (e) { e.preventDefault(); getWebauthnCredential( document.getElementById("security-key-challenge").value, document .getElementById("security-key-allowed-credential-ids") .value.split(","), - credentialData => { + (credentialData) => { document.getElementById( "security-key-credential" ).value = JSON.stringify(credentialData); - $(e.target) - .parents("form") - .submit(); + $(e.target).parents("form").submit(); }, - errorMessage => { + (errorMessage) => { document.getElementById("security-key-error").innerText = errorMessage; } ); diff --git a/app/assets/javascripts/discourse-common/addon/helpers/d-icon.js b/app/assets/javascripts/discourse-common/addon/helpers/d-icon.js index 97f93273d95..9d4e387df62 100644 --- a/app/assets/javascripts/discourse-common/addon/helpers/d-icon.js +++ b/app/assets/javascripts/discourse-common/addon/helpers/d-icon.js @@ -2,6 +2,6 @@ import { registerUnbound } from "discourse-common/lib/helpers"; import { renderIcon } from "discourse-common/lib/icon-library"; import { htmlSafe } from "@ember/template"; -registerUnbound("d-icon", function(id, params) { +registerUnbound("d-icon", function (id, params) { return htmlSafe(renderIcon("string", id, params)); }); diff --git a/app/assets/javascripts/discourse-common/addon/helpers/fa-icon.js b/app/assets/javascripts/discourse-common/addon/helpers/fa-icon.js index 12b1823cede..04d701153b8 100644 --- a/app/assets/javascripts/discourse-common/addon/helpers/fa-icon.js +++ b/app/assets/javascripts/discourse-common/addon/helpers/fa-icon.js @@ -7,7 +7,7 @@ export function iconHTML(id, params) { return renderIcon("string", id, params); } -registerUnbound("fa-icon", function(icon, params) { +registerUnbound("fa-icon", function (icon, params) { deprecated("Use `{{d-icon}}` instead of `{{fa-icon}}"); return htmlSafe(iconHTML(icon, params)); }); diff --git a/app/assets/javascripts/discourse-common/addon/helpers/get-url.js b/app/assets/javascripts/discourse-common/addon/helpers/get-url.js index 2c8c900a1e6..e1821eeea26 100644 --- a/app/assets/javascripts/discourse-common/addon/helpers/get-url.js +++ b/app/assets/javascripts/discourse-common/addon/helpers/get-url.js @@ -2,7 +2,7 @@ import { registerUnbound } from "discourse-common/lib/helpers"; import getUrl from "discourse-common/lib/get-url"; import deprecated from "discourse-common/lib/deprecated"; -registerUnbound("get-url", value => getUrl(value)); +registerUnbound("get-url", (value) => getUrl(value)); registerUnbound("base-url", () => { deprecated("Use `{{base-path}}` instead of `{{base-url}}`"); return getUrl(""); diff --git a/app/assets/javascripts/discourse-common/addon/helpers/html-safe.js b/app/assets/javascripts/discourse-common/addon/helpers/html-safe.js index dc6d5daf745..355dbfb35ad 100644 --- a/app/assets/javascripts/discourse-common/addon/helpers/html-safe.js +++ b/app/assets/javascripts/discourse-common/addon/helpers/html-safe.js @@ -1,6 +1,6 @@ import { registerUnbound } from "discourse-common/lib/helpers"; import { htmlSafe } from "@ember/template"; -registerUnbound("html-safe", function(string) { +registerUnbound("html-safe", function (string) { return htmlSafe(string); }); diff --git a/app/assets/javascripts/discourse-common/addon/helpers/popular-themes.js b/app/assets/javascripts/discourse-common/addon/helpers/popular-themes.js index 2c7cdbbcddf..0446a9f5ada 100644 --- a/app/assets/javascripts/discourse-common/addon/helpers/popular-themes.js +++ b/app/assets/javascripts/discourse-common/addon/helpers/popular-themes.js @@ -5,7 +5,7 @@ export const POPULAR_THEMES = [ preview: "https://theme-creator.discourse.org/theme/awesomerobot/graceful", description: "A light and graceful theme for Discourse.", meta_url: - "https://meta.discourse.org/t/a-graceful-theme-for-discourse/93040" + "https://meta.discourse.org/t/a-graceful-theme-for-discourse/93040", }, { name: "Material Design Theme", @@ -13,7 +13,7 @@ export const POPULAR_THEMES = [ preview: "https://newmaterial.trydiscourse.com", description: "Inspired by Material Design, this theme comes with several color palettes (incl. a dark one).", - meta_url: "https://meta.discourse.org/t/material-design-stock-theme/47142" + meta_url: "https://meta.discourse.org/t/material-design-stock-theme/47142", }, { name: "Minima", @@ -21,7 +21,7 @@ export const POPULAR_THEMES = [ preview: "https://theme-creator.discourse.org/theme/awesomerobot/minima", description: "A minimal theme with reduced UI elements and focus on text.", meta_url: - "https://meta.discourse.org/t/minima-a-minimal-theme-for-discourse/108178" + "https://meta.discourse.org/t/minima-a-minimal-theme-for-discourse/108178", }, { name: "Sam's Simple Theme", @@ -30,7 +30,7 @@ export const POPULAR_THEMES = [ description: "Simplified front page design with classic colors and typography.", meta_url: - "https://meta.discourse.org/t/sams-personal-minimal-topic-list-design/23552" + "https://meta.discourse.org/t/sams-personal-minimal-topic-list-design/23552", }, { name: "Brand Header", @@ -38,7 +38,7 @@ export const POPULAR_THEMES = [ description: "Add an extra top header with your logo, navigation links and social icons.", meta_url: "https://meta.discourse.org/t/brand-header-theme-component/77977", - component: true + component: true, }, { name: "Custom Header Links", @@ -47,7 +47,7 @@ export const POPULAR_THEMES = [ "https://theme-creator.discourse.org/theme/Johani/custom-header-links", description: "Easily add custom text-based links to the header.", meta_url: "https://meta.discourse.org/t/custom-header-links/90588", - component: true + component: true, }, { name: "Category Banners", @@ -57,7 +57,7 @@ export const POPULAR_THEMES = [ description: "Show banners on category pages using your existing category details.", meta_url: "https://meta.discourse.org/t/discourse-category-banners/86241", - component: true + component: true, }, { name: "Kanban Board", @@ -66,7 +66,7 @@ export const POPULAR_THEMES = [ description: "Display and organize topics using a Kanban board interface.", meta_url: "https://meta.discourse.org/t/kanban-board-theme-component/118164", - component: true + component: true, }, { name: "Hamburger Theme Selector", @@ -74,7 +74,7 @@ export const POPULAR_THEMES = [ description: "Displays a theme selector in the hamburger menu provided there is more than one user-selectable theme.", meta_url: "https://meta.discourse.org/t/hamburger-theme-selector/61210", - component: true + component: true, }, { name: "Header Submenus", @@ -82,7 +82,7 @@ export const POPULAR_THEMES = [ preview: "https://theme-creator.discourse.org/theme/Johani/header-submenus", description: "Lets you build a header menu with submenus (dropdowns).", meta_url: "https://meta.discourse.org/t/header-submenus/94584", - component: true + component: true, }, { name: "Alternative Logos", @@ -90,7 +90,7 @@ export const POPULAR_THEMES = [ description: "Add alternative logos for dark / light themes.", meta_url: "https://meta.discourse.org/t/alternative-logo-for-dark-themes/88502", - component: true + component: true, }, { name: "Automatic Table of Contents", @@ -99,7 +99,7 @@ export const POPULAR_THEMES = [ "Generates an interactive table of contents on the sidebar of your topic with a simple click in the composer.", meta_url: "https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143", - component: true + component: true, }, { name: "Easy Responsive Footer", @@ -107,6 +107,6 @@ export const POPULAR_THEMES = [ preview: "https://theme-creator.discourse.org/theme/Johani/easy-footer", description: "Add a fully responsive footer without writing any HTML.", meta_url: "https://meta.discourse.org/t/easy-responsive-footer/95818", - component: true - } + component: true, + }, ]; diff --git a/app/assets/javascripts/discourse-common/addon/lib/attribute-hook.js b/app/assets/javascripts/discourse-common/addon/lib/attribute-hook.js index 33aecc6646a..07bda95a9ec 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/attribute-hook.js +++ b/app/assets/javascripts/discourse-common/addon/lib/attribute-hook.js @@ -10,7 +10,7 @@ function AttributeHook(namespace, value) { this.value = value; } -AttributeHook.prototype.hook = function(node, prop, prev) { +AttributeHook.prototype.hook = function (node, prop, prev) { if ( prev && prev.type === "AttributeHook" && @@ -23,7 +23,7 @@ AttributeHook.prototype.hook = function(node, prop, prev) { node.setAttributeNS(this.namespace, prop, this.value); }; -AttributeHook.prototype.unhook = function(node, prop, next) { +AttributeHook.prototype.unhook = function (node, prop, next) { if ( next && next.type === "AttributeHook" && diff --git a/app/assets/javascripts/discourse-common/addon/lib/get-owner.js b/app/assets/javascripts/discourse-common/addon/lib/get-owner.js index f8831b15edc..f26a3bd7582 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/get-owner.js +++ b/app/assets/javascripts/discourse-common/addon/lib/get-owner.js @@ -36,9 +36,9 @@ export function getRegister(obj) { "Use `this.register` or `getOwner` instead of `this.container`" ); return register; - } + }, }); - } + }, }; return register; diff --git a/app/assets/javascripts/discourse-common/addon/lib/helpers.js b/app/assets/javascripts/discourse-common/addon/lib/helpers.js index efdfdd53e8c..76de9ae2f45 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/helpers.js +++ b/app/assets/javascripts/discourse-common/addon/lib/helpers.js @@ -11,7 +11,7 @@ export function makeArray(obj) { } export function htmlHelper(fn) { - return Helper.helper(function(...args) { + return Helper.helper(function (...args) { args = args.length > 1 ? args[0].concat({ hash: args[args.length - 1] }) : args; return htmlSafe(fn.apply(this, args) || ""); @@ -40,7 +40,7 @@ export function findHelper(name) { } export function registerHelpers(registry) { - Object.keys(_helpers).forEach(name => { + Object.keys(_helpers).forEach((name) => { registry.register(`helper:${name}`, _helpers[name], { singleton: false }); }); } @@ -62,7 +62,7 @@ function resolveParams(ctx, options) { if (hash) { if (options.hashTypes) { - Object.keys(hash).forEach(function(k) { + Object.keys(hash).forEach(function (k) { const type = options.hashTypes[k]; if ( type === "STRING" || @@ -82,7 +82,7 @@ function resolveParams(ctx, options) { } export function registerUnbound(name, fn) { - const func = function(...args) { + const func = function (...args) { const options = args.pop(); const properties = args; @@ -99,7 +99,7 @@ export function registerUnbound(name, fn) { }; _helpers[name] = Helper.extend({ - compute: (params, args) => fn(...params, args) + compute: (params, args) => fn(...params, args), }); RawHandlebars.registerHelper(name, func); } diff --git a/app/assets/javascripts/discourse-common/addon/lib/icon-library.js b/app/assets/javascripts/discourse-common/addon/lib/icon-library.js index acbd7b18cee..bfa4fa607de 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/icon-library.js +++ b/app/assets/javascripts/discourse-common/addon/lib/icon-library.js @@ -43,7 +43,7 @@ const REPLACEMENTS = { "notification.membership_request_accepted": "user-plus", "notification.membership_request_consolidated": "users", "notification.reaction": "bell", - "notification.votes_released": "plus" + "notification.votes_released": "plus", }; export function replaceIcon(source, destination) { @@ -167,13 +167,13 @@ registerIconRenderer({ "svg", { attributes: { class: classes, "aria-hidden": true }, - namespace: SVG_NAMESPACE + namespace: SVG_NAMESPACE, }, [ h("use", { "xlink:href": attributeHook("http://www.w3.org/1999/xlink", `#${id}`), - namespace: SVG_NAMESPACE - }) + namespace: SVG_NAMESPACE, + }), ] ); @@ -182,12 +182,12 @@ registerIconRenderer({ "span", { title: params.title, - attributes: { class: "svg-icon-title" } + attributes: { class: "svg-icon-title" }, }, [svg] ); } else { return svg; } - } + }, }); diff --git a/app/assets/javascripts/discourse-common/addon/lib/object.js b/app/assets/javascripts/discourse-common/addon/lib/object.js index e90cf267af7..af2472ae946 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/object.js +++ b/app/assets/javascripts/discourse-common/addon/lib/object.js @@ -5,7 +5,7 @@ function isObject(obj) { // a fairly simple deep merge based on: https://gist.github.com/ahtcx/0cd94e62691f539160b32ecda18af3d6 export function deepMerge(...objects) { function deepMergeInner(target, source) { - Object.keys(source).forEach(key => { + Object.keys(source).forEach((key) => { const targetValue = target[key]; const sourceValue = source[key]; @@ -24,7 +24,7 @@ export function deepMerge(...objects) { return target; } - if (objects.some(object => object && !isObject(object))) { + if (objects.some((object) => object && !isObject(object))) { throw new Error('deepMerge: all values should be of type "object"'); } diff --git a/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js b/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js index 77923676a46..6606bef2695 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js +++ b/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js @@ -5,7 +5,7 @@ export function registerRawHelpers(hbs, handlebarsClass) { hbs.helpers = Object.create(handlebarsClass.helpers); } - hbs.helpers["get"] = function(context, options) { + hbs.helpers["get"] = function (context, options) { if (!context || !options.contexts) { return; } @@ -25,7 +25,7 @@ export function registerRawHelpers(hbs, handlebarsClass) { }; // #each .. in support (as format is transformed to this) - hbs.registerHelper("each", function( + hbs.registerHelper("each", function ( localName, inKeyword, contextName, @@ -43,7 +43,7 @@ export function registerRawHelpers(hbs, handlebarsClass) { function stringCompatHelper(fn) { const old = hbs.helpers[fn]; - hbs.helpers[fn] = function(context, options) { + hbs.helpers[fn] = function (context, options) { return old.apply(this, [hbs.helpers.get(context, options), options]); }; } @@ -62,14 +62,14 @@ export function registerRawHelpers(hbs, handlebarsClass) { // The following code ensures that patched-unless will call `if` directly, // `patched-unless("var")` will return `!if(val)`. const oldIf = hbs.helpers["if"]; - hbs.helpers["unless"] = function(context, options) { + hbs.helpers["unless"] = function (context, options) { return oldIf.apply(this, [ hbs.helpers.get(context, options), { fn: options.inverse, inverse: options.fn, - hash: options.hash - } + hash: options.hash, + }, ]); }; diff --git a/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars.js b/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars.js index 6fe75917464..d2d3149c796 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars.js +++ b/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars.js @@ -10,11 +10,11 @@ function buildPath(blk, args) { type: "PathExpression", data: false, depth: blk.path.depth, - loc: blk.path.loc + loc: blk.path.loc, }; // Server side precompile doesn't have jquery.extend - Object.keys(args).forEach(function(a) { + Object.keys(args).forEach(function (a) { result[a] = args[a]; }); @@ -25,14 +25,14 @@ function replaceGet(ast) { var visitor = new Handlebars.Visitor(); visitor.mutating = true; - visitor.MustacheStatement = function(mustache) { + visitor.MustacheStatement = function (mustache) { if (!(mustache.params.length || mustache.hash)) { mustache.params[0] = mustache.path; mustache.path = buildPath(mustache, { parts: ["get"], original: "get", strict: true, - falsy: true + falsy: true, }); } return Handlebars.Visitor.prototype.MustacheStatement.call(this, mustache); @@ -40,13 +40,13 @@ function replaceGet(ast) { // rewrite `each x as |y|` as each y in x` // This allows us to use the same syntax in all templates - visitor.BlockStatement = function(block) { + visitor.BlockStatement = function (block) { if (block.path.original === "each" && block.params.length === 1) { var paramName = block.program.blockParams[0]; block.params = [ buildPath(block, { original: paramName }), { type: "CommentStatement", value: "in" }, - block.params[0] + block.params[0], ]; delete block.program.blockParams; } @@ -58,13 +58,13 @@ function replaceGet(ast) { } if (Handlebars.Compiler) { - RawHandlebars.Compiler = function() {}; + RawHandlebars.Compiler = function () {}; RawHandlebars.Compiler.prototype = Object.create( Handlebars.Compiler.prototype ); RawHandlebars.Compiler.prototype.compiler = RawHandlebars.Compiler; - RawHandlebars.JavaScriptCompiler = function() {}; + RawHandlebars.JavaScriptCompiler = function () {}; RawHandlebars.JavaScriptCompiler.prototype = Object.create( Handlebars.JavaScriptCompiler.prototype @@ -73,16 +73,16 @@ if (Handlebars.Compiler) { RawHandlebars.JavaScriptCompiler; RawHandlebars.JavaScriptCompiler.prototype.namespace = "RawHandlebars"; - RawHandlebars.precompile = function(value, asObject) { + RawHandlebars.precompile = function (value, asObject) { var ast = Handlebars.parse(value); replaceGet(ast); var options = { knownHelpers: { - get: true + get: true, }, data: true, - stringParams: true + stringParams: true, }; asObject = asObject === undefined ? true : asObject; @@ -96,7 +96,7 @@ if (Handlebars.Compiler) { ); }; - RawHandlebars.compile = function(string) { + RawHandlebars.compile = function (string) { var ast = Handlebars.parse(string); replaceGet(ast); diff --git a/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js b/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js index 2aa14dbf0d5..b39c9eca74f 100644 --- a/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js +++ b/app/assets/javascripts/discourse-common/addon/lib/raw-templates.js @@ -31,7 +31,7 @@ export function buildRawConnectorCache(findOutlets) { findOutlets(__DISCOURSE_RAW_TEMPLATES, (outletName, resource) => { result[outletName] = result[outletName] || []; result[outletName].push({ - template: __DISCOURSE_RAW_TEMPLATES[resource] + template: __DISCOURSE_RAW_TEMPLATES[resource], }); }); return result; diff --git a/app/assets/javascripts/discourse-common/addon/resolver.js b/app/assets/javascripts/discourse-common/addon/resolver.js index ba272c6bf15..7ad517b2c46 100644 --- a/app/assets/javascripts/discourse-common/addon/resolver.js +++ b/app/assets/javascripts/discourse-common/addon/resolver.js @@ -26,7 +26,7 @@ function parseName(fullName) { fullNameWithoutType, name: fullNameWithoutType, root, - resolveMethodName: "resolve" + classify(type) + resolveMethodName: "resolve" + classify(type), }; } @@ -85,7 +85,7 @@ export function buildResolver(baseName) { // If we end with the name we want, use it. This allows us to define components within plugins. const suffix = parsedName.type + "s/" + parsedName.fullNameWithoutType, dashed = dasherize(suffix), - moduleName = Object.keys(requirejs.entries).find(function(e) { + moduleName = Object.keys(requirejs.entries).find(function (e) { return ( e.indexOf(suffix, e.length - suffix.length) !== -1 || e.indexOf(dashed, e.length - dashed.length) !== -1 @@ -259,6 +259,6 @@ export function buildResolver(baseName) { Ember.TEMPLATES[dashed.replace("admin-", "admin/")] ); } - } + }, }); } diff --git a/app/assets/javascripts/discourse-common/addon/utils/decorator-alias.js b/app/assets/javascripts/discourse-common/addon/utils/decorator-alias.js index c483a1cc4f4..96692bb5531 100644 --- a/app/assets/javascripts/discourse-common/addon/utils/decorator-alias.js +++ b/app/assets/javascripts/discourse-common/addon/utils/decorator-alias.js @@ -1,20 +1,20 @@ import extractValue from "discourse-common/utils/extract-value"; export default function decoratorAlias(fn, errorMessage) { - return function(...params) { + return function (...params) { // determine if user called as @discourseComputed('blah', 'blah') or @discourseComputed if (params.length === 0) { throw new Error(errorMessage); } else { - return function(target, key, desc) { + return function (target, key, desc) { return { enumerable: desc.enumerable, configurable: desc.configurable, writable: desc.writable, - initializer: function() { + initializer: function () { var value = extractValue(desc); return fn.apply(null, params.concat(value)); - } + }, }; }; } diff --git a/app/assets/javascripts/discourse-common/addon/utils/decorators.js b/app/assets/javascripts/discourse-common/addon/utils/decorators.js index ebed6e19391..feae9b293f8 100644 --- a/app/assets/javascripts/discourse-common/addon/utils/decorators.js +++ b/app/assets/javascripts/discourse-common/addon/utils/decorators.js @@ -11,7 +11,7 @@ export default function discourseComputedDecorator(...params) { if (isDescriptor(params[params.length - 1])) { return handleDescriptor(...arguments); } else { - return function(/* target, key, desc */) { + return function (/* target, key, desc */) { return handleDescriptor(...arguments, params); }; } @@ -19,7 +19,7 @@ export default function discourseComputedDecorator(...params) { export function afterRender(target, name, descriptor) { const originalFunction = descriptor.value; - descriptor.value = function() { + descriptor.value = function () { next(() => { schedule("afterRender", () => { if (this.element && !this.isDestroying && !this.isDestroyed) { @@ -36,13 +36,13 @@ export function bind(target, name, descriptor) { get() { const bound = emberBind(this, descriptor.value); const attributes = Object.assign({}, descriptor, { - value: bound + value: bound, }); Object.defineProperty(this, name, attributes); return bound; - } + }, }; } @@ -51,10 +51,10 @@ export function readOnly(target, name, desc) { writable: false, enumerable: desc.enumerable, configurable: desc.configurable, - initializer: function() { + initializer: function () { var value = extractValue(desc); return value.readOnly(); - } + }, }; } diff --git a/app/assets/javascripts/discourse-common/addon/utils/handle-descriptor.js b/app/assets/javascripts/discourse-common/addon/utils/handle-descriptor.js index e4899c938e4..f8ff22c817a 100644 --- a/app/assets/javascripts/discourse-common/addon/utils/handle-descriptor.js +++ b/app/assets/javascripts/discourse-common/addon/utils/handle-descriptor.js @@ -6,7 +6,7 @@ export default function handleDescriptor(target, key, desc, params = []) { enumerable: desc.enumerable, configurable: desc.configurable, writeable: desc.writeable, - initializer: function() { + initializer: function () { let computedDescriptor; if (desc.writable) { @@ -30,7 +30,7 @@ export default function handleDescriptor(target, key, desc, params = []) { } return computed.apply(null, params.concat(computedDescriptor)); - } + }, }; } @@ -53,8 +53,8 @@ function niceAttr(attr) { function callUserSuppliedGet(params, func) { params = params.map(niceAttr); - return function() { - let paramValues = params.map(p => get(this, p)); + return function () { + let paramValues = params.map((p) => get(this, p)); return func.apply(this, paramValues); }; @@ -62,8 +62,8 @@ function callUserSuppliedGet(params, func) { function callUserSuppliedSet(params, func) { params = params.map(niceAttr); - return function(key, value) { - let paramValues = params.map(p => get(this, p)); + return function (key, value) { + let paramValues = params.map((p) => get(this, p)); paramValues.unshift(value); return func.apply(this, paramValues); diff --git a/app/assets/javascripts/discourse-common/addon/utils/macro-alias.js b/app/assets/javascripts/discourse-common/addon/utils/macro-alias.js index 5d6223f1088..5b66901872d 100644 --- a/app/assets/javascripts/discourse-common/addon/utils/macro-alias.js +++ b/app/assets/javascripts/discourse-common/addon/utils/macro-alias.js @@ -5,18 +5,18 @@ function handleDescriptor(target, property, desc, fn, params = []) { enumerable: desc.enumerable, configurable: desc.configurable, writable: desc.writable, - initializer: function() { + initializer: function () { return fn(...params); - } + }, }; } export default function macroAlias(fn) { - return function(...params) { + return function (...params) { if (isDescriptor(params[params.length - 1])) { return handleDescriptor(...params, fn); } else { - return function(target, property, desc) { + return function (target, property, desc) { return handleDescriptor(target, property, desc, fn, params); }; } diff --git a/app/assets/javascripts/discourse-common/config/ember-try.js b/app/assets/javascripts/discourse-common/config/ember-try.js index bcae42888f6..454a1cef3ea 100644 --- a/app/assets/javascripts/discourse-common/config/ember-try.js +++ b/app/assets/javascripts/discourse-common/config/ember-try.js @@ -2,7 +2,7 @@ const getChannelURL = require("ember-source-channel-url"); -module.exports = async function() { +module.exports = async function () { return { useYarn: true, scenarios: [ @@ -10,41 +10,41 @@ module.exports = async function() { name: "ember-lts-3.8", npm: { devDependencies: { - "ember-source": "~3.8.0" - } - } + "ember-source": "~3.8.0", + }, + }, }, { name: "ember-lts-3.12", npm: { devDependencies: { - "ember-source": "~3.12.0" - } - } + "ember-source": "~3.12.0", + }, + }, }, { name: "ember-release", npm: { devDependencies: { - "ember-source": await getChannelURL("release") - } - } + "ember-source": await getChannelURL("release"), + }, + }, }, { name: "ember-beta", npm: { devDependencies: { - "ember-source": await getChannelURL("beta") - } - } + "ember-source": await getChannelURL("beta"), + }, + }, }, { name: "ember-canary", npm: { devDependencies: { - "ember-source": await getChannelURL("canary") - } - } + "ember-source": await getChannelURL("canary"), + }, + }, }, // The default `.travis.yml` runs this scenario via `yarn test`, // not via `ember try`. It's still included here so that running @@ -53,21 +53,21 @@ module.exports = async function() { { name: "ember-default", npm: { - devDependencies: {} - } + devDependencies: {}, + }, }, { name: "ember-default-with-jquery", env: { EMBER_OPTIONAL_FEATURES: JSON.stringify({ - "jquery-integration": true - }) + "jquery-integration": true, + }), }, npm: { devDependencies: { - "@ember/jquery": "^0.5.1" - } - } + "@ember/jquery": "^0.5.1", + }, + }, }, { name: "ember-classic", @@ -75,15 +75,15 @@ module.exports = async function() { EMBER_OPTIONAL_FEATURES: JSON.stringify({ "application-template-wrapper": true, "default-async-observers": false, - "template-only-glimmer-components": false - }) + "template-only-glimmer-components": false, + }), }, npm: { ember: { - edition: "classic" - } - } - } - ] + edition: "classic", + }, + }, + }, + ], }; }; diff --git a/app/assets/javascripts/discourse-common/config/environment.js b/app/assets/javascripts/discourse-common/config/environment.js index 352093f4edd..b7238585e61 100644 --- a/app/assets/javascripts/discourse-common/config/environment.js +++ b/app/assets/javascripts/discourse-common/config/environment.js @@ -1,5 +1,5 @@ "use strict"; -module.exports = function(/* environment, appConfig */) { +module.exports = function (/* environment, appConfig */) { return {}; }; diff --git a/app/assets/javascripts/discourse-common/ember-cli-build.js b/app/assets/javascripts/discourse-common/ember-cli-build.js index cbf921270c5..81a8a5e9aa3 100644 --- a/app/assets/javascripts/discourse-common/ember-cli-build.js +++ b/app/assets/javascripts/discourse-common/ember-cli-build.js @@ -2,7 +2,7 @@ const EmberAddon = require("ember-cli/lib/broccoli/ember-addon"); -module.exports = function(defaults) { +module.exports = function (defaults) { let app = new EmberAddon(defaults, {}); return app.toTree(); diff --git a/app/assets/javascripts/discourse-common/index.js b/app/assets/javascripts/discourse-common/index.js index 7ad7fe9113c..1d5c926b5fe 100644 --- a/app/assets/javascripts/discourse-common/index.js +++ b/app/assets/javascripts/discourse-common/index.js @@ -5,8 +5,8 @@ module.exports = { options: { autoImport: { alias: { - handlebars: "handlebars/dist/cjs/handlebars.js" - } - } - } + handlebars: "handlebars/dist/cjs/handlebars.js", + }, + }, + }, }; diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index f6a28c01cb4..82e358b93f9 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -1,12 +1,12 @@ var define, requirejs; -(function() { +(function () { var JS_MODULES = {}; var ALIASES = { "ember-addons/ember-computed-decorators": "discourse-common/utils/decorators", "discourse/lib/raw-templates": "discourse-common/lib/raw-templates", - "preload-store": "discourse/lib/preload-store" + "preload-store": "discourse/lib/preload-store", }; // In future versions of ember we don't need this @@ -16,20 +16,20 @@ var define, requirejs; "@ember/array": { default: Ember.Array, A: Ember.A, - isArray: Ember.isArray + isArray: Ember.isArray, }, "@ember/array/proxy": { - default: Ember.ArrayProxy + default: Ember.ArrayProxy, }, "@ember/component": { - default: Ember.Component + default: Ember.Component, }, "@ember/controller": { default: Ember.Controller, - inject: Ember.inject.controller + inject: Ember.inject.controller, }, "@ember/debug": { - warn: Ember.warn + warn: Ember.warn, }, "@ember/object": { action: Ember._action, @@ -39,7 +39,7 @@ var define, requirejs; set: Ember.set, setProperties: Ember.setProperties, computed: Ember.computed, - defineProperty: Ember.defineProperty + defineProperty: Ember.defineProperty, }, "@ember/object/computed": { alias: Ember.computed.alias, @@ -73,14 +73,14 @@ var define, requirejs; sum: Ember.computed.sum, union: Ember.computed.union, uniq: Ember.computed.uniq, - uniqBy: Ember.computed.uniqBy + uniqBy: Ember.computed.uniqBy, }, "@ember/object/mixin": { default: Ember.Mixin }, "@ember/object/proxy": { default: Ember.ObjectProxy }, "@ember/object/promise-proxy-mixin": { default: Ember.PromiseProxyMixin }, "@ember/object/evented": { default: Ember.Evented, - on: Ember.on + on: Ember.on, }, "@ember/routing/route": { default: Ember.Route }, "@ember/routing/router": { default: Ember.Router }, @@ -94,63 +94,63 @@ var define, requirejs; run: Ember.run, schedule: Ember.run.schedule, scheduleOnce: Ember.run.scheduleOnce, - throttle: Ember.run.throttle + throttle: Ember.run.throttle, }, "@ember/service": { default: Ember.Service, - inject: Ember.inject.service + inject: Ember.inject.service, }, "@ember/utils": { isBlank: Ember.isBlank, isEmpty: Ember.isEmpty, isNone: Ember.isNone, - isPresent: Ember.isPresent + isPresent: Ember.isPresent, }, rsvp: { default: Ember.RSVP, Promise: Ember.RSVP.Promise, hash: Ember.RSVP.hash, - all: Ember.RSVP.all + all: Ember.RSVP.all, }, "@ember/string": { dasherize: Ember.String.dasherize, classify: Ember.String.classify, underscore: Ember.String.underscore, - camelize: Ember.String.camelize + camelize: Ember.String.camelize, }, "@ember/template": { - htmlSafe: Ember.String.htmlSafe + htmlSafe: Ember.String.htmlSafe, }, "@ember/application": { default: Ember.Application, setOwner: Ember.setOwner, - getOwner: Ember.getOwner + getOwner: Ember.getOwner, }, "@ember/component/helper": { - default: Ember.Helper + default: Ember.Helper, }, "@ember/component/text-field": { - default: Ember.TextField + default: Ember.TextField, }, "@ember/component/text-area": { - default: Ember.TextArea + default: Ember.TextArea, }, "@ember/error": { - default: Ember.error + default: Ember.error, }, "@ember/object/internals": { - guidFor: Ember.guidFor + guidFor: Ember.guidFor, }, I18n: { // eslint-disable-next-line - default: I18n - } + default: I18n, + }, }; } var _isArray; if (!Array.isArray) { - _isArray = function(x) { + _isArray = function (x) { return Object.prototype.toString.call(x) === "[object Array]"; }; } else { @@ -200,18 +200,18 @@ var define, requirejs; this._require = undefined; } - Module.prototype.makeRequire = function() { + Module.prototype.makeRequire = function () { var name = transformForAliases(this.name); return ( this._require || - (this._require = function(dep) { + (this._require = function (dep) { return requirejs(resolve(dep, name)); }) ); }; - define = function(name, deps, callback) { + define = function (name, deps, callback) { if (arguments.length < 2) { unsupportedModule(arguments.length); } @@ -233,7 +233,7 @@ var define, requirejs; this.name = path; } - define.alias = function(path) { + define.alias = function (path) { return new Alias(path); }; @@ -262,7 +262,7 @@ var define, requirejs; return { deps: reified, - module: module + module: module, }; } @@ -306,7 +306,7 @@ var define, requirejs; return alias; } - requirejs = require = function(name) { + requirejs = require = function (name) { name = transformForAliases(name); if (JS_MODULES[name]) { return JS_MODULES[name]; @@ -333,12 +333,12 @@ var define, requirejs; seen[name] = {}; // placeholder for run-time cycles tryFinally( - function() { + function () { reified = reify(mod, name, seen[name]); module = mod.callback.apply(this, reified.deps); loaded = true; }, - function() { + function () { if (!loaded) { mod.state = FAILED; } @@ -392,7 +392,7 @@ var define, requirejs; } requirejs.entries = requirejs._eak_seen = registry; - requirejs.clear = function() { + requirejs.clear = function () { requirejs.entries = requirejs._eak_seen = registry = {}; seen = {}; }; diff --git a/app/assets/javascripts/discourse-shims.js b/app/assets/javascripts/discourse-shims.js index 8e664228f3d..d6ccfbeea11 100644 --- a/app/assets/javascripts/discourse-shims.js +++ b/app/assets/javascripts/discourse-shims.js @@ -1,35 +1,35 @@ // Allow us to import Ember -define("ember", ["exports"], function(__exports__) { +define("ember", ["exports"], function (__exports__) { // eslint-disable-next-line no-console console.warn( [ "Deprecation notice:", "Use specific `@ember/*` imports instead of `ember`", "(deprecated since Discourse 2.4.0)", - "(removal in Discourse 2.5.0)" + "(removal in Discourse 2.5.0)", ].join(" ") ); __exports__.default = Ember; }); -define("message-bus-client", ["exports"], function(__exports__) { +define("message-bus-client", ["exports"], function (__exports__) { __exports__.default = window.MessageBus; }); -define("ember-buffered-proxy/proxy", ["exports"], function(__exports__) { +define("ember-buffered-proxy/proxy", ["exports"], function (__exports__) { __exports__.default = window.BufferedProxy; }); -define("bootbox", ["exports"], function(__exports__) { +define("bootbox", ["exports"], function (__exports__) { __exports__.default = window.bootbox; }); -define("mousetrap", ["exports"], function(__exports__) { +define("mousetrap", ["exports"], function (__exports__) { __exports__.default = window.Mousetrap; }); -define("@popperjs/core", ["exports"], function(__exports__) { +define("@popperjs/core", ["exports"], function (__exports__) { __exports__.default = window.Popper; __exports__.createPopper = window.Popper.createPopper; __exports__.defaultModifiers = window.Popper.defaultModifiers; diff --git a/app/assets/javascripts/discourse/app/adapters/email-template.js b/app/assets/javascripts/discourse/app/adapters/email-template.js index d1087e70199..272103ee8a8 100644 --- a/app/assets/javascripts/discourse/app/adapters/email-template.js +++ b/app/assets/javascripts/discourse/app/adapters/email-template.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ basePath() { return "/admin/customize/"; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/group.js b/app/assets/javascripts/discourse/app/adapters/group.js index 2317d11aed7..5e5b6df18f4 100644 --- a/app/assets/javascripts/discourse/app/adapters/group.js +++ b/app/assets/javascripts/discourse/app/adapters/group.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ appendQueryParams(path, findArgs) { return this._super(path, findArgs, ".json"); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/post-reply-history.js b/app/assets/javascripts/discourse/app/adapters/post-reply-history.js index 82554140e6e..0116f327446 100644 --- a/app/assets/javascripts/discourse/app/adapters/post-reply-history.js +++ b/app/assets/javascripts/discourse/app/adapters/post-reply-history.js @@ -6,8 +6,8 @@ export default RestAdapter.extend({ const maxReplies = this.siteSettings.max_reply_history; return ajax( `/posts/${findArgs.postId}/reply-history?max_replies=${maxReplies}` - ).then(replies => { + ).then((replies) => { return { post_reply_histories: replies }; }); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/post-reply.js b/app/assets/javascripts/discourse/app/adapters/post-reply.js index 985e9d55e3b..7f12465127e 100644 --- a/app/assets/javascripts/discourse/app/adapters/post-reply.js +++ b/app/assets/javascripts/discourse/app/adapters/post-reply.js @@ -3,8 +3,8 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ find(store, type, findArgs) { - return ajax(`/posts/${findArgs.postId}/replies`).then(replies => { + return ajax(`/posts/${findArgs.postId}/replies`).then((replies) => { return { post_replies: replies }; }); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/post.js b/app/assets/javascripts/discourse/app/adapters/post.js index 1382d8d1f37..e16266bd92f 100644 --- a/app/assets/javascripts/discourse/app/adapters/post.js +++ b/app/assets/javascripts/discourse/app/adapters/post.js @@ -5,7 +5,7 @@ import { underscore } from "@ember/string"; export default RestAdapter.extend({ find(store, type, findArgs) { - return this._super(store, type, findArgs).then(function(result) { + return this._super(store, type, findArgs).then(function (result) { return { post: result }; }); }, @@ -14,9 +14,9 @@ export default RestAdapter.extend({ const typeField = underscore(type); args.nested_post = true; return ajax(this.pathFor(store, type), { type: "POST", data: args }).then( - function(json) { + function (json) { return new Result(json[typeField], json); } ); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/published-page.js b/app/assets/javascripts/discourse/app/adapters/published-page.js index 19226739359..28b845832d0 100644 --- a/app/assets/javascripts/discourse/app/adapters/published-page.js +++ b/app/assets/javascripts/discourse/app/adapters/published-page.js @@ -5,5 +5,5 @@ export default RestAdapter.extend({ pathFor(store, type, id) { return `/pub/by-topic/${id}`; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/rest.js b/app/assets/javascripts/discourse/app/adapters/rest.js index a2287919dc3..be113356b34 100644 --- a/app/assets/javascripts/discourse/app/adapters/rest.js +++ b/app/assets/javascripts/discourse/app/adapters/rest.js @@ -9,7 +9,7 @@ const ADMIN_MODELS = [ "embeddable-host", "web-hook", "web-hook-event", - "flagged-topic" + "flagged-topic", ]; export function Result(payload, responseJson) { @@ -48,8 +48,8 @@ export default EmberObject.extend({ if (findArgs) { if (typeof findArgs === "object") { const queryString = Object.keys(findArgs) - .reject(k => !findArgs[k]) - .map(k => k + "=" + encodeURIComponent(findArgs[k])); + .reject((k) => !findArgs[k]) + .map((k) => k + "=" + encodeURIComponent(findArgs[k])); if (queryString.length) { return `${path}${extension ? extension : ""}?${queryString.join( @@ -117,7 +117,7 @@ export default EmberObject.extend({ return ajax( this.pathFor(store, type, id), this.getPayload("PUT", data) - ).then(function(json) { + ).then(function (json) { return new Result(json[typeField], json); }); }, @@ -127,7 +127,7 @@ export default EmberObject.extend({ const typeField = underscore(this.apiNameFor(type)); data[typeField] = attrs; return ajax(this.pathFor(store, type), this.getPayload("POST", data)).then( - function(json) { + function (json) { return new Result(json[typeField], json); } ); @@ -135,7 +135,7 @@ export default EmberObject.extend({ destroyRecord(store, type, record) { return ajax(this.pathFor(store, type, record.get(this.primaryKey)), { - type: "DELETE" + type: "DELETE", }); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/reviewable-explanation.js b/app/assets/javascripts/discourse/app/adapters/reviewable-explanation.js index 2ae3837e947..b08c74e4121 100644 --- a/app/assets/javascripts/discourse/app/adapters/reviewable-explanation.js +++ b/app/assets/javascripts/discourse/app/adapters/reviewable-explanation.js @@ -5,5 +5,5 @@ export default RestAdapter.extend({ pathFor(store, type, id) { return `/review/${id}/explain.json`; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/reviewable-settings.js b/app/assets/javascripts/discourse/app/adapters/reviewable-settings.js index 8b299035d17..78e7176acac 100644 --- a/app/assets/javascripts/discourse/app/adapters/reviewable-settings.js +++ b/app/assets/javascripts/discourse/app/adapters/reviewable-settings.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ pathFor() { return "/review/settings"; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/reviewable-topic.js b/app/assets/javascripts/discourse/app/adapters/reviewable-topic.js index 726fcb7a7da..512db804d5e 100644 --- a/app/assets/javascripts/discourse/app/adapters/reviewable-topic.js +++ b/app/assets/javascripts/discourse/app/adapters/reviewable-topic.js @@ -3,5 +3,5 @@ import RestAdapter from "discourse/adapters/rest"; export default RestAdapter.extend({ pathFor() { return "/review/topics"; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/reviewable.js b/app/assets/javascripts/discourse/app/adapters/reviewable.js index 1cf4df50833..ad233d63f4f 100644 --- a/app/assets/javascripts/discourse/app/adapters/reviewable.js +++ b/app/assets/javascripts/discourse/app/adapters/reviewable.js @@ -5,5 +5,5 @@ export default RestAdapter.extend({ pathFor(store, type, findArgs) { return this.appendQueryParams("/review", findArgs); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/tag-info.js b/app/assets/javascripts/discourse/app/adapters/tag-info.js index c2bf608c232..80d4e288950 100644 --- a/app/assets/javascripts/discourse/app/adapters/tag-info.js +++ b/app/assets/javascripts/discourse/app/adapters/tag-info.js @@ -3,5 +3,5 @@ import RESTAdapter from "discourse/adapters/rest"; export default RESTAdapter.extend({ pathFor(store, type, id) { return "/tag/" + id + "/info"; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/tag-notification.js b/app/assets/javascripts/discourse/app/adapters/tag-notification.js index 2c0b0c0bf53..3f9c62ff413 100644 --- a/app/assets/javascripts/discourse/app/adapters/tag-notification.js +++ b/app/assets/javascripts/discourse/app/adapters/tag-notification.js @@ -3,5 +3,5 @@ import RESTAdapter from "discourse/adapters/rest"; export default RESTAdapter.extend({ pathFor(store, type, id) { return "/tag/" + id + "/notifications"; - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/topic-list.js b/app/assets/javascripts/discourse/app/adapters/topic-list.js index 359d7ee05ae..cc36b230f5e 100644 --- a/app/assets/javascripts/discourse/app/adapters/topic-list.js +++ b/app/assets/javascripts/discourse/app/adapters/topic-list.js @@ -4,14 +4,14 @@ import RestAdapter from "discourse/adapters/rest"; import PreloadStore from "discourse/lib/preload-store"; export function finderFor(filter, params) { - return function() { + return function () { let url = getURL("/") + filter + ".json"; if (params) { const keys = Object.keys(params), encoded = []; - keys.forEach(function(p) { + keys.forEach(function (p) { const value = encodeURI(params[p]); if (typeof value !== "undefined") { encoded.push(p + "=" + value); @@ -34,10 +34,10 @@ export default RestAdapter.extend({ return PreloadStore.getAndRemove( "topic_list_" + filter, finderFor(filter, params) - ).then(function(result) { + ).then(function (result) { result.filter = filter; result.params = params; return result; }); - } + }, }); diff --git a/app/assets/javascripts/discourse/app/adapters/topic.js b/app/assets/javascripts/discourse/app/adapters/topic.js index 1e845c59d5d..5c22b1c17fc 100644 --- a/app/assets/javascripts/discourse/app/adapters/topic.js +++ b/app/assets/javascripts/discourse/app/adapters/topic.js @@ -8,5 +8,5 @@ export default RestAdapter.extend({ } else { return this._super(store, type, findArgs); } - } + }, }); diff --git a/app/assets/javascripts/discourse/app/app.js b/app/assets/javascripts/discourse/app/app.js index 80d288fe984..fc51dd47d9a 100644 --- a/app/assets/javascripts/discourse/app/app.js +++ b/app/assets/javascripts/discourse/app/app.js @@ -8,7 +8,7 @@ const Discourse = Application.extend({ rootElement: "#main", customEvents: { - paste: "paste" + paste: "paste", }, reset() { @@ -34,7 +34,7 @@ const Discourse = Application.extend({ start() { $("noscript").remove(); - Object.keys(requirejs._eak_seen).forEach(key => { + Object.keys(requirejs._eak_seen).forEach((key) => { if (/\/pre\-initializers\//.test(key)) { this.initializer(this._prepareInitializer(key)); } else if (/\/initializers\//.test(key)) { @@ -45,18 +45,18 @@ const Discourse = Application.extend({ // Plugins that are registered via `gmail.com"); @@ -115,7 +115,7 @@ QUnit.test("escape search term", async assert => { ); }); -QUnit.skip("update username through advanced search ui", async assert => { +QUnit.skip("update username through advanced search ui", async (assert) => { await visit("/search"); await fillIn(".search-query", "none"); await fillIn(".search-advanced-options .user-selector", "admin"); @@ -148,7 +148,7 @@ QUnit.skip("update username through advanced search ui", async assert => { }); }); -QUnit.test("update category through advanced search ui", async assert => { +QUnit.test("update category through advanced search ui", async (assert) => { const categoryChooser = selectKit( ".search-advanced-options .category-chooser" ); @@ -174,7 +174,7 @@ QUnit.test("update category through advanced search ui", async assert => { QUnit.test( "update in:title filter through advanced search ui", - async assert => { + async (assert) => { await visit("/search"); await fillIn(".search-query", "none"); await click(".search-advanced-options .in-title"); @@ -193,7 +193,7 @@ QUnit.test( QUnit.test( "update in:likes filter through advanced search ui", - async assert => { + async (assert) => { await visit("/search"); await fillIn(".search-query", "none"); await click(".search-advanced-options .in-likes"); @@ -212,7 +212,7 @@ QUnit.test( QUnit.test( "update in:personal filter through advanced search ui", - async assert => { + async (assert) => { await visit("/search"); await fillIn(".search-query", "none"); await click(".search-advanced-options .in-private"); @@ -229,24 +229,27 @@ QUnit.test( } ); -QUnit.test("update in:seen filter through advanced search ui", async assert => { - await visit("/search"); - await fillIn(".search-query", "none"); - await click(".search-advanced-options .in-seen"); +QUnit.test( + "update in:seen filter through advanced search ui", + async (assert) => { + await visit("/search"); + await fillIn(".search-query", "none"); + await click(".search-advanced-options .in-seen"); - assert.ok( - exists(".search-advanced-options .in-seen:checked"), - "it should check the right checkbox" - ); + assert.ok( + exists(".search-advanced-options .in-seen:checked"), + "it should check the right checkbox" + ); - assert.equal( - find(".search-query").val(), - "none in:seen", - "it should update the search term" - ); -}); + assert.equal( + find(".search-query").val(), + "none in:seen", + "it should update the search term" + ); + } +); -QUnit.test("update in filter through advanced search ui", async assert => { +QUnit.test("update in filter through advanced search ui", async (assert) => { const inSelector = selectKit(".search-advanced-options .select-kit#in"); await visit("/search"); @@ -267,7 +270,7 @@ QUnit.test("update in filter through advanced search ui", async assert => { ); }); -QUnit.test("update status through advanced search ui", async assert => { +QUnit.test("update status through advanced search ui", async (assert) => { const statusSelector = selectKit( ".search-advanced-options .select-kit#status" ); @@ -292,7 +295,7 @@ QUnit.test("update status through advanced search ui", async assert => { QUnit.test( "doesn't update status filter header if wrong value entered through searchbox", - async assert => { + async (assert) => { const statusSelector = selectKit( ".search-advanced-options .select-kit#status" ); @@ -307,7 +310,7 @@ QUnit.test( QUnit.test( "doesn't update in filter header if wrong value entered through searchbox", - async assert => { + async (assert) => { const inSelector = selectKit(".search-advanced-options .select-kit#in"); await visit("/search"); @@ -318,7 +321,7 @@ QUnit.test( } ); -QUnit.test("update post time through advanced search ui", async assert => { +QUnit.test("update post time through advanced search ui", async (assert) => { await visit("/search?expanded=true&q=after:2018-08-22"); assert.equal( @@ -351,24 +354,27 @@ QUnit.test("update post time through advanced search ui", async assert => { ); }); -QUnit.test("update min post count through advanced search ui", async assert => { - await visit("/search"); - await fillIn(".search-query", "none"); - await fillIn("#search-min-post-count", "5"); +QUnit.test( + "update min post count through advanced search ui", + async (assert) => { + await visit("/search"); + await fillIn(".search-query", "none"); + await fillIn("#search-min-post-count", "5"); - assert.equal( - find(".search-advanced-options #search-min-post-count").val(), - "5", - 'has "5" populated' - ); - assert.equal( - find(".search-query").val(), - "none min_post_count:5", - 'has updated search term to "none min_post_count:5"' - ); -}); + assert.equal( + find(".search-advanced-options #search-min-post-count").val(), + "5", + 'has "5" populated' + ); + assert.equal( + find(".search-query").val(), + "none min_post_count:5", + 'has updated search term to "none min_post_count:5"' + ); + } +); -QUnit.test("validate advanced search when initially empty", async assert => { +QUnit.test("validate advanced search when initially empty", async (assert) => { await visit("/search?expanded=true"); await click(".search-advanced-options .in-likes"); diff --git a/test/javascripts/acceptance/search-mobile-test.js b/test/javascripts/acceptance/search-mobile-test.js index 0469eff37cf..47a110eefff 100644 --- a/test/javascripts/acceptance/search-mobile-test.js +++ b/test/javascripts/acceptance/search-mobile-test.js @@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Search - Mobile", { mobileView: true }); -QUnit.test("search", async assert => { +QUnit.test("search", async (assert) => { await visit("/"); await click("#search-button"); diff --git a/test/javascripts/acceptance/search-test.js b/test/javascripts/acceptance/search-test.js index f252bdc5d87..eda6a22e161 100644 --- a/test/javascripts/acceptance/search-test.js +++ b/test/javascripts/acceptance/search-test.js @@ -7,17 +7,17 @@ let searchArgs = { pretend(server) { server.handledRequest = (verb, path, request) => { if (request.queryParams["search_context[type]"] === undefined) { - emptySearchContextCallbacks.forEach(callback => { + emptySearchContextCallbacks.forEach((callback) => { callback.call(); }); } }; - } + }, }; acceptance("Search", searchArgs); -QUnit.test("search", async assert => { +QUnit.test("search", async (assert) => { await visit("/"); await click("#search-button"); @@ -43,7 +43,7 @@ QUnit.test("search", async assert => { assert.ok(exists(".search-advanced-options"), "advanced search is expanded"); }); -QUnit.test("search for a tag", async assert => { +QUnit.test("search for a tag", async (assert) => { await visit("/"); await click("#search-button"); @@ -53,7 +53,7 @@ QUnit.test("search for a tag", async assert => { assert.ok(exists(".search-menu .results ul li"), "it shows results"); }); -QUnit.test("search scope checkbox", async assert => { +QUnit.test("search scope checkbox", async (assert) => { await visit("/tag/important"); await click("#search-button"); assert.ok( @@ -86,7 +86,7 @@ QUnit.test("search scope checkbox", async assert => { ); }); -QUnit.test("Search with context", async assert => { +QUnit.test("Search with context", async (assert) => { await visit("/t/internationalization-localization/280/1"); await click("#search-button"); @@ -126,7 +126,7 @@ QUnit.test("Search with context", async assert => { assert.ok(!$(".search-context input[type=checkbox]").is(":checked")); }); -QUnit.test("Right filters are shown to anonymous users", async assert => { +QUnit.test("Right filters are shown to anonymous users", async (assert) => { const inSelector = selectKit(".select-kit#in"); await visit("/search?expanded=true"); @@ -151,7 +151,7 @@ QUnit.test("Right filters are shown to anonymous users", async assert => { acceptance("Search", Object.assign({ loggedIn: true, searchArgs })); -QUnit.test("Right filters are shown to logged-in users", async assert => { +QUnit.test("Right filters are shown to logged-in users", async (assert) => { const inSelector = selectKit(".select-kit#in"); await visit("/search?expanded=true"); @@ -179,11 +179,11 @@ acceptance( Object.assign({ loggedIn: true, searchArgs, - settings: { tagging_enabled: true } + settings: { tagging_enabled: true }, }) ); -QUnit.test("displays tags", async assert => { +QUnit.test("displays tags", async (assert) => { await visit("/"); await click("#search-button"); diff --git a/test/javascripts/acceptance/share-and-invite-desktop-test.js b/test/javascripts/acceptance/share-and-invite-desktop-test.js index cdca5f7caf2..445f17701e9 100644 --- a/test/javascripts/acceptance/share-and-invite-desktop-test.js +++ b/test/javascripts/acceptance/share-and-invite-desktop-test.js @@ -1,10 +1,10 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Share and Invite modal - desktop", { - loggedIn: true + loggedIn: true, }); -QUnit.test("Topic footer button", async assert => { +QUnit.test("Topic footer button", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok( @@ -64,7 +64,7 @@ QUnit.test("Topic footer button", async assert => { ); }); -QUnit.test("Post date link", async assert => { +QUnit.test("Post date link", async (assert) => { await visit("/t/internationalization-localization/280"); await click("#post_2 .post-info.post-date a"); diff --git a/test/javascripts/acceptance/share-and-invite-mobile-test.js b/test/javascripts/acceptance/share-and-invite-mobile-test.js index 62526e8dcb2..c21ae36b00a 100644 --- a/test/javascripts/acceptance/share-and-invite-mobile-test.js +++ b/test/javascripts/acceptance/share-and-invite-mobile-test.js @@ -3,10 +3,10 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Share and Invite modal - mobile", { loggedIn: true, - mobileView: true + mobileView: true, }); -QUnit.test("Topic footer mobile button", async assert => { +QUnit.test("Topic footer mobile button", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok( @@ -54,7 +54,7 @@ QUnit.test("Topic footer mobile button", async assert => { ); }); -QUnit.test("Post date link", async assert => { +QUnit.test("Post date link", async (assert) => { await visit("/t/internationalization-localization/280"); await click("#post_2 .post-info.post-date a"); diff --git a/test/javascripts/acceptance/shared-drafts-test.js b/test/javascripts/acceptance/shared-drafts-test.js index 3d15c719073..7f46522f3e5 100644 --- a/test/javascripts/acceptance/shared-drafts-test.js +++ b/test/javascripts/acceptance/shared-drafts-test.js @@ -3,7 +3,7 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Shared Drafts", { loggedIn: true }); -QUnit.test("Viewing", async assert => { +QUnit.test("Viewing", async (assert) => { await visit("/t/some-topic/9"); assert.ok(find(".shared-draft-controls").length === 1); let categoryChooser = selectKit(".shared-draft-controls .category-chooser"); diff --git a/test/javascripts/acceptance/sign-in-test.js b/test/javascripts/acceptance/sign-in-test.js index c66ba49637f..d3c8dbe75a7 100644 --- a/test/javascripts/acceptance/sign-in-test.js +++ b/test/javascripts/acceptance/sign-in-test.js @@ -1,7 +1,7 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Signing In"); -QUnit.test("sign in", async assert => { +QUnit.test("sign in", async (assert) => { await visit("/"); await click("header .login-button"); assert.ok(exists(".login-modal"), "it shows the login modal"); @@ -25,7 +25,7 @@ QUnit.test("sign in", async assert => { ); }); -QUnit.test("sign in - not activated", async assert => { +QUnit.test("sign in - not activated", async (assert) => { await visit("/"); await click("header .login-button"); assert.ok(exists(".login-modal"), "it shows the login modal"); @@ -47,7 +47,7 @@ QUnit.test("sign in - not activated", async assert => { assert.ok(!exists(".modal-body small"), "it escapes the email address"); }); -QUnit.test("sign in - not activated - edit email", async assert => { +QUnit.test("sign in - not activated - edit email", async (assert) => { await visit("/"); await click("header .login-button"); assert.ok(exists(".login-modal"), "it shows the login modal"); @@ -68,7 +68,7 @@ QUnit.test("sign in - not activated - edit email", async assert => { assert.equal(find(".modal-body b").text(), "different@example.com"); }); -QUnit.skip("second factor", async assert => { +QUnit.skip("second factor", async (assert) => { await visit("/"); await click("header .login-button"); @@ -101,7 +101,7 @@ QUnit.skip("second factor", async assert => { ); }); -QUnit.skip("security key", async assert => { +QUnit.skip("security key", async (assert) => { await visit("/"); await click("header .login-button"); @@ -127,7 +127,7 @@ QUnit.skip("security key", async assert => { assert.not(exists("#login-button:visible"), "hides the login button"); }); -QUnit.test("create account", async assert => { +QUnit.test("create account", async (assert) => { await visit("/"); await click("header .sign-up-button"); @@ -163,7 +163,7 @@ QUnit.test("create account", async assert => { ); }); -QUnit.test("second factor backup - valid token", async assert => { +QUnit.test("second factor backup - valid token", async (assert) => { await visit("/"); await click("header .login-button"); await fillIn("#login-account-name", "eviltrout"); @@ -179,7 +179,7 @@ QUnit.test("second factor backup - valid token", async assert => { ); }); -QUnit.test("second factor backup - invalid token", async assert => { +QUnit.test("second factor backup - invalid token", async (assert) => { await visit("/"); await click("header .login-button"); await fillIn("#login-account-name", "eviltrout"); diff --git a/test/javascripts/acceptance/static-test.js b/test/javascripts/acceptance/static-test.js index 97ac63c5aa3..d8aa41060f8 100644 --- a/test/javascripts/acceptance/static-test.js +++ b/test/javascripts/acceptance/static-test.js @@ -1,7 +1,7 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Static"); -QUnit.test("Static Pages", async assert => { +QUnit.test("Static Pages", async (assert) => { await visit("/faq"); assert.ok($("body.static-faq").length, "has the body class"); assert.ok(exists(".body-page"), "The content is present"); diff --git a/test/javascripts/acceptance/tag-groups-test.js b/test/javascripts/acceptance/tag-groups-test.js index ebfb5c1349e..6e7bf9ab132 100644 --- a/test/javascripts/acceptance/tag-groups-test.js +++ b/test/javascripts/acceptance/tag-groups-test.js @@ -13,14 +13,14 @@ acceptance("Tag Groups", { tag_names: ["monkey"], parent_tag_name: [], one_per_topic: false, - permissions: { everyone: 1 } - } + permissions: { everyone: 1 }, + }, }); }); - } + }, }); -QUnit.test("tag groups can be saved and deleted", async assert => { +QUnit.test("tag groups can be saved and deleted", async (assert) => { const tags = selectKit(".tag-chooser"); await visit("/tag_groups"); diff --git a/test/javascripts/acceptance/tags-intersection-test.js b/test/javascripts/acceptance/tags-intersection-test.js index e768f438b77..ad0b6ddf9ae 100644 --- a/test/javascripts/acceptance/tags-intersection-test.js +++ b/test/javascripts/acceptance/tags-intersection-test.js @@ -7,7 +7,7 @@ acceptance("Tags intersection", { pretend(server, helper) { server.get("/tag/first/notifications", () => { return helper.response({ - tag_notification: { id: "first", notification_level: 1 } + tag_notification: { id: "first", notification_level: 1 }, }); }); server.get("/tags/intersection/first/second.json", () => { @@ -20,23 +20,21 @@ acceptance("Tags intersection", { topics: [{ id: 16, posters: [] }], tags: [ { id: 1, name: "second", topic_count: 1 }, - { id: 2, name: "first", topic_count: 1 } - ] - } + { id: 2, name: "first", topic_count: 1 }, + ], + }, }); }); - } + }, }); -QUnit.test("Populate tags when creating new topic", async assert => { +QUnit.test("Populate tags when creating new topic", async (assert) => { await visit("/tags/intersection/first/second"); await click("#create-topic"); assert.ok(exists(".mini-tag-chooser"), "The tag selector appears"); assert.equal( - $(".mini-tag-chooser") - .text() - .trim(), + $(".mini-tag-chooser").text().trim(), "first, second", "populates the tags when clicking 'New topic'" ); diff --git a/test/javascripts/acceptance/tags-test.js b/test/javascripts/acceptance/tags-test.js index e3a6449aa40..44dbd9dbb0c 100644 --- a/test/javascripts/acceptance/tags-test.js +++ b/test/javascripts/acceptance/tags-test.js @@ -3,7 +3,7 @@ import pretender from "helpers/create-pretender"; acceptance("Tags", { loggedIn: true }); -QUnit.test("list the tags", async assert => { +QUnit.test("list the tags", async (assert) => { await visit("/tags"); assert.ok($("body.tags-page").length, "has the body class"); @@ -16,11 +16,11 @@ QUnit.test("list the tags", async assert => { acceptance("Tags listed by group", { loggedIn: true, settings: { - tags_listed_by_group: true - } + tags_listed_by_group: true, + }, }); -QUnit.test("list the tags in groups", async assert => { +QUnit.test("list the tags in groups", async (assert) => { await visit("/tags"); assert.equal( $(".tag-list").length, @@ -30,7 +30,7 @@ QUnit.test("list the tags in groups", async assert => { assert.deepEqual( $(".tag-list h3") .toArray() - .map(i => { + .map((i) => { return $(i).text(); }), ["Ford Cars", "Honda Cars", "Makes", "Other Tags"], @@ -39,7 +39,7 @@ QUnit.test("list the tags in groups", async assert => { assert.deepEqual( $(".tag-list:first .discourse-tag") .toArray() - .map(i => { + .map((i) => { return $(i).text(); }), ["focus", "Escort"], @@ -48,7 +48,7 @@ QUnit.test("list the tags in groups", async assert => { assert.deepEqual( $(".tag-list:first .discourse-tag") .toArray() - .map(i => { + .map((i) => { return $(i).attr("href"); }), ["/tag/focus", "/tag/escort"], @@ -61,11 +61,11 @@ QUnit.test("list the tags in groups", async assert => { ); }); -test("new topic button is not available for staff-only tags", async assert => { +test("new topic button is not available for staff-only tags", async (assert) => { pretender.get("/tag/regular-tag/notifications", () => [ 200, { "Content-Type": "application/json" }, - { tag_notification: { id: "regular-tag", notification_level: 1 } } + { tag_notification: { id: "regular-tag", notification_level: 1 } }, ]); pretender.get("/tag/regular-tag/l/latest.json", () => [ @@ -84,18 +84,18 @@ test("new topic button is not available for staff-only tags", async assert => { { id: 1, name: "regular-tag", - topic_count: 1 - } + topic_count: 1, + }, ], - topics: [] - } - } + topics: [], + }, + }, ]); pretender.get("/tag/staff-only-tag/notifications", () => [ 200, { "Content-Type": "application/json" }, - { tag_notification: { id: "staff-only-tag", notification_level: 1 } } + { tag_notification: { id: "staff-only-tag", notification_level: 1 } }, ]); pretender.get("/tag/staff-only-tag/l/latest.json", () => [ @@ -115,12 +115,12 @@ test("new topic button is not available for staff-only tags", async assert => { id: 1, name: "staff-only-tag", topic_count: 1, - staff: true - } + staff: true, + }, ], - topics: [] - } - } + topics: [], + }, + }, ]); updateCurrentUser({ moderator: false, admin: false }); @@ -143,12 +143,12 @@ test("new topic button is not available for staff-only tags", async assert => { acceptance("Tag info", { loggedIn: true, settings: { - tags_listed_by_group: true + tags_listed_by_group: true, }, pretend(server, helper) { server.get("/tag/planters/notifications", () => { return helper.response({ - tag_notification: { id: "planters", notification_level: 1 } + tag_notification: { id: "planters", notification_level: 1 }, }); }); @@ -166,11 +166,11 @@ acceptance("Tag info", { { id: 1, name: "planters", - topic_count: 1 - } + topic_count: 1, + }, ], - topics: [] - } + topics: [], + }, }); }); @@ -185,15 +185,15 @@ acceptance("Tag info", { synonyms: [ { id: "containers", - text: "containers" + text: "containers", }, { id: "planter", - text: "planter" - } + text: "planter", + }, ], tag_group_names: ["Gardening"], - category_ids: [7] + category_ids: [7], }, categories: [ { @@ -209,15 +209,15 @@ acceptance("Tag info", { topic_url: "/t/category-definition-for-outdoors/1026", read_restricted: false, permission: null, - notification_level: null - } - ] + notification_level: null, + }, + ], }); }); - } + }, }); -test("tag info can show synonyms", async assert => { +test("tag info can show synonyms", async (assert) => { updateCurrentUser({ moderator: false, admin: false }); await visit("/tag/planters"); @@ -226,9 +226,7 @@ test("tag info can show synonyms", async assert => { await click("#show-tag-info"); assert.ok(exists(".tag-info .tag-name"), "show tag"); assert.ok( - find(".tag-info .tag-associations") - .text() - .indexOf("Gardening") >= 0, + find(".tag-info .tag-associations").text().indexOf("Gardening") >= 0, "show tag group names" ); assert.ok( @@ -244,11 +242,11 @@ test("tag info can show synonyms", async assert => { assert.ok(!exists("#delete-tag"), "can't delete tag"); }); -test("admin can manage tags", async assert => { +test("admin can manage tags", async (assert) => { pretender.delete("/tag/planters/synonyms/containers", () => [ 200, { "Content-Type": "application/json" }, - { success: true } + { success: true }, ]); updateCurrentUser({ moderator: false, admin: true }); diff --git a/test/javascripts/acceptance/topic-admin-menu-test.js b/test/javascripts/acceptance/topic-admin-menu-test.js index 64df2fe2726..692ce4758b9 100644 --- a/test/javascripts/acceptance/topic-admin-menu-test.js +++ b/test/javascripts/acceptance/topic-admin-menu-test.js @@ -2,7 +2,7 @@ import { acceptance, updateCurrentUser } from "helpers/qunit-helpers"; acceptance("Topic - Admin Menu Anonymous Users", { loggedIn: false }); -QUnit.test("Enter as a regular user", async assert => { +QUnit.test("Enter as a regular user", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok(exists("#topic"), "The topic was rendered"); assert.ok( @@ -13,17 +13,23 @@ QUnit.test("Enter as a regular user", async assert => { acceptance("Topic - Admin Menu", { loggedIn: true }); -QUnit.test("Enter as a user with group moderator permissions", async assert => { - updateCurrentUser({ moderator: false, admin: false, trust_level: 1 }); +QUnit.test( + "Enter as a user with group moderator permissions", + async (assert) => { + updateCurrentUser({ moderator: false, admin: false, trust_level: 1 }); - await visit("/t/topic-for-group-moderators/2480"); - assert.ok(exists("#topic"), "The topic was rendered"); - assert.ok(exists(".toggle-admin-menu"), "The admin menu button was rendered"); -}); + await visit("/t/topic-for-group-moderators/2480"); + assert.ok(exists("#topic"), "The topic was rendered"); + assert.ok( + exists(".toggle-admin-menu"), + "The admin menu button was rendered" + ); + } +); QUnit.test( "Enter as a user with moderator and admin permissions", - async assert => { + async (assert) => { updateCurrentUser({ moderator: true, admin: true, trust_level: 4 }); await visit("/t/internationalization-localization/280"); @@ -35,15 +41,18 @@ QUnit.test( } ); -QUnit.test("Toggle the menu as admin focuses the first item", async assert => { - updateCurrentUser({ admin: true }); +QUnit.test( + "Toggle the menu as admin focuses the first item", + async (assert) => { + updateCurrentUser({ admin: true }); - await visit("/t/internationalization-localization/280"); - assert.ok(exists("#topic"), "The topic was rendered"); - await click(".toggle-admin-menu"); + await visit("/t/internationalization-localization/280"); + assert.ok(exists("#topic"), "The topic was rendered"); + await click(".toggle-admin-menu"); - assert.equal( - document.activeElement, - document.querySelector(".topic-admin-multi-select > button") - ); -}); + assert.equal( + document.activeElement, + document.querySelector(".topic-admin-multi-select > button") + ); + } +); diff --git a/test/javascripts/acceptance/topic-anonymous-test.js b/test/javascripts/acceptance/topic-anonymous-test.js index 26b3d6fb3c4..a5cfe42f22c 100644 --- a/test/javascripts/acceptance/topic-anonymous-test.js +++ b/test/javascripts/acceptance/topic-anonymous-test.js @@ -1,7 +1,7 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("Topic - Anonymous"); -QUnit.test("Enter a Topic", async assert => { +QUnit.test("Enter a Topic", async (assert) => { await visit("/t/internationalization-localization/280/1"); assert.ok(exists("#topic"), "The topic was rendered"); assert.ok(exists("#topic .cooked"), "The topic has cooked posts"); @@ -11,24 +11,24 @@ QUnit.test("Enter a Topic", async assert => { ); }); -QUnit.test("Enter without an id", async assert => { +QUnit.test("Enter without an id", async (assert) => { await visit("/t/internationalization-localization"); assert.ok(exists("#topic"), "The topic was rendered"); }); -QUnit.test("Enter a 404 topic", async assert => { +QUnit.test("Enter a 404 topic", async (assert) => { await visit("/t/not-found/404"); assert.ok(!exists("#topic"), "The topic was not rendered"); assert.ok(exists(".topic-error"), "An error message is displayed"); }); -QUnit.test("Enter without access", async assert => { +QUnit.test("Enter without access", async (assert) => { await visit("/t/i-dont-have-access/403"); assert.ok(!exists("#topic"), "The topic was not rendered"); assert.ok(exists(".topic-error"), "An error message is displayed"); }); -QUnit.test("Enter with 500 errors", async assert => { +QUnit.test("Enter with 500 errors", async (assert) => { await visit("/t/throws-error/500"); assert.ok(!exists("#topic"), "The topic was not rendered"); assert.ok(exists(".topic-error"), "An error message is displayed"); diff --git a/test/javascripts/acceptance/topic-discovery-test.js b/test/javascripts/acceptance/topic-discovery-test.js index 75b9a86f6bc..8f6ee958240 100644 --- a/test/javascripts/acceptance/topic-discovery-test.js +++ b/test/javascripts/acceptance/topic-discovery-test.js @@ -5,11 +5,11 @@ import MessageBus from "message-bus-client"; acceptance("Topic Discovery", { settings: { - show_pinned_excerpt_desktop: true - } + show_pinned_excerpt_desktop: true, + }, }); -QUnit.test("Visit Discovery Pages", async assert => { +QUnit.test("Visit Discovery Pages", async (assert) => { await visit("/"); assert.ok($("body.navigation-topics").length, "has the default navigation"); assert.ok(exists(".topic-list"), "The list of topics was rendered"); @@ -68,7 +68,7 @@ QUnit.test("Visit Discovery Pages", async assert => { ); }); -QUnit.test("Clearing state after leaving a category", async assert => { +QUnit.test("Clearing state after leaving a category", async (assert) => { await visit("/c/dev"); assert.ok( exists(".topic-list-item[data-topic-id=11994] .topic-excerpt"), @@ -81,7 +81,7 @@ QUnit.test("Clearing state after leaving a category", async assert => { ); }); -QUnit.test("Live update unread state", async assert => { +QUnit.test("Live update unread state", async (assert) => { await visit("/"); assert.ok( exists(".topic-list-item:not(.visited) a[data-topic-id='11995']"), @@ -89,7 +89,7 @@ QUnit.test("Live update unread state", async assert => { ); // Mimic a messagebus message - MessageBus.callbacks.filterBy("channel", "/latest").map(c => + MessageBus.callbacks.filterBy("channel", "/latest").map((c) => c.func({ message_type: "read", topic_id: 11995, @@ -97,8 +97,8 @@ QUnit.test("Live update unread state", async assert => { highest_post_number: 1, last_read_post_number: 2, notification_level: 1, - topic_id: 11995 - } + topic_id: 11995, + }, }) ); @@ -112,7 +112,7 @@ QUnit.test("Live update unread state", async assert => { QUnit.test( "Using period chooser when query params are present", - async assert => { + async (assert) => { await visit("/top?f=foo&d=bar"); sandbox.stub(DiscourseURL, "routeTo"); diff --git a/test/javascripts/acceptance/topic-edit-timer-test.js b/test/javascripts/acceptance/topic-edit-timer-test.js index 262b9191160..f20caf47c58 100644 --- a/test/javascripts/acceptance/topic-edit-timer-test.js +++ b/test/javascripts/acceptance/topic-edit-timer-test.js @@ -13,13 +13,13 @@ acceptance("Topic - Edit timer", { duration: 1, based_on_last_post: false, closed: false, - category_id: null + category_id: null, }) ); - } + }, }); -QUnit.test("default", async assert => { +QUnit.test("default", async (assert) => { updateCurrentUser({ moderator: true }); const timerType = selectKit(".select-kit.timer-type"); const futureDateInputSelector = selectKit(".future-date-input-selector"); @@ -40,7 +40,7 @@ QUnit.test("default", async assert => { assert.equal(futureDateInputSelector.header().value(), null); }); -QUnit.test("autoclose - specific time", async assert => { +QUnit.test("autoclose - specific time", async (assert) => { updateCurrentUser({ moderator: true }); const futureDateInputSelector = selectKit(".future-date-input-selector"); @@ -51,22 +51,15 @@ QUnit.test("autoclose - specific time", async assert => { await futureDateInputSelector.expand(); await futureDateInputSelector.selectRowByValue("next_week"); - assert.ok( - futureDateInputSelector - .header() - .label() - .includes("Next week") - ); + assert.ok(futureDateInputSelector.header().label().includes("Next week")); assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex = /will automatically close in/g; - const html = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex.test(html)); }); -QUnit.skip("autoclose", async assert => { +QUnit.skip("autoclose", async (assert) => { updateCurrentUser({ moderator: true }); const futureDateInputSelector = selectKit(".future-date-input-selector"); @@ -77,18 +70,11 @@ QUnit.skip("autoclose", async assert => { await futureDateInputSelector.expand(); await futureDateInputSelector.selectRowByValue("next_week"); - assert.ok( - futureDateInputSelector - .header() - .label() - .includes("Next week") - ); + assert.ok(futureDateInputSelector.header().label().includes("Next week")); assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex1 = /will automatically close in/g; - const html1 = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html1 = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex1.test(html1)); await futureDateInputSelector.expand(); @@ -97,17 +83,12 @@ QUnit.skip("autoclose", async assert => { await fillIn(".future-date-input .date-picker", "2099-11-24"); assert.ok( - futureDateInputSelector - .header() - .label() - .includes("Pick date and time") + futureDateInputSelector.header().label().includes("Pick date and time") ); assert.equal(futureDateInputSelector.header().value(), "pick_date_and_time"); const regex2 = /will automatically close in/g; - const html2 = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html2 = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex2.test(html2)); await futureDateInputSelector.expand(); @@ -127,13 +108,11 @@ QUnit.skip("autoclose", async assert => { ); const regex3 = /This topic will close.*after the last reply/g; - const html3 = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html3 = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex3.test(html3)); }); -QUnit.test("close temporarily", async assert => { +QUnit.test("close temporarily", async (assert) => { updateCurrentUser({ moderator: true }); const timerType = selectKit(".select-kit.timer-type"); const futureDateInputSelector = selectKit(".future-date-input-selector"); @@ -151,18 +130,11 @@ QUnit.test("close temporarily", async assert => { await futureDateInputSelector.expand(); await futureDateInputSelector.selectRowByValue("next_week"); - assert.ok( - futureDateInputSelector - .header() - .label() - .includes("Next week") - ); + assert.ok(futureDateInputSelector.header().label().includes("Next week")); assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex1 = /will automatically open in/g; - const html1 = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html1 = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex1.test(html1)); await futureDateInputSelector.expand(); @@ -174,13 +146,11 @@ QUnit.test("close temporarily", async assert => { assert.equal(futureDateInputSelector.header().value(), "pick_date_and_time"); const regex2 = /will automatically open in/g; - const html2 = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html2 = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex2.test(html2)); }); -QUnit.test("schedule", async assert => { +QUnit.test("schedule", async (assert) => { updateCurrentUser({ moderator: true }); const timerType = selectKit(".select-kit.timer-type"); const categoryChooser = selectKit(".modal-body .category-chooser"); @@ -205,22 +175,15 @@ QUnit.test("schedule", async assert => { await futureDateInputSelector.expand(); await futureDateInputSelector.selectRowByValue("next_week"); - assert.ok( - futureDateInputSelector - .header() - .label() - .includes("Next week") - ); + assert.ok(futureDateInputSelector.header().label().includes("Next week")); assert.equal(futureDateInputSelector.header().value(), "next_week"); const regex = /will be published to #dev/g; - const text = find(".future-date-input .topic-status-info") - .text() - .trim(); + const text = find(".future-date-input .topic-status-info").text().trim(); assert.ok(regex.test(text)); }); -QUnit.test("TL4 can't auto-delete", async assert => { +QUnit.test("TL4 can't auto-delete", async (assert) => { updateCurrentUser({ moderator: false, admin: false, trust_level: 4 }); await visit("/t/internationalization-localization"); @@ -234,7 +197,7 @@ QUnit.test("TL4 can't auto-delete", async assert => { assert.ok(!timerType.rowByValue("delete").exists()); }); -QUnit.test("auto delete", async assert => { +QUnit.test("auto delete", async (assert) => { updateCurrentUser({ moderator: true }); const timerType = selectKit(".select-kit.timer-type"); const futureDateInputSelector = selectKit(".future-date-input-selector"); @@ -252,22 +215,15 @@ QUnit.test("auto delete", async assert => { await futureDateInputSelector.expand(); await futureDateInputSelector.selectRowByValue("two_weeks"); - assert.ok( - futureDateInputSelector - .header() - .label() - .includes("Two Weeks") - ); + assert.ok(futureDateInputSelector.header().label().includes("Two Weeks")); assert.equal(futureDateInputSelector.header().value(), "two_weeks"); const regex = /will be automatically deleted/g; - const html = find(".future-date-input .topic-status-info") - .html() - .trim(); + const html = find(".future-date-input .topic-status-info").html().trim(); assert.ok(regex.test(html)); }); -QUnit.test("Inline delete timer", async assert => { +QUnit.test("Inline delete timer", async (assert) => { updateCurrentUser({ moderator: true }); const futureDateInputSelector = selectKit(".future-date-input-selector"); diff --git a/test/javascripts/acceptance/topic-footer-buttons-mobile-test.js b/test/javascripts/acceptance/topic-footer-buttons-mobile-test.js index db3268fe614..c8ebaa0c09f 100644 --- a/test/javascripts/acceptance/topic-footer-buttons-mobile-test.js +++ b/test/javascripts/acceptance/topic-footer-buttons-mobile-test.js @@ -12,10 +12,10 @@ acceptance("Topic footer buttons mobile", { beforeEach() { I18n.translations[I18n.locale].js.test = { title: "My title", - label: "My Label" + label: "My Label", }; - withPluginApi("0.8.28", api => { + withPluginApi("0.8.28", (api) => { api.registerTopicFooterButton({ id: "my-button", icon: "user", @@ -24,7 +24,7 @@ acceptance("Topic footer buttons mobile", { dropdown: true, action() { _test = 2; - } + }, }); }); }, @@ -32,10 +32,10 @@ acceptance("Topic footer buttons mobile", { afterEach() { clearTopicFooterButtons(); _test = undefined; - } + }, }); -QUnit.test("default", async assert => { +QUnit.test("default", async (assert) => { await visit("/t/internationalization-localization/280"); assert.equal(_test, null); diff --git a/test/javascripts/acceptance/topic-list-tracker-test.js b/test/javascripts/acceptance/topic-list-tracker-test.js index 632b7927b73..c58000843eb 100644 --- a/test/javascripts/acceptance/topic-list-tracker-test.js +++ b/test/javascripts/acceptance/topic-list-tracker-test.js @@ -2,11 +2,11 @@ import { acceptance } from "helpers/qunit-helpers"; import { nextTopicUrl, previousTopicUrl, - setTopicId + setTopicId, } from "discourse/lib/topic-list-tracker"; acceptance("Topic list tracking"); -QUnit.test("Navigation", async assert => { +QUnit.test("Navigation", async (assert) => { await visit("/"); let url = await nextTopicUrl(); assert.equal(url, "/t/error-after-upgrade-to-0-9-7-9/11557"); diff --git a/test/javascripts/acceptance/topic-move-posts-test.js b/test/javascripts/acceptance/topic-move-posts-test.js index d867c2a0638..96fec0a9e98 100644 --- a/test/javascripts/acceptance/topic-move-posts-test.js +++ b/test/javascripts/acceptance/topic-move-posts-test.js @@ -2,16 +2,14 @@ import I18n from "I18n"; import { acceptance } from "helpers/qunit-helpers"; acceptance("Topic move posts", { loggedIn: true }); -QUnit.test("default", async assert => { +QUnit.test("default", async (assert) => { await visit("/t/internationalization-localization"); await click(".toggle-admin-menu"); await click(".topic-admin-multi-select .btn"); await click("#post_11 .select-below"); assert.equal( - find(".selected-posts .move-to-topic") - .text() - .trim(), + find(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" ); @@ -47,7 +45,7 @@ QUnit.test("default", async assert => { ); }); -QUnit.test("moving all posts", async assert => { +QUnit.test("moving all posts", async (assert) => { await visit("/t/internationalization-localization"); await click(".toggle-admin-menu"); await click(".topic-admin-multi-select .btn"); @@ -83,16 +81,14 @@ QUnit.test("moving all posts", async assert => { ); }); -QUnit.test("moving posts from personal message", async assert => { +QUnit.test("moving posts from personal message", async (assert) => { await visit("/t/pm-for-testing/12"); await click(".toggle-admin-menu"); await click(".topic-admin-multi-select .btn"); await click("#post_1 .select-post"); assert.equal( - find(".selected-posts .move-to-topic") - .text() - .trim(), + find(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" ); @@ -121,16 +117,14 @@ QUnit.test("moving posts from personal message", async assert => { ); }); -QUnit.test("group moderator moving posts", async assert => { +QUnit.test("group moderator moving posts", async (assert) => { await visit("/t/topic-for-group-moderators/2480"); await click(".toggle-admin-menu"); await click(".topic-admin-multi-select .btn"); await click("#post_2 .select-below"); assert.equal( - find(".selected-posts .move-to-topic") - .text() - .trim(), + find(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" ); diff --git a/test/javascripts/acceptance/topic-notifications-button-test.js b/test/javascripts/acceptance/topic-notifications-button-test.js index fdb7fa367d3..48e65e0b3c9 100644 --- a/test/javascripts/acceptance/topic-notifications-button-test.js +++ b/test/javascripts/acceptance/topic-notifications-button-test.js @@ -7,10 +7,10 @@ acceptance("Topic Notifications button", { server.post("/t/280/notifications", () => { return helper.response({}); }); - } + }, }); -QUnit.test("Updating topic notification level", async assert => { +QUnit.test("Updating topic notification level", async (assert) => { const notificationOptions = selectKit( "#topic-footer-buttons .topic-notifications-options" ); diff --git a/test/javascripts/acceptance/topic-quote-button-test.js b/test/javascripts/acceptance/topic-quote-button-test.js index 181ec543135..4bedcd4f060 100644 --- a/test/javascripts/acceptance/topic-quote-button-test.js +++ b/test/javascripts/acceptance/topic-quote-button-test.js @@ -15,24 +15,27 @@ acceptance("Topic - Quote button - logged in", { loggedIn: true, settings: { share_quote_visibility: "anonymous", - share_quote_buttons: "twitter|email" - } -}); - -QUnit.test("Does not show the quote share buttons by default", async assert => { - await visit("/t/internationalization-localization/280"); - selectText("#post_5 blockquote"); - assert.ok(exists(".insert-quote"), "it shows the quote button"); - assert.equal( - find(".quote-sharing").length, - 0, - "it does not show quote sharing" - ); + share_quote_buttons: "twitter|email", + }, }); +QUnit.test( + "Does not show the quote share buttons by default", + async (assert) => { + await visit("/t/internationalization-localization/280"); + selectText("#post_5 blockquote"); + assert.ok(exists(".insert-quote"), "it shows the quote button"); + assert.equal( + find(".quote-sharing").length, + 0, + "it does not show quote sharing" + ); + } +); + QUnit.test( "Shows quote share buttons with the right site settings", - async function(assert) { + async function (assert) { this.siteSettings.share_quote_visibility = "all"; await visit("/t/internationalization-localization/280"); @@ -54,13 +57,13 @@ acceptance("Topic - Quote button - anonymous", { loggedIn: false, settings: { share_quote_visibility: "anonymous", - share_quote_buttons: "twitter|email" - } + share_quote_buttons: "twitter|email", + }, }); QUnit.test( "Shows quote share buttons with the right site settings", - async function(assert) { + async function (assert) { await visit("/t/internationalization-localization/280"); selectText("#post_5 blockquote"); @@ -83,7 +86,7 @@ QUnit.test( QUnit.test( "Shows single share button when site setting only has one item", - async function(assert) { + async function (assert) { this.siteSettings.share_quote_buttons = "twitter"; await visit("/t/internationalization-localization/280"); @@ -102,7 +105,9 @@ QUnit.test( } ); -QUnit.test("Shows nothing when visibility is disabled", async function(assert) { +QUnit.test("Shows nothing when visibility is disabled", async function ( + assert +) { this.siteSettings.share_quote_visibility = "none"; await visit("/t/internationalization-localization/280"); diff --git a/test/javascripts/acceptance/topic-test.js b/test/javascripts/acceptance/topic-test.js index 27c5e3b5a82..8e673168aa5 100644 --- a/test/javascripts/acceptance/topic-test.js +++ b/test/javascripts/acceptance/topic-test.js @@ -10,10 +10,10 @@ acceptance("Topic", { server.put("/posts/398/wiki", () => { return helper.response({}); }); - } + }, }); -QUnit.test("Reply as new topic", async assert => { +QUnit.test("Reply as new topic", async (assert) => { await visit("/t/internationalization-localization/280"); await click("button.share:eq(0)"); await click(".reply-as-new-topic a"); @@ -21,22 +21,18 @@ QUnit.test("Reply as new topic", async assert => { assert.ok(exists(".d-editor-input"), "the composer input is visible"); assert.equal( - find(".d-editor-input") - .val() - .trim(), + find(".d-editor-input").val().trim(), `Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`, "it fills composer with the ring string" ); assert.equal( - selectKit(".category-chooser") - .header() - .value(), + selectKit(".category-chooser").header().value(), "2", "it fills category selector with the right category" ); }); -QUnit.test("Reply as new message", async assert => { +QUnit.test("Reply as new message", async (assert) => { await visit("/t/pm-for-testing/12"); await click("button.share:eq(0)"); await click(".reply-as-new-topic a"); @@ -44,9 +40,7 @@ QUnit.test("Reply as new message", async assert => { assert.ok(exists(".d-editor-input"), "the composer input is visible"); assert.equal( - find(".d-editor-input") - .val() - .trim(), + find(".d-editor-input").val().trim(), `Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`, "it fills composer with the ring string" ); @@ -72,14 +66,14 @@ QUnit.test("Reply as new message", async assert => { ); }); -QUnit.test("Share Modal", async assert => { +QUnit.test("Share Modal", async (assert) => { await visit("/t/internationalization-localization/280"); await click(".topic-post:first-child button.share"); assert.ok(exists("#share-link"), "it shows the share modal"); }); -QUnit.test("Showing and hiding the edit controls", async assert => { +QUnit.test("Showing and hiding the edit controls", async (assert) => { await visit("/t/internationalization-localization/280"); await click("#topic-title .d-icon-pencil-alt"); @@ -95,7 +89,7 @@ QUnit.test("Showing and hiding the edit controls", async assert => { assert.ok(!exists("#edit-title"), "it hides the editing controls"); }); -QUnit.test("Updating the topic title and category", async assert => { +QUnit.test("Updating the topic title and category", async (assert) => { const categoryChooser = selectKit(".title-wrapper .category-chooser"); await visit("/t/internationalization-localization/280"); @@ -112,15 +106,13 @@ QUnit.test("Updating the topic title and category", async assert => { "it displays the new category" ); assert.equal( - find(".fancy-title") - .text() - .trim(), + find(".fancy-title").text().trim(), "this is the new title", "it displays the new title" ); }); -QUnit.test("Marking a topic as wiki", async assert => { +QUnit.test("Marking a topic as wiki", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok(find("a.wiki").length === 0, "it does not show the wiki icon"); @@ -132,13 +124,11 @@ QUnit.test("Marking a topic as wiki", async assert => { assert.ok(find("a.wiki").length === 1, "it shows the wiki icon"); }); -QUnit.test("Visit topic routes", async assert => { +QUnit.test("Visit topic routes", async (assert) => { await visit("/t/12"); assert.equal( - find(".fancy-title") - .text() - .trim(), + find(".fancy-title").text().trim(), "PM for testing", "it routes to the right topic" ); @@ -146,15 +136,13 @@ QUnit.test("Visit topic routes", async assert => { await visit("/t/280/20"); assert.equal( - find(".fancy-title") - .text() - .trim(), + find(".fancy-title").text().trim(), "Internationalization / localization", "it routes to the right topic" ); }); -QUnit.test("Updating the topic title with emojis", async assert => { +QUnit.test("Updating the topic title with emojis", async (assert) => { await visit("/t/internationalization-localization/280"); await click("#topic-title .d-icon-pencil-alt"); @@ -163,15 +151,13 @@ QUnit.test("Updating the topic title with emojis", async assert => { await click("#topic-title .submit-edit"); assert.equal( - find(".fancy-title") - .html() - .trim(), + find(".fancy-title").html().trim(), `emojis title bike blonde_woman:t6`, "it displays the new title with emojis" ); }); -QUnit.test("Updating the topic title with unicode emojis", async assert => { +QUnit.test("Updating the topic title with unicode emojis", async (assert) => { await visit("/t/internationalization-localization/280"); await click("#topic-title .d-icon-pencil-alt"); @@ -180,9 +166,7 @@ QUnit.test("Updating the topic title with unicode emojis", async assert => { await click("#topic-title .submit-edit"); assert.equal( - find(".fancy-title") - .html() - .trim(), + find(".fancy-title").html().trim(), `emojis title man_farmerpray`, "it displays the new title with escaped unicode emojis" ); @@ -190,7 +174,7 @@ QUnit.test("Updating the topic title with unicode emojis", async assert => { QUnit.test( "Updating the topic title with unicode emojis without whitespaces", - async function(assert) { + async function (assert) { this.siteSettings.enable_inline_emoji_translation = true; await visit("/t/internationalization-localization/280"); await click("#topic-title .d-icon-pencil-alt"); @@ -200,27 +184,23 @@ QUnit.test( await click("#topic-title .submit-edit"); assert.equal( - find(".fancy-title") - .html() - .trim(), + find(".fancy-title").html().trim(), `Testslightly_smiling_faceTitle`, "it displays the new title with escaped unicode emojis" ); } ); -QUnit.test("Suggested topics", async assert => { +QUnit.test("Suggested topics", async (assert) => { await visit("/t/internationalization-localization/280"); assert.equal( - find("#suggested-topics .suggested-topics-title") - .text() - .trim(), + find("#suggested-topics .suggested-topics-title").text().trim(), I18n.t("suggested_topics.title") ); }); -QUnit.skip("Deleting a topic", async assert => { +QUnit.skip("Deleting a topic", async (assert) => { await visit("/t/internationalization-localization/280"); await click(".topic-post:eq(0) button.show-more-actions"); await click(".widget-button.delete"); @@ -228,7 +208,7 @@ QUnit.skip("Deleting a topic", async assert => { assert.ok(exists(".widget-button.recover"), "it shows the recover button"); }); -QUnit.test("Group category moderator posts", async assert => { +QUnit.test("Group category moderator posts", async (assert) => { await visit("/t/topic-for-group-moderators/2480"); assert.ok(exists(".category-moderator"), "it has a class applied"); @@ -239,11 +219,11 @@ acceptance("Topic featured links", { loggedIn: true, settings: { topic_featured_link_enabled: true, - max_topic_title_length: 80 - } + max_topic_title_length: 80, + }, }); -QUnit.skip("remove featured link", async assert => { +QUnit.skip("remove featured link", async (assert) => { await visit("/t/-/299/1"); assert.ok( exists(".title-wrapper .topic-featured-link"), @@ -261,7 +241,7 @@ QUnit.skip("remove featured link", async assert => { assert.ok(!exists(".title-wrapper .topic-featured-link"), "link is gone"); }); -QUnit.test("Converting to a public topic", async assert => { +QUnit.test("Converting to a public topic", async (assert) => { await visit("/t/test-pm/34"); assert.ok(exists(".private_message")); await click(".toggle-admin-menu"); @@ -275,7 +255,7 @@ QUnit.test("Converting to a public topic", async assert => { assert.ok(!exists(".private_message")); }); -QUnit.test("Unpinning unlisted topic", async assert => { +QUnit.test("Unpinning unlisted topic", async (assert) => { await visit("/t/internationalization-localization/280"); await click(".toggle-admin-menu"); @@ -289,7 +269,7 @@ QUnit.test("Unpinning unlisted topic", async assert => { assert.ok(exists(".topic-admin-pin"), "it should show the multi select menu"); }); -QUnit.test("selecting posts", async assert => { +QUnit.test("selecting posts", async (assert) => { await visit("/t/internationalization-localization/280"); await click(".toggle-admin-menu"); await click(".topic-admin-multi-select .btn"); @@ -305,7 +285,7 @@ QUnit.test("selecting posts", async assert => { ); }); -QUnit.test("select below", async assert => { +QUnit.test("select below", async (assert) => { await visit("/t/internationalization-localization/280"); await click(".toggle-admin-menu"); await click(".topic-admin-multi-select .btn"); @@ -328,7 +308,7 @@ QUnit.test("select below", async assert => { ); }); -QUnit.test("View Hidden Replies", async assert => { +QUnit.test("View Hidden Replies", async (assert) => { await visit("/t/internationalization-localization/280"); await click(".gap"); @@ -345,7 +325,7 @@ function selectText(selector) { selection.addRange(range); } -QUnit.test("Quoting a quote keeps the original poster name", async assert => { +QUnit.test("Quoting a quote keeps the original poster name", async (assert) => { await visit("/t/internationalization-localization/280"); selectText("#post_5 blockquote"); await click(".quote-button .insert-quote"); @@ -359,7 +339,7 @@ QUnit.test("Quoting a quote keeps the original poster name", async assert => { QUnit.test( "Quoting a quote with the Reply button keeps the original poster name", - async assert => { + async (assert) => { await visit("/t/internationalization-localization/280"); selectText("#post_5 blockquote"); await click(".reply"); @@ -374,7 +354,7 @@ QUnit.test( QUnit.test( "Quoting a quote with replyAsNewTopic keeps the original poster name", - async assert => { + async (assert) => { await visit("/t/internationalization-localization/280"); selectText("#post_5 blockquote"); await keyEvent(document, "keypress", "j".charCodeAt(0)); @@ -390,7 +370,7 @@ QUnit.test( QUnit.test( "Quoting by selecting text can mark the quote as full", - async assert => { + async (assert) => { await visit("/t/internationalization-localization/280"); selectText("#post_5 .cooked"); await click(".quote-button .insert-quote"); @@ -406,15 +386,15 @@ QUnit.test( acceptance("Topic with title decorated", { loggedIn: true, beforeEach() { - withPluginApi("0.8.40", api => { + withPluginApi("0.8.40", (api) => { api.decorateTopicTitle((topic, node, topicTitleType) => { node.innerText = `${node.innerText}-${topic.id}-${topicTitleType}`; }); }); - } + }, }); -QUnit.test("Decorate topic title", async assert => { +QUnit.test("Decorate topic title", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok( diff --git a/test/javascripts/acceptance/unknown-test.js b/test/javascripts/acceptance/unknown-test.js index abc4b0d9557..5584c7087ef 100644 --- a/test/javascripts/acceptance/unknown-test.js +++ b/test/javascripts/acceptance/unknown-test.js @@ -2,12 +2,12 @@ import { acceptance } from "helpers/qunit-helpers"; import pretender from "helpers/create-pretender"; acceptance("Unknown"); -QUnit.test("Permalink Unknown URL", async assert => { +QUnit.test("Permalink Unknown URL", async (assert) => { await visit("/url-that-doesn't-exist"); assert.ok(exists(".page-not-found"), "The not found content is present"); }); -QUnit.test("Permalink URL to a Topic", async assert => { +QUnit.test("Permalink URL to a Topic", async (assert) => { pretender.get("/permalink-check.json", () => { return [ 200, @@ -15,8 +15,8 @@ QUnit.test("Permalink URL to a Topic", async assert => { { found: true, internal: true, - target_url: "/t/internationalization-localization/280" - } + target_url: "/t/internationalization-localization/280", + }, ]; }); @@ -24,7 +24,7 @@ QUnit.test("Permalink URL to a Topic", async assert => { assert.ok(exists(".topic-post")); }); -QUnit.test("Permalink URL to a static page", async assert => { +QUnit.test("Permalink URL to a static page", async (assert) => { pretender.get("/permalink-check.json", () => { return [ 200, @@ -32,8 +32,8 @@ QUnit.test("Permalink URL to a static page", async assert => { { found: true, internal: true, - target_url: "/faq" - } + target_url: "/faq", + }, ]; }); diff --git a/test/javascripts/acceptance/user-anonymous-test.js b/test/javascripts/acceptance/user-anonymous-test.js index 2f4fbdf641d..aa14b9f3ee8 100644 --- a/test/javascripts/acceptance/user-anonymous-test.js +++ b/test/javascripts/acceptance/user-anonymous-test.js @@ -11,13 +11,13 @@ function hasTopicList(assert) { assert.ok(count(".topic-list tr") > 0, "it has a topic list"); } -QUnit.test("Root URL", async assert => { +QUnit.test("Root URL", async (assert) => { await visit("/u/eviltrout"); assert.ok($("body.user-summary-page").length, "has the body class"); assert.equal(currentPath(), "user.summary", "it defaults to summary"); }); -QUnit.test("Filters", async assert => { +QUnit.test("Filters", async (assert) => { await visit("/u/eviltrout/activity"); assert.ok($("body.user-activity-page").length, "has the body class"); hasStream(assert); @@ -31,13 +31,13 @@ QUnit.test("Filters", async assert => { assert.ok(exists(".user-stream.filter-5"), "stream has filter class"); }); -QUnit.test("Badges", async assert => { +QUnit.test("Badges", async (assert) => { await visit("/u/eviltrout/badges"); assert.ok($("body.user-badges-page").length, "has the body class"); assert.ok(exists(".user-badges-list .badge-card"), "shows a badge"); }); -QUnit.test("Restricted Routes", async assert => { +QUnit.test("Restricted Routes", async (assert) => { await visit("/u/eviltrout/preferences"); assert.equal( diff --git a/test/javascripts/acceptance/user-bookmarks-test.js b/test/javascripts/acceptance/user-bookmarks-test.js index f7a92a8c0a5..fc1f689ffa1 100644 --- a/test/javascripts/acceptance/user-bookmarks-test.js +++ b/test/javascripts/acceptance/user-bookmarks-test.js @@ -10,18 +10,18 @@ acceptance("User's bookmarks", { pretender.delete("/bookmarks/576", () => [ 200, { "Content-Type": "application/json" }, - {} + {}, ]); - } + }, }); -test("listing user bookmarks", async assert => { +test("listing user bookmarks", async (assert) => { await visit("/u/eviltrout/activity/bookmarks"); assert.ok(find(".bookmark-list-item").length); }); -test("removing a bookmark with a reminder shows a confirmation", async assert => { +test("removing a bookmark with a reminder shows a confirmation", async (assert) => { let listResponse = Object.assign( {}, userFixtures["/u/eviltrout/bookmarks.json"] @@ -30,7 +30,7 @@ test("removing a bookmark with a reminder shows a confirmation", async assert => pretender.get("/u/eviltrout/bookmarks.json", () => [ 200, { "Content-Type": "application/json" }, - listResponse + listResponse, ]); await visit("/u/eviltrout/activity/bookmarks"); @@ -45,16 +45,16 @@ test("removing a bookmark with a reminder shows a confirmation", async assert => listResponse.user_bookmark_list.bookmarks[0].reminder_at = null; }); -test("listing users bookmarks - no bookmarks", async assert => { +test("listing users bookmarks - no bookmarks", async (assert) => { pretender.get("/u/eviltrout/bookmarks.json", () => [ 200, { - "Content-Type": "application/json" + "Content-Type": "application/json", }, { bookmarks: [], - no_results_help: "no bookmarks" - } + no_results_help: "no bookmarks", + }, ]); await visit("/u/eviltrout/activity/bookmarks"); @@ -62,7 +62,7 @@ test("listing users bookmarks - no bookmarks", async assert => { assert.equal(find(".alert.alert-info").text(), "no bookmarks"); }); -test("removing a bookmark with no reminder does not show a confirmation", async assert => { +test("removing a bookmark with no reminder does not show a confirmation", async (assert) => { await visit("/u/eviltrout/activity/bookmarks"); const dropdown = selectKit(".bookmark-actions-dropdown"); diff --git a/test/javascripts/acceptance/user-card-mobile-test.js b/test/javascripts/acceptance/user-card-mobile-test.js index 9ed35047b60..6b35a468795 100644 --- a/test/javascripts/acceptance/user-card-mobile-test.js +++ b/test/javascripts/acceptance/user-card-mobile-test.js @@ -3,7 +3,7 @@ import DiscourseURL from "discourse/lib/url"; acceptance("User Card - Mobile", { mobileView: true }); -QUnit.skip("user card", async assert => { +QUnit.skip("user card", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok( invisible(".user-card"), diff --git a/test/javascripts/acceptance/user-card-test.js b/test/javascripts/acceptance/user-card-test.js index e17b640543c..4c1e81c07a1 100644 --- a/test/javascripts/acceptance/user-card-test.js +++ b/test/javascripts/acceptance/user-card-test.js @@ -7,10 +7,10 @@ import User from "discourse/models/user"; acceptance("User Card - Show Local Time", { loggedIn: true, - settings: { display_local_time_in_user_card: true } + settings: { display_local_time_in_user_card: true }, }); -QUnit.skip("user card local time", async assert => { +QUnit.skip("user card local time", async (assert) => { User.current().changeTimezone("Australia/Brisbane"); let cardResponse = Object.assign({}, userFixtures["/u/eviltrout/card.json"]); cardResponse.user.timezone = "Australia/Perth"; @@ -18,7 +18,7 @@ QUnit.skip("user card local time", async assert => { pretender.get("/u/eviltrout/card.json", () => [ 200, { "Content-Type": "application/json" }, - cardResponse + cardResponse, ]); await visit("/t/internationalization-localization/280"); @@ -32,9 +32,7 @@ QUnit.skip("user card local time", async assert => { assert.ok(visible(".user-card"), "card should appear"); assert.equal( - find(".user-card .local-time") - .text() - .trim(), + find(".user-card .local-time").text().trim(), expectedTime, "user card contains the user's local time" ); @@ -45,7 +43,7 @@ QUnit.skip("user card local time", async assert => { pretender.get("/u/charlie/card.json", () => [ 200, { "Content-Type": "application/json" }, - cardResponse + cardResponse, ]); await click("a[data-user-card=charlie]:first"); @@ -56,9 +54,7 @@ QUnit.skip("user card local time", async assert => { .format("h:mm a"); assert.equal( - find(".user-card .local-time") - .text() - .trim(), + find(".user-card .local-time").text().trim(), expectedTime, "opening another user card updates the local time in the card (no caching)" ); @@ -66,7 +62,7 @@ QUnit.skip("user card local time", async assert => { QUnit.test( "user card local time - does not update timezone for another user", - async assert => { + async (assert) => { User.current().changeTimezone("Australia/Brisbane"); let cardResponse = Object.assign({}, userFixtures["/u/charlie/card.json"]); delete cardResponse.user.timezone; @@ -74,7 +70,7 @@ QUnit.test( pretender.get("/u/charlie/card.json", () => [ 200, { "Content-Type": "application/json" }, - cardResponse + cardResponse, ]); await visit("/t/internationalization-localization/280"); @@ -89,16 +85,14 @@ QUnit.test( acceptance("User Card", { loggedIn: true }); -QUnit.skip("user card", async assert => { +QUnit.skip("user card", async (assert) => { await visit("/t/internationalization-localization/280"); assert.ok(invisible(".user-card"), "user card is invisible by default"); await click("a[data-user-card=eviltrout]:first"); assert.ok(visible(".user-card"), "card should appear"); assert.equal( - find(".user-card .username") - .text() - .trim(), + find(".user-card .username").text().trim(), "eviltrout", "user card contains the data" ); @@ -113,9 +107,7 @@ QUnit.skip("user card", async assert => { await click("a[data-user-card=charlie]:first"); assert.ok(visible(".user-card"), "card should appear"); assert.equal( - find(".user-card .username") - .text() - .trim(), + find(".user-card .username").text().trim(), "charlie", "user card contains the data" ); @@ -138,9 +130,7 @@ QUnit.skip("user card", async assert => { await click("a.mention .icon"); assert.ok(visible(".user-card"), "card should appear"); assert.equal( - find(".user-card .username") - .text() - .trim(), + find(".user-card .username").text().trim(), "eviltrout", "user card contains the data" ); diff --git a/test/javascripts/acceptance/user-drafts-stream-test.js b/test/javascripts/acceptance/user-drafts-stream-test.js index 3a8ae358db3..a892c2a8be3 100644 --- a/test/javascripts/acceptance/user-drafts-stream-test.js +++ b/test/javascripts/acceptance/user-drafts-stream-test.js @@ -2,7 +2,7 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("User Drafts", { loggedIn: true }); -QUnit.test("Stream", async assert => { +QUnit.test("Stream", async (assert) => { await visit("/u/eviltrout/activity/drafts"); assert.ok(find(".user-stream-item").length === 3, "has drafts"); @@ -13,15 +13,13 @@ QUnit.test("Stream", async assert => { ); }); -QUnit.test("Stream - resume draft", async assert => { +QUnit.test("Stream - resume draft", async (assert) => { await visit("/u/eviltrout/activity/drafts"); assert.ok(find(".user-stream-item").length > 0, "has drafts"); await click(".user-stream-item .resume-draft"); assert.equal( - find(".d-editor-input") - .val() - .trim(), + find(".d-editor-input").val().trim(), "A fun new topic for testing drafts." ); }); diff --git a/test/javascripts/acceptance/user-preferences-interface-test.js b/test/javascripts/acceptance/user-preferences-interface-test.js index 1fe2586832d..1cc396a984c 100644 --- a/test/javascripts/acceptance/user-preferences-interface-test.js +++ b/test/javascripts/acceptance/user-preferences-interface-test.js @@ -5,10 +5,10 @@ import Session from "discourse/models/session"; import cookie, { removeCookie } from "discourse/lib/cookie"; acceptance("User Preferences - Interface", { - loggedIn: true + loggedIn: true, }); -QUnit.test("font size change", async assert => { +QUnit.test("font size change", async (assert) => { removeCookie("text_size"); const savePreferences = async () => { @@ -55,17 +55,17 @@ QUnit.test("font size change", async assert => { QUnit.test( "does not show option to disable dark mode by default", - async assert => { + async (assert) => { await visit("/u/eviltrout/preferences/interface"); assert.equal($(".control-group.dark-mode").length, 0); } ); -QUnit.test("shows light/dark color scheme pickers", async assert => { +QUnit.test("shows light/dark color scheme pickers", async (assert) => { let site = Site.current(); site.set("user_color_schemes", [ { id: 2, name: "Cool Breeze" }, - { id: 3, name: "Dark Night", is_dark: true } + { id: 3, name: "Dark Night", is_dark: true }, ]); await visit("/u/eviltrout/preferences/interface"); @@ -76,7 +76,7 @@ QUnit.test("shows light/dark color scheme pickers", async assert => { function interfacePretender(server, helper) { server.get("/color-scheme-stylesheet/2.json", () => { return helper.response({ - success: "OK" + success: "OK", }); }); } @@ -84,10 +84,10 @@ function interfacePretender(server, helper) { acceptance("User Preferences Color Schemes (with default dark scheme)", { loggedIn: true, settings: { default_dark_mode_color_scheme_id: 1 }, - pretend: interfacePretender + pretend: interfacePretender, }); -QUnit.test("show option to disable dark mode", async assert => { +QUnit.test("show option to disable dark mode", async (assert) => { await visit("/u/eviltrout/preferences/interface"); assert.ok( @@ -96,7 +96,7 @@ QUnit.test("show option to disable dark mode", async assert => { ); }); -QUnit.test("no color scheme picker by default", async assert => { +QUnit.test("no color scheme picker by default", async (assert) => { let site = Site.current(); site.set("user_color_schemes", []); @@ -104,7 +104,7 @@ QUnit.test("no color scheme picker by default", async assert => { assert.equal($(".control-group.color-scheme").length, 0); }); -QUnit.test("light color scheme picker", async assert => { +QUnit.test("light color scheme picker", async (assert) => { let site = Site.current(); site.set("user_color_schemes", [{ id: 2, name: "Cool Breeze" }]); @@ -117,7 +117,7 @@ QUnit.test("light color scheme picker", async assert => { ); }); -QUnit.test("light and dark color scheme pickers", async assert => { +QUnit.test("light and dark color scheme pickers", async (assert) => { let site = Site.current(); let session = Session.current(); session.userDarkSchemeId = 1; // same as default set in site settings @@ -125,7 +125,7 @@ QUnit.test("light and dark color scheme pickers", async assert => { site.set("default_dark_color_scheme", { id: 1, name: "Dark" }); site.set("user_color_schemes", [ { id: 2, name: "Cool Breeze" }, - { id: 3, name: "Dark Night", is_dark: true } + { id: 3, name: "Dark Night", is_dark: true }, ]); const savePreferences = async () => { @@ -171,9 +171,7 @@ QUnit.test("light and dark color scheme pickers", async assert => { // dark scheme await selectKit(".dark-color-scheme .combobox").expand(); assert.ok( - selectKit(".dark-color-scheme .combobox") - .rowByValue(1) - .exists(), + selectKit(".dark-color-scheme .combobox").rowByValue(1).exists(), "default dark scheme is included" ); @@ -189,17 +187,13 @@ QUnit.test("light and dark color scheme pickers", async assert => { await click("button.undo-preview"); assert.equal( - selectKit(".light-color-scheme .combobox") - .header() - .value(), + selectKit(".light-color-scheme .combobox").header().value(), null, "resets light scheme dropdown" ); assert.equal( - selectKit(".dark-color-scheme .combobox") - .header() - .value(), + selectKit(".dark-color-scheme .combobox").header().value(), session.userDarkSchemeId, "resets dark scheme dropdown" ); diff --git a/test/javascripts/acceptance/user-test.js b/test/javascripts/acceptance/user-test.js index 24f630b942b..f4b28465bc3 100644 --- a/test/javascripts/acceptance/user-test.js +++ b/test/javascripts/acceptance/user-test.js @@ -5,7 +5,7 @@ import { Promise } from "rsvp"; acceptance("User", { loggedIn: true }); -QUnit.test("Invalid usernames", async assert => { +QUnit.test("Invalid usernames", async (assert) => { pretender.get("/u/eviltrout%2F..%2F..%2F.json", () => { return [400, { "Content-Type": "application/json" }, {}]; }); @@ -15,23 +15,23 @@ QUnit.test("Invalid usernames", async assert => { assert.equal(currentPath(), "exception-unknown"); }); -QUnit.test("Unicode usernames", async assert => { +QUnit.test("Unicode usernames", async (assert) => { await visit("/u/%E3%83%A9%E3%82%A4%E3%82%AA%E3%83%B3/summary"); assert.equal(currentPath(), "user.summary"); }); -QUnit.test("Invites", async assert => { +QUnit.test("Invites", async (assert) => { await visit("/u/eviltrout/invited/pending"); assert.ok($("body.user-invites-page").length, "has the body class"); }); -QUnit.test("Messages", async assert => { +QUnit.test("Messages", async (assert) => { await visit("/u/eviltrout/messages"); assert.ok($("body.user-messages-page").length, "has the body class"); }); -QUnit.test("Notifications", async assert => { +QUnit.test("Notifications", async (assert) => { await visit("/u/eviltrout/notifications"); assert.ok($("body.user-notifications-page").length, "has the body class"); @@ -44,7 +44,7 @@ QUnit.test("Notifications", async assert => { ); }); -QUnit.test("Root URL - Viewing Self", async assert => { +QUnit.test("Root URL - Viewing Self", async (assert) => { await visit("/u/eviltrout"); assert.ok($("body.user-activity-page").length, "has the body class"); assert.equal( @@ -55,7 +55,7 @@ QUnit.test("Root URL - Viewing Self", async assert => { assert.ok(exists(".container.viewing-self"), "has the viewing-self class"); }); -QUnit.test("Viewing Summary", async assert => { +QUnit.test("Viewing Summary", async (assert) => { await visit("/u/eviltrout/summary"); assert.ok(exists(".replies-section li a"), "replies"); @@ -68,11 +68,11 @@ QUnit.test("Viewing Summary", async assert => { assert.ok(exists(".top-categories-section .category-link"), "top categories"); }); -QUnit.test("Viewing Drafts", async assert => { +QUnit.test("Viewing Drafts", async (assert) => { sandbox.stub(Draft, "get").returns( Promise.resolve({ draft: null, - draft_sequence: 0 + draft_sequence: 0, }) ); diff --git a/test/javascripts/acceptance/users-test.js b/test/javascripts/acceptance/users-test.js index 57e1302b637..ecb7e4dc77a 100644 --- a/test/javascripts/acceptance/users-test.js +++ b/test/javascripts/acceptance/users-test.js @@ -1,24 +1,24 @@ import { acceptance } from "helpers/qunit-helpers"; acceptance("User Directory"); -QUnit.test("Visit Page", async assert => { +QUnit.test("Visit Page", async (assert) => { await visit("/u"); assert.ok($("body.users-page").length, "has the body class"); assert.ok(exists(".directory table tr"), "has a list of users"); }); -QUnit.test("Visit All Time", async assert => { +QUnit.test("Visit All Time", async (assert) => { await visit("/u?period=all"); assert.ok(exists(".time-read"), "has time read column"); }); -QUnit.test("Visit Without Usernames", async assert => { +QUnit.test("Visit Without Usernames", async (assert) => { await visit("/u?exclude_usernames=system"); assert.ok($("body.users-page").length, "has the body class"); assert.ok(exists(".directory table tr"), "has a list of users"); }); -QUnit.test("Visit With Group Filter", async assert => { +QUnit.test("Visit With Group Filter", async (assert) => { await visit("/u?group=trust_level_0"); assert.ok($("body.users-page").length, "has the body class"); assert.ok(exists(".directory table tr"), "has a list of users"); diff --git a/test/javascripts/admin/components/group-list-setting-test.js b/test/javascripts/admin/components/group-list-setting-test.js index 6873262bb29..2472d66a432 100644 --- a/test/javascripts/admin/components/group-list-setting-test.js +++ b/test/javascripts/admin/components/group-list-setting-test.js @@ -11,12 +11,12 @@ componentTest("default", { this.site.groups = [ { id: 1, - name: "Donuts" + name: "Donuts", }, { id: 2, - name: "Cheese cake" - } + name: "Cheese cake", + }, ]; this.set( @@ -33,7 +33,7 @@ componentTest("default", { setting: "foo_bar", type: "group_list", validValues: undefined, - value: "1" + value: "1", }) ); }, @@ -55,5 +55,5 @@ componentTest("default", { "1,2", "it allows to select a setting from the list of choices" ); - } + }, }); diff --git a/test/javascripts/admin/components/themes-list-item-test.js b/test/javascripts/admin/components/themes-list-item-test.js index 5235d8f1e5d..d983624c6a0 100644 --- a/test/javascripts/admin/components/themes-list-item-test.js +++ b/test/javascripts/admin/components/themes-list-item-test.js @@ -13,7 +13,7 @@ componentTest("default theme", { test(assert) { assert.expect(1); assert.equal(find(".d-icon-check").length, 1, "shows default theme icon"); - } + }, }); componentTest("pending updates", { @@ -28,7 +28,7 @@ componentTest("pending updates", { test(assert) { assert.expect(1); assert.equal(find(".d-icon-sync").length, 1, "shows pending update icon"); - } + }, }); componentTest("broken theme", { @@ -38,7 +38,7 @@ componentTest("broken theme", { "theme", Theme.create({ name: "Test", - theme_fields: [{ name: "scss", type_id: 1, error: "something" }] + theme_fields: [{ name: "scss", type_id: 1, error: "something" }], }) ); }, @@ -50,14 +50,14 @@ componentTest("broken theme", { 1, "shows broken theme icon" ); - } + }, }); componentTest("with children", { template: "{{themes-list-item theme=theme}}", beforeEach() { - this.childrenList = [1, 2, 3, 4, 5].map(num => + this.childrenList = [1, 2, 3, 4, 5].map((num) => Theme.create({ name: `Child ${num}`, component: true }) ); @@ -66,7 +66,7 @@ componentTest("with children", { Theme.create({ name: "Test", childThemes: this.childrenList, - default: true + default: true, }) ); }, @@ -78,20 +78,18 @@ componentTest("with children", { .text() .trim() .split(",") - .map(n => n.trim()) + .map((n) => n.trim()) .join(","), this.childrenList .splice(0, 4) - .map(theme => theme.get("name")) + .map((theme) => theme.get("name")) .join(","), "lists the first 4 children" ); assert.deepEqual( - find(".others-count") - .text() - .trim(), + find(".others-count").text().trim(), I18n.t("admin.customize.theme.and_x_more", { count: 1 }), "shows count of remaining children" ); - } + }, }); diff --git a/test/javascripts/admin/components/themes-list-test.js b/test/javascripts/admin/components/themes-list-test.js index 2fc68569c6f..631e84b70b7 100644 --- a/test/javascripts/admin/components/themes-list-test.js +++ b/test/javascripts/admin/components/themes-list-test.js @@ -8,21 +8,21 @@ componentTest("current tab is themes", { template: "{{themes-list themes=themes components=components currentTab=currentTab}}", beforeEach() { - this.themes = [1, 2, 3, 4, 5].map(num => + this.themes = [1, 2, 3, 4, 5].map((num) => Theme.create({ name: `Theme ${num}` }) ); - this.components = [1, 2, 3, 4, 5].map(num => + this.components = [1, 2, 3, 4, 5].map((num) => Theme.create({ name: `Child ${num}`, component: true, parentThemes: [this.themes[num - 1]], - parent_themes: [1, 2, 3, 4, 5] + parent_themes: [1, 2, 3, 4, 5], }) ); this.setProperties({ themes: this.themes, components: this.components, - currentTab: THEMES + currentTab: THEMES, }); }, @@ -45,12 +45,12 @@ componentTest("current tab is themes", { ); assert.equal(find(".themes-list-item").length, 5, "displays all themes"); - [2, 3].forEach(num => this.themes[num].set("user_selectable", true)); + [2, 3].forEach((num) => this.themes[num].set("user_selectable", true)); this.themes[4].set("default", true); this.set("themes", this.themes); - const names = [4, 2, 3, 0, 1].map(num => this.themes[num].get("name")); // default theme always on top, followed by user-selectable ones and then the rest + const names = [4, 2, 3, 0, 1].map((num) => this.themes[num].get("name")); // default theme always on top, followed by user-selectable ones and then the rest assert.deepEqual( - Array.from(find(".themes-list-item").find(".name")).map(node => + Array.from(find(".themes-list-item").find(".name")).map((node) => node.innerText.trim() ), names, @@ -62,7 +62,7 @@ componentTest("current tab is themes", { "the separator is in the right location" ); - this.themes.forEach(theme => theme.set("user_selectable", true)); + this.themes.forEach((theme) => theme.set("user_selectable", true)); this.set("themes", this.themes); assert.equal( find(".inactive-indicator").index(), @@ -77,34 +77,32 @@ componentTest("current tab is themes", { "shows one entry with a message when there is nothing to display" ); assert.equal( - find(".themes-list-item span.empty") - .text() - .trim(), + find(".themes-list-item span.empty").text().trim(), I18n.t("admin.customize.theme.empty"), "displays the right message" ); - } + }, }); componentTest("current tab is components", { template: "{{themes-list themes=themes components=components currentTab=currentTab}}", beforeEach() { - this.themes = [1, 2, 3, 4, 5].map(num => + this.themes = [1, 2, 3, 4, 5].map((num) => Theme.create({ name: `Theme ${num}` }) ); - this.components = [1, 2, 3, 4, 5].map(num => + this.components = [1, 2, 3, 4, 5].map((num) => Theme.create({ name: `Child ${num}`, component: true, parentThemes: [this.themes[num - 1]], - parent_themes: [1, 2, 3, 4, 5] + parent_themes: [1, 2, 3, 4, 5], }) ); this.setProperties({ themes: this.themes, components: this.components, - currentTab: COMPONENTS + currentTab: COMPONENTS, }); }, @@ -138,11 +136,9 @@ componentTest("current tab is components", { "shows one entry with a message when there is nothing to display" ); assert.equal( - find(".themes-list-item span.empty") - .text() - .trim(), + find(".themes-list-item span.empty").text().trim(), I18n.t("admin.customize.theme.empty"), "displays the right message" ); - } + }, }); diff --git a/test/javascripts/admin/controllers/admin-customize-themes-show-test.js b/test/javascripts/admin/controllers/admin-customize-themes-show-test.js index 63a9453e36d..b0e06a97340 100644 --- a/test/javascripts/admin/controllers/admin-customize-themes-show-test.js +++ b/test/javascripts/admin/controllers/admin-customize-themes-show-test.js @@ -5,21 +5,21 @@ moduleFor("controller:admin-customize-themes-show", { beforeEach() { this.registry.register("router:main", mapRoutes()); }, - needs: ["controller:adminUser"] + needs: ["controller:adminUser"], }); -QUnit.test("can display source url for remote themes", function(assert) { +QUnit.test("can display source url for remote themes", function (assert) { const repoUrl = "https://github.com/discourse/discourse-brand-header.git"; const remoteTheme = Theme.create({ id: 2, default: true, name: "default", remote_theme: { - remote_url: repoUrl - } + remote_url: repoUrl, + }, }); const controller = this.subject({ - model: remoteTheme + model: remoteTheme, }); assert.deepEqual( @@ -29,7 +29,7 @@ QUnit.test("can display source url for remote themes", function(assert) { ); }); -QUnit.test("can display source url for remote theme branches", function( +QUnit.test("can display source url for remote theme branches", function ( assert ) { const remoteTheme = Theme.create({ @@ -38,11 +38,11 @@ QUnit.test("can display source url for remote theme branches", function( name: "default", remote_theme: { remote_url: "https://github.com/discourse/discourse-brand-header.git", - branch: "beta" - } + branch: "beta", + }, }); const controller = this.subject({ - model: remoteTheme + model: remoteTheme, }); assert.deepEqual( diff --git a/test/javascripts/admin/controllers/admin-customize-themes-test.js b/test/javascripts/admin/controllers/admin-customize-themes-test.js index a07f0432036..bd21cafb497 100644 --- a/test/javascripts/admin/controllers/admin-customize-themes-test.js +++ b/test/javascripts/admin/controllers/admin-customize-themes-test.js @@ -5,37 +5,39 @@ moduleFor("controller:admin-customize-themes", { beforeEach() { this.registry.register("router:main", mapRoutes()); }, - needs: ["controller:adminUser"] + needs: ["controller:adminUser"], }); -QUnit.test("can list themes correctly", function(assert) { +QUnit.test("can list themes correctly", function (assert) { const defaultTheme = Theme.create({ id: 2, default: true, name: "default" }); const userTheme = Theme.create({ id: 3, user_selectable: true, - name: "name" + name: "name", }); const strayTheme1 = Theme.create({ id: 4, name: "stray1" }); const strayTheme2 = Theme.create({ id: 5, name: "stray2" }); const componentTheme = Theme.create({ id: 6, name: "component", - component: true + component: true, }); const controller = this.subject({ - model: [strayTheme2, strayTheme1, userTheme, defaultTheme, componentTheme] + model: [strayTheme2, strayTheme1, userTheme, defaultTheme, componentTheme], }); assert.deepEqual( - controller.get("fullThemes").map(t => t.get("name")), - [strayTheme2, strayTheme1, userTheme, defaultTheme].map(t => t.get("name")), + controller.get("fullThemes").map((t) => t.get("name")), + [strayTheme2, strayTheme1, userTheme, defaultTheme].map((t) => + t.get("name") + ), "returns a list of themes without components" ); assert.deepEqual( - controller.get("childThemes").map(t => t.get("name")), - [componentTheme].map(t => t.get("name")), + controller.get("childThemes").map((t) => t.get("name")), + [componentTheme].map((t) => t.get("name")), "separate components from themes" ); }); diff --git a/test/javascripts/admin/controllers/admin-user-badges-test.js b/test/javascripts/admin/controllers/admin-user-badges-test.js index 79a7ca7fcdf..175d1f29af1 100644 --- a/test/javascripts/admin/controllers/admin-user-badges-test.js +++ b/test/javascripts/admin/controllers/admin-user-badges-test.js @@ -5,48 +5,48 @@ moduleFor("controller:admin-user-badges", { beforeEach() { this.registry.register("router:main", mapRoutes()); }, - needs: ["controller:adminUser"] + needs: ["controller:adminUser"], }); -QUnit.test("grantableBadges", function(assert) { +QUnit.test("grantableBadges", function (assert) { const badgeFirst = Badge.create({ id: 3, name: "A Badge", enabled: true, - manually_grantable: true + manually_grantable: true, }); const badgeMiddle = Badge.create({ id: 1, name: "My Badge", enabled: true, - manually_grantable: true + manually_grantable: true, }); const badgeLast = Badge.create({ id: 2, name: "Zoo Badge", enabled: true, - manually_grantable: true + manually_grantable: true, }); const badgeDisabled = Badge.create({ id: 4, name: "Disabled Badge", enabled: false, - manually_grantable: true + manually_grantable: true, }); const badgeAutomatic = Badge.create({ id: 5, name: "Automatic Badge", enabled: true, - manually_grantable: false + manually_grantable: false, }); const controller = this.subject({ model: [], - badges: [badgeLast, badgeFirst, badgeMiddle, badgeDisabled, badgeAutomatic] + badges: [badgeLast, badgeFirst, badgeMiddle, badgeDisabled, badgeAutomatic], }); const sortedNames = [badgeFirst.name, badgeMiddle.name, badgeLast.name]; - const badgeNames = controller.get("grantableBadges").map(function(badge) { + const badgeNames = controller.get("grantableBadges").map(function (badge) { return badge.name; }); diff --git a/test/javascripts/admin/models/theme-test.js b/test/javascripts/admin/models/theme-test.js index c2e49ce3c30..d05cc244391 100644 --- a/test/javascripts/admin/models/theme-test.js +++ b/test/javascripts/admin/models/theme-test.js @@ -2,7 +2,7 @@ import Theme from "admin/models/theme"; QUnit.module("model:theme"); -QUnit.test("can add an upload correctly", function(assert) { +QUnit.test("can add an upload correctly", function (assert) { let theme = Theme.create(); assert.equal( diff --git a/test/javascripts/components/ace-editor-test.js b/test/javascripts/components/ace-editor-test.js index d798db50551..b5ed8303fb4 100644 --- a/test/javascripts/components/ace-editor-test.js +++ b/test/javascripts/components/ace-editor-test.js @@ -8,7 +8,7 @@ componentTest("css editor", { test(assert) { assert.expect(1); assert.ok(find(".ace_editor").length, "it renders the ace editor"); - } + }, }); componentTest("html editor", { @@ -17,7 +17,7 @@ componentTest("html editor", { test(assert) { assert.expect(1); assert.ok(find(".ace_editor").length, "it renders the ace editor"); - } + }, }); componentTest("sql editor", { @@ -26,7 +26,7 @@ componentTest("sql editor", { test(assert) { assert.expect(1); assert.ok(find(".ace_editor").length, "it renders the ace editor"); - } + }, }); componentTest("disabled editor", { @@ -38,10 +38,7 @@ componentTest("disabled editor", { assert.expect(3); assert.ok($ace.length, "it renders the ace editor"); assert.equal( - $ace - .parent() - .data() - .editor.getReadOnly(), + $ace.parent().data().editor.getReadOnly(), true, "it sets ACE to read-only mode" ); @@ -50,5 +47,5 @@ componentTest("disabled editor", { "true", "ACE wrapper has `data-disabled` attribute set to true" ); - } + }, }); diff --git a/test/javascripts/components/admin-report-test.js b/test/javascripts/components/admin-report-test.js index dfbab4c64fc..56ac97de5a2 100644 --- a/test/javascripts/components/admin-report-test.js +++ b/test/javascripts/components/admin-report-test.js @@ -2,7 +2,7 @@ import componentTest from "helpers/component-test"; import pretender from "helpers/create-pretender"; moduleForComponent("admin-report", { - integration: true + integration: true, }); componentTest("default", { @@ -14,9 +14,7 @@ componentTest("default", { assert.ok(exists(".admin-report.signups", "it defaults to table mode")); assert.equal( - find(".header .item.report") - .text() - .trim(), + find(".header .item.report").text().trim(), "Signups", "it has a title" ); @@ -28,17 +26,13 @@ componentTest("default", { ); assert.equal( - find(".admin-report-table thead tr th:first-child .title") - .text() - .trim(), + find(".admin-report-table thead tr th:first-child .title").text().trim(), "Day", "it has col headers" ); assert.equal( - find(".admin-report-table thead tr th:nth-child(2) .title") - .text() - .trim(), + find(".admin-report-table thead tr th:nth-child(2) .title").text().trim(), "Count", "it has col headers" ); @@ -70,7 +64,7 @@ componentTest("default", { "7", "it can sort rows" ); - } + }, }); componentTest("options", { @@ -80,8 +74,8 @@ componentTest("options", { this.set("options", { table: { perPage: 4, - total: false - } + total: false, + }, }); }, @@ -94,7 +88,7 @@ componentTest("options", { ); assert.notOk(exists(".totals-sample-table"), "it hides totals"); - } + }, }); componentTest("switch modes", { @@ -105,7 +99,7 @@ componentTest("switch modes", { assert.notOk(exists(".admin-report-table"), "it removes the table"); assert.ok(exists(".admin-report-chart"), "it shows the chart"); - } + }, }); componentTest("timeout", { @@ -113,7 +107,7 @@ componentTest("timeout", { test(assert) { assert.ok(exists(".alert-error.timeout"), "it displays a timeout error"); - } + }, }); componentTest("no data", { @@ -121,7 +115,7 @@ componentTest("no data", { test(assert) { assert.ok(exists(".no-data"), "it displays a no data alert"); - } + }, }); componentTest("exception", { @@ -129,7 +123,7 @@ componentTest("exception", { test(assert) { assert.ok(exists(".alert-error.exception"), "it displays an error"); - } + }, }); componentTest("rate limited", { @@ -140,11 +134,11 @@ componentTest("rate limited", { { "Content-Type": "application/json" }, { errors: [ - "You’ve performed this action too many times. Please wait 10 seconds before trying again." + "You’ve performed this action too many times. Please wait 10 seconds before trying again.", ], error_type: "rate_limit", - extras: { wait_seconds: 10 } - } + extras: { wait_seconds: 10 }, + }, ]; }); }, @@ -156,7 +150,7 @@ componentTest("rate limited", { exists(".alert-error.rate-limited"), "it displays a rate limited error" ); - } + }, }); componentTest("not found", { @@ -167,5 +161,5 @@ componentTest("not found", { exists(".alert-error.not-found"), "it displays a not found error" ); - } + }, }); diff --git a/test/javascripts/components/badge-title-test.js b/test/javascripts/components/badge-title-test.js index d58bff7aefd..33a2f1eac97 100644 --- a/test/javascripts/components/badge-title-test.js +++ b/test/javascripts/components/badge-title-test.js @@ -14,13 +14,13 @@ componentTest("badge title", { this.set("selectableUserBadges", [ EmberObject.create({ id: 0, - badge: { name: "(none)" } + badge: { name: "(none)" }, }), EmberObject.create({ id: 42, badge_id: 102, - badge: { name: "Test" } - }) + badge: { name: "Test" }, + }), ]); }, @@ -28,11 +28,11 @@ componentTest("badge title", { pretender.put("/u/eviltrout/preferences/badge_title", () => [ 200, { "Content-Type": "application/json" }, - {} + {}, ]); await this.subject.expand(); await this.subject.selectRowByValue(42); await click(".btn"); assert.equal(this.currentUser.title, "Test"); - } + }, }); diff --git a/test/javascripts/components/cook-text-test.js b/test/javascripts/components/cook-text-test.js index 517a2736110..051e6efdb79 100644 --- a/test/javascripts/components/cook-text-test.js +++ b/test/javascripts/components/cook-text-test.js @@ -10,7 +10,7 @@ componentTest("renders markdown", { test(assert) { const html = find(".post-body")[0].innerHTML.trim(); assert.equal(html, "

foo

"); - } + }, }); componentTest("resolves short URLs", { @@ -25,9 +25,9 @@ componentTest("resolves short URLs", { { short_url: "upload://a.png", url: "/images/avatar.png", - short_path: "/images/d-logo-sketch.png" - } - ] + short_path: "/images/d-logo-sketch.png", + }, + ], ]; }); }, @@ -39,5 +39,5 @@ componentTest("resolves short URLs", { test(assert) { const html = find(".post-body")[0].innerHTML.trim(); assert.equal(html, '

an image

'); - } + }, }); diff --git a/test/javascripts/components/d-button-test.js b/test/javascripts/components/d-button-test.js index 7d28c4d5e7a..ce41d194289 100644 --- a/test/javascripts/components/d-button-test.js +++ b/test/javascripts/components/d-button-test.js @@ -12,7 +12,7 @@ componentTest("icon only button", { ); assert.ok(find("button .d-icon.d-icon-plus").length, "it has the icon"); assert.equal(find("button").attr("tabindex"), "3", "it has the tabindex"); - } + }, }); componentTest("icon and text button", { @@ -25,7 +25,7 @@ componentTest("icon and text button", { ); assert.ok(find("button .d-icon.d-icon-plus").length, "it has the icon"); assert.ok(find("button span.d-button-label").length, "it has the label"); - } + }, }); componentTest("text only button", { @@ -34,7 +34,7 @@ componentTest("text only button", { test(assert) { assert.ok(find("button.btn.btn-text").length, "it has all the classes"); assert.ok(find("button span.d-button-label").length, "it has the label"); - } + }, }); componentTest("form attribute", { @@ -42,7 +42,7 @@ componentTest("form attribute", { test(assert) { assert.ok(exists("button[form=login-form]"), "it has the form attribute"); - } + }, }); componentTest("link-styled button", { @@ -53,7 +53,7 @@ componentTest("link-styled button", { find("button.btn-link:not(.btn)").length, "it has the right classes" ); - } + }, }); componentTest("isLoading button", { @@ -83,7 +83,7 @@ componentTest("isLoading button", { find("button:not([disabled])").length, "while not loading the button is enabled" ); - } + }, }); componentTest("disabled button", { @@ -99,7 +99,7 @@ componentTest("disabled button", { this.set("disabled", false); assert.ok(find("button:not([disabled])").length, "the button is enabled"); - } + }, }); componentTest("aria-label", { @@ -120,11 +120,11 @@ componentTest("aria-label", { this.setProperties({ ariaLabel: null, - translatedAriaLabel: "bar" + translatedAriaLabel: "bar", }); assert.equal(find("button")[0].getAttribute("aria-label"), "bar"); - } + }, }); componentTest("title", { @@ -143,11 +143,11 @@ componentTest("title", { this.setProperties({ title: null, - translatedTitle: "bar" + translatedTitle: "bar", }); assert.equal(find("button")[0].getAttribute("title"), "bar"); - } + }, }); componentTest("label", { @@ -167,9 +167,9 @@ componentTest("label", { this.setProperties({ label: null, - translatedLabel: "bar" + translatedLabel: "bar", }); assert.equal(find("button .d-button-label").text(), "bar"); - } + }, }); diff --git a/test/javascripts/components/d-editor-test.js b/test/javascripts/components/d-editor-test.js index afe281bd597..fec3ae228a3 100644 --- a/test/javascripts/components/d-editor-test.js +++ b/test/javascripts/components/d-editor-test.js @@ -6,7 +6,7 @@ import { withPluginApi } from "discourse/lib/plugin-api"; import formatTextWithSelection from "helpers/d-editor-helper"; import { setTextareaSelection, - getTextareaSelection + getTextareaSelection, } from "helpers/textarea-selection-helper"; moduleForComponent("d-editor", { integration: true }); @@ -20,12 +20,10 @@ componentTest("preview updates with markdown", { assert.equal(this.value, "hello **world**"); assert.equal( - find(".d-editor-preview") - .html() - .trim(), + find(".d-editor-preview").html().trim(), "

hello world

" ); - } + }, }); componentTest("preview sanitizes HTML", { @@ -33,13 +31,8 @@ componentTest("preview sanitizes HTML", { async test(assert) { await fillIn(".d-editor-input", `">`); - assert.equal( - find(".d-editor-preview") - .html() - .trim(), - '

">

' - ); - } + assert.equal(find(".d-editor-preview").html().trim(), '

">

'); + }, }); componentTest("updating the value refreshes the preview", { @@ -50,21 +43,11 @@ componentTest("updating the value refreshes the preview", { }, async test(assert) { - assert.equal( - find(".d-editor-preview") - .html() - .trim(), - "

evil trout

" - ); + assert.equal(find(".d-editor-preview").html().trim(), "

evil trout

"); await this.set("value", "zogstrip"); - assert.equal( - find(".d-editor-preview") - .html() - .trim(), - "

zogstrip

" - ); - } + assert.equal(find(".d-editor-preview").html().trim(), "

zogstrip

"); + }, }); function jumpEnd(textarea) { @@ -82,7 +65,7 @@ function testCase(title, testFunc) { test(assert) { const textarea = jumpEnd(find("textarea.d-editor-input")[0]); testFunc.call(this, assert, textarea); - } + }, }); } @@ -95,11 +78,14 @@ function composerTestCase(title, testFunc) { test(assert) { const textarea = jumpEnd(find("textarea.d-editor-input")[0]); testFunc.call(this, assert, textarea); - } + }, }); } -testCase(`selecting the space before a word`, async function(assert, textarea) { +testCase(`selecting the space before a word`, async function ( + assert, + textarea +) { textarea.selectionStart = 5; textarea.selectionEnd = 7; @@ -110,7 +96,7 @@ testCase(`selecting the space before a word`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 9); }); -testCase(`selecting the space after a word`, async function(assert, textarea) { +testCase(`selecting the space after a word`, async function (assert, textarea) { textarea.selectionStart = 0; textarea.selectionEnd = 6; @@ -121,7 +107,7 @@ testCase(`selecting the space after a word`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 7); }); -testCase(`bold button with no selection`, async function(assert, textarea) { +testCase(`bold button with no selection`, async function (assert, textarea) { await click(`button.bold`); const example = I18n.t(`composer.bold_text`); @@ -130,7 +116,7 @@ testCase(`bold button with no selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 14 + example.length); }); -testCase(`bold button with a selection`, async function(assert, textarea) { +testCase(`bold button with a selection`, async function (assert, textarea) { textarea.selectionStart = 6; textarea.selectionEnd = 11; @@ -145,7 +131,7 @@ testCase(`bold button with a selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 11); }); -testCase(`bold with a multiline selection`, async function(assert, textarea) { +testCase(`bold with a multiline selection`, async function (assert, textarea) { this.set("value", "hello\n\nworld\n\ntest."); textarea.selectionStart = 0; @@ -162,7 +148,7 @@ testCase(`bold with a multiline selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 12); }); -testCase(`italic button with no selection`, async function(assert, textarea) { +testCase(`italic button with no selection`, async function (assert, textarea) { await click(`button.italic`); const example = I18n.t(`composer.italic_text`); assert.equal(this.value, `hello world.*${example}*`); @@ -171,7 +157,7 @@ testCase(`italic button with no selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 13 + example.length); }); -testCase(`italic button with a selection`, async function(assert, textarea) { +testCase(`italic button with a selection`, async function (assert, textarea) { textarea.selectionStart = 6; textarea.selectionEnd = 11; @@ -186,7 +172,10 @@ testCase(`italic button with a selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 11); }); -testCase(`italic with a multiline selection`, async function(assert, textarea) { +testCase(`italic with a multiline selection`, async function ( + assert, + textarea +) { this.set("value", "hello\n\nworld\n\ntest."); textarea.selectionStart = 0; @@ -235,7 +224,7 @@ function xyz(x, y, z) { } ` ); - } + }, }); componentTest("code button", { @@ -317,7 +306,7 @@ third line` assert.equal(this.value, "first line\n\nsecond line\n\nthird line"); assert.equal(textarea.selectionStart, 0); assert.equal(textarea.selectionEnd, 23); - } + }, }); componentTest("code fences", { @@ -430,7 +419,7 @@ third line` assert.equal(textarea.selectionStart, 27); assert.equal(textarea.selectionEnd, 27); - } + }, }); componentTest("quote button - empty lines", { @@ -451,7 +440,7 @@ componentTest("quote button - empty lines", { await click("button.quote"); assert.equal(this.value, "one\n\ntwo\n\nthree"); - } + }, }); componentTest("quote button - selecting empty lines", { @@ -467,10 +456,10 @@ componentTest("quote button - selecting empty lines", { await click("button.quote"); assert.equal(this.value, "one\n\n\n> \n> two"); - } + }, }); -testCase("quote button", async function(assert, textarea) { +testCase("quote button", async function (assert, textarea) { textarea.selectionStart = 6; textarea.selectionEnd = 9; @@ -492,7 +481,7 @@ testCase("quote button", async function(assert, textarea) { assert.equal(this.value, "hello\n\nwor\n\nld.\n\n> Blockquote"); }); -testCase(`bullet button with no selection`, async function(assert, textarea) { +testCase(`bullet button with no selection`, async function (assert, textarea) { const example = I18n.t("composer.list_item"); await click(`button.bullet`); @@ -504,7 +493,7 @@ testCase(`bullet button with no selection`, async function(assert, textarea) { assert.equal(this.value, `hello world.\n\n${example}`); }); -testCase(`bullet button with a selection`, async function(assert, textarea) { +testCase(`bullet button with a selection`, async function (assert, textarea) { textarea.selectionStart = 6; textarea.selectionEnd = 11; @@ -519,7 +508,7 @@ testCase(`bullet button with a selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 12); }); -testCase(`bullet button with a multiple line selection`, async function( +testCase(`bullet button with a multiple line selection`, async function ( assert, textarea ) { @@ -539,7 +528,7 @@ testCase(`bullet button with a multiple line selection`, async function( assert.equal(textarea.selectionEnd, 24); }); -testCase(`list button with no selection`, async function(assert, textarea) { +testCase(`list button with no selection`, async function (assert, textarea) { const example = I18n.t("composer.list_item"); await click(`button.list`); @@ -553,7 +542,7 @@ testCase(`list button with no selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 14 + example.length); }); -testCase(`list button with a selection`, async function(assert, textarea) { +testCase(`list button with a selection`, async function (assert, textarea) { textarea.selectionStart = 6; textarea.selectionEnd = 11; @@ -568,7 +557,7 @@ testCase(`list button with a selection`, async function(assert, textarea) { assert.equal(textarea.selectionEnd, 12); }); -testCase(`list button with line sequence`, async function(assert, textarea) { +testCase(`list button with line sequence`, async function (assert, textarea) { this.set("value", "Hello\n\nWorld\n\nEvil"); textarea.selectionStart = 0; @@ -596,7 +585,7 @@ componentTest("clicking the toggle-direction changes dir from ltr to rtl", { const textarea = find("textarea.d-editor-input"); await click("button.toggle-direction"); assert.equal(textarea.attr("dir"), "rtl"); - } + }, }); componentTest("clicking the toggle-direction changes dir from ltr to rtl", { @@ -611,10 +600,10 @@ componentTest("clicking the toggle-direction changes dir from ltr to rtl", { textarea.attr("dir", "ltr"); await click("button.toggle-direction"); assert.equal(textarea.attr("dir"), "rtl"); - } + }, }); -testCase(`doesn't jump to bottom with long text`, async function( +testCase(`doesn't jump to bottom with long text`, async function ( assert, textarea ) { @@ -636,13 +625,13 @@ componentTest("emoji", { template: "{{d-editor value=value}}", beforeEach() { // Test adding a custom button - withPluginApi("0.1", api => { - api.onToolbarCreate(toolbar => { + withPluginApi("0.1", (api) => { + api.onToolbarCreate((toolbar) => { toolbar.addButton({ id: "emoji", group: "extras", icon: "far-smile", - action: () => toolbar.context.send("emoji") + action: () => toolbar.context.send("emoji"), }); }); }); @@ -661,10 +650,10 @@ componentTest("emoji", { '.emoji-picker .section[data-section="smileys_&_emotion"] img.emoji[title="grinning"]' ); assert.equal(this.value, "hello world. :grinning:"); - } + }, }); -testCase("replace-text event by default", async function(assert) { +testCase("replace-text event by default", async function (assert) { this.set("value", "red green blue"); await this.container @@ -674,7 +663,7 @@ testCase("replace-text event by default", async function(assert) { assert.equal(this.value, "red green blue"); }); -composerTestCase("replace-text event for composer", async function(assert) { +composerTestCase("replace-text event for composer", async function (assert) { this.set("value", "red green blue"); await this.container @@ -695,56 +684,56 @@ composerTestCase("replace-text event for composer", async function(assert) { { description: "cursor at start remains there", before: [0, 0], - after: [0, 0] + after: [0, 0], }, { description: "cursor before needle becomes cursor before replacement", before: [BEFORE.indexOf(NEEDLE), 0], - after: [AFTER.indexOf(REPLACE), 0] + after: [AFTER.indexOf(REPLACE), 0], }, { description: "cursor at needle start + 1 moves behind replacement", before: [BEFORE.indexOf(NEEDLE) + 1, 0], - after: [AFTER.indexOf(REPLACE) + REPLACE.length, 0] + after: [AFTER.indexOf(REPLACE) + REPLACE.length, 0], }, { description: "cursor at needle end - 1 stays behind replacement", before: [BEFORE.indexOf(NEEDLE) + NEEDLE.length - 1, 0], - after: [AFTER.indexOf(REPLACE) + REPLACE.length, 0] + after: [AFTER.indexOf(REPLACE) + REPLACE.length, 0], }, { description: "cursor behind needle becomes cursor behind replacement", before: [BEFORE.indexOf(NEEDLE) + NEEDLE.length, 0], - after: [AFTER.indexOf(REPLACE) + REPLACE.length, 0] + after: [AFTER.indexOf(REPLACE) + REPLACE.length, 0], }, { description: "cursor at end remains there", before: [BEFORE.length, 0], - after: [AFTER.length, 0] + after: [AFTER.length, 0], }, { description: "selection spanning needle start becomes selection until replacement start", before: [BEFORE.indexOf(NEEDLE) - 1, 2], - after: [AFTER.indexOf(REPLACE) - 1, 1] + after: [AFTER.indexOf(REPLACE) - 1, 1], }, { description: "selection spanning needle end becomes selection from replacement end", before: [BEFORE.indexOf(NEEDLE) + NEEDLE.length - 1, 2], - after: [AFTER.indexOf(REPLACE) + REPLACE.length, 1] + after: [AFTER.indexOf(REPLACE) + REPLACE.length, 1], }, { description: "selection spanning needle becomes selection spanning replacement", before: [BEFORE.indexOf(NEEDLE) - 1, NEEDLE.length + 2], - after: [AFTER.indexOf(REPLACE) - 1, REPLACE.length + 2] + after: [AFTER.indexOf(REPLACE) - 1, REPLACE.length + 2], }, { description: "complete selection remains complete", before: [0, BEFORE.length], - after: [0, AFTER.length] - } + after: [0, AFTER.length], + }, ]; for (let i = 0; i < CASES.length; i++) { diff --git a/test/javascripts/components/d-icon-test.js b/test/javascripts/components/d-icon-test.js index b0c5a633ae3..7ee20a999ad 100644 --- a/test/javascripts/components/d-icon-test.js +++ b/test/javascripts/components/d-icon-test.js @@ -6,26 +6,22 @@ componentTest("default", { template: '
{{d-icon "bars"}}
', test(assert) { - const html = find(".test") - .html() - .trim(); + const html = find(".test").html().trim(); assert.equal( html, '' ); - } + }, }); componentTest("with replacement", { template: '
{{d-icon "d-watching"}}
', test(assert) { - const html = find(".test") - .html() - .trim(); + const html = find(".test").html().trim(); assert.equal( html, '' ); - } + }, }); diff --git a/test/javascripts/components/date-input-test.js b/test/javascripts/components/date-input-test.js index 29f01b4f50e..769f9354292 100644 --- a/test/javascripts/components/date-input-test.js +++ b/test/javascripts/components/date-input-test.js @@ -29,7 +29,7 @@ componentTest("default", { test(assert) { assert.equal(dateInput().val(), "January 29, 2019"); - } + }, }); componentTest("prevents mutations", { @@ -45,7 +45,7 @@ componentTest("prevents mutations", { await pika(2019, 0, 2); assert.ok(this.date.isSame(DEFAULT_DATE)); - } + }, }); componentTest("allows mutations through actions", { @@ -61,5 +61,5 @@ componentTest("allows mutations through actions", { await pika(2019, 0, 2); assert.ok(this.date.isSame(moment("2019-01-02"))); - } + }, }); diff --git a/test/javascripts/components/date-time-input-range-test.js b/test/javascripts/components/date-time-input-range-test.js index 9ffa7e6ef66..7e0f76f461e 100644 --- a/test/javascripts/components/date-time-input-range-test.js +++ b/test/javascripts/components/date-time-input-range-test.js @@ -32,5 +32,5 @@ componentTest("default", { assert.equal(fromTimeInput().dataset.name, "14:45"); assert.equal(toDateInput().value, ""); assert.equal(toTimeInput().dataset.name, "--:--"); - } + }, }); diff --git a/test/javascripts/components/date-time-input-test.js b/test/javascripts/components/date-time-input-test.js index e56e3e09130..c859fe26e3c 100644 --- a/test/javascripts/components/date-time-input-test.js +++ b/test/javascripts/components/date-time-input-test.js @@ -32,7 +32,7 @@ componentTest("default", { test(assert) { assert.equal(dateInput().value, "January 29, 2019"); assert.equal(timeInput().dataset.name, "14:45"); - } + }, }); componentTest("prevents mutations", { @@ -47,7 +47,7 @@ componentTest("prevents mutations", { await pika(2019, 0, 2); assert.ok(this.date.isSame(DEFAULT_DATE_TIME)); - } + }, }); componentTest("allows mutations through actions", { @@ -63,7 +63,7 @@ componentTest("allows mutations through actions", { await pika(2019, 0, 2); assert.ok(this.date.isSame(moment("2019-01-02 14:45"))); - } + }, }); componentTest("can hide time", { @@ -75,5 +75,5 @@ componentTest("can hide time", { async test(assert) { assert.notOk(exists(timeInput())); - } + }, }); diff --git a/test/javascripts/components/group-membership-button-test.js b/test/javascripts/components/group-membership-button-test.js index 23049904f95..2d17c0ed6de 100644 --- a/test/javascripts/components/group-membership-button-test.js +++ b/test/javascripts/components/group-membership-button-test.js @@ -1,8 +1,8 @@ moduleFor("component:group-membership-button"); -QUnit.test("canJoinGroup", function(assert) { +QUnit.test("canJoinGroup", function (assert) { this.subject().setProperties({ - model: { public_admission: false, is_group_user: true } + model: { public_admission: false, is_group_user: true }, }); assert.equal( @@ -28,9 +28,9 @@ QUnit.test("canJoinGroup", function(assert) { ); }); -QUnit.test("canLeaveGroup", function(assert) { +QUnit.test("canLeaveGroup", function (assert) { this.subject().setProperties({ - model: { public_exit: false, is_group_user: false } + model: { public_exit: false, is_group_user: false }, }); assert.equal( @@ -56,9 +56,9 @@ QUnit.test("canLeaveGroup", function(assert) { ); }); -QUnit.test("canRequestMembership", function(assert) { +QUnit.test("canRequestMembership", function (assert) { this.subject().setProperties({ - model: { allow_membership_requests: true, is_group_user: true } + model: { allow_membership_requests: true, is_group_user: true }, }); assert.equal( @@ -76,9 +76,9 @@ QUnit.test("canRequestMembership", function(assert) { ); }); -QUnit.test("userIsGroupUser", function(assert) { +QUnit.test("userIsGroupUser", function (assert) { this.subject().setProperties({ - model: { is_group_user: true } + model: { is_group_user: true }, }); assert.equal(this.subject().get("userIsGroupUser"), true); diff --git a/test/javascripts/components/highlighted-code-test.js b/test/javascripts/components/highlighted-code-test.js index 4a7f6226ab2..5159a22af7c 100644 --- a/test/javascripts/components/highlighted-code-test.js +++ b/test/javascripts/components/highlighted-code-test.js @@ -15,12 +15,10 @@ componentTest("highlighting code", { test(assert) { assert.equal( - find("code.ruby.hljs .hljs-function .hljs-keyword") - .text() - .trim(), + find("code.ruby.hljs .hljs-function .hljs-keyword").text().trim(), "def" ); - } + }, }); componentTest("large code blocks are not highlighted", { @@ -33,11 +31,6 @@ componentTest("large code blocks are not highlighted", { }, test(assert) { - assert.equal( - find("code") - .text() - .trim(), - LONG_CODE_BLOCK.trim() - ); - } + assert.equal(find("code").text().trim(), LONG_CODE_BLOCK.trim()); + }, }); diff --git a/test/javascripts/components/html-safe-helper-test.js b/test/javascripts/components/html-safe-helper-test.js index 364f99a6e4e..08fbb28e3c4 100644 --- a/test/javascripts/components/html-safe-helper-test.js +++ b/test/javascripts/components/html-safe-helper-test.js @@ -10,5 +10,5 @@ componentTest("default", { async test(assert) { assert.ok(exists("p.cookies"), "it displays the string as html"); - } + }, }); diff --git a/test/javascripts/components/iframed-html-test.js b/test/javascripts/components/iframed-html-test.js index ad7d4113f49..d95e045429b 100644 --- a/test/javascripts/components/iframed-html-test.js +++ b/test/javascripts/components/iframed-html-test.js @@ -19,5 +19,5 @@ componentTest("appends the html into the iframe", { 1, "inserts the passed in html into the iframe" ); - } + }, }); diff --git a/test/javascripts/components/image-uploader-test.js b/test/javascripts/components/image-uploader-test.js index 7da9744ae32..ffe1d28285e 100644 --- a/test/javascripts/components/image-uploader-test.js +++ b/test/javascripts/components/image-uploader-test.js @@ -31,7 +31,7 @@ componentTest("with image", { 1, "it displays the image lightbox" ); - } + }, }); componentTest("without image", { @@ -55,7 +55,7 @@ componentTest("without image", { 0, "it does not display the button to open image lightbox" ); - } + }, }); componentTest("with placeholder", { @@ -85,5 +85,5 @@ componentTest("with placeholder", { 1, "it displays the placeholder image" ); - } + }, }); diff --git a/test/javascripts/components/keyboard-shortcuts-test.js b/test/javascripts/components/keyboard-shortcuts-test.js index 7e9c6f2783b..19ccbe946f4 100644 --- a/test/javascripts/components/keyboard-shortcuts-test.js +++ b/test/javascripts/components/keyboard-shortcuts-test.js @@ -8,8 +8,8 @@ QUnit.module("lib:keyboard-shortcuts", { var _bindings = {}; testMouseTrap = { - bind: function(bindings, callback) { - var registerBinding = function(binding) { + bind: function (bindings, callback) { + var registerBinding = function (binding) { _bindings[binding] = callback; }.bind(this); @@ -20,9 +20,9 @@ QUnit.module("lib:keyboard-shortcuts", { } }, - trigger: function(binding) { + trigger: function (binding) { _bindings[binding].call(); - } + }, }; sandbox.stub(DiscourseURL, "routeTo"); @@ -57,7 +57,7 @@ QUnit.module("lib:keyboard-shortcuts", { "
", "
", "
", - "
" + "
", ].join("\n") ); }, @@ -65,15 +65,15 @@ QUnit.module("lib:keyboard-shortcuts", { afterEach() { $("#qunit-scratch").html(""); testMouseTrap = undefined; - } + }, }); var pathBindings = KeyboardShortcuts.PATH_BINDINGS || {}; -Object.keys(pathBindings).forEach(path => { +Object.keys(pathBindings).forEach((path) => { const binding = pathBindings[path]; var testName = binding + " goes to " + path; - test(testName, function(assert) { + test(testName, function (assert) { KeyboardShortcuts.bindEvents(); testMouseTrap.trigger(binding); @@ -82,31 +82,31 @@ Object.keys(pathBindings).forEach(path => { }); var clickBindings = KeyboardShortcuts.CLICK_BINDINGS || {}; -Object.keys(clickBindings).forEach(selector => { +Object.keys(clickBindings).forEach((selector) => { const binding = clickBindings[selector]; var bindings = binding.split(","); var testName = binding + " clicks on " + selector; - test(testName, function(assert) { + test(testName, function (assert) { KeyboardShortcuts.bindEvents(); - $(selector).on("click", function() { + $(selector).on("click", function () { assert.ok(true, selector + " was clicked"); }); - bindings.forEach(function(b) { + bindings.forEach(function (b) { testMouseTrap.trigger(b); }, this); }); }); var functionBindings = KeyboardShortcuts.FUNCTION_BINDINGS || {}; -Object.keys(functionBindings).forEach(func => { +Object.keys(functionBindings).forEach((func) => { const binding = functionBindings[func]; var testName = binding + " calls " + func; - test(testName, function(assert) { - sandbox.stub(KeyboardShortcuts, func, function() { + test(testName, function (assert) { + sandbox.stub(KeyboardShortcuts, func, function () { assert.ok(true, func + " is called when " + binding + " is triggered"); }); KeyboardShortcuts.bindEvents(); @@ -115,23 +115,23 @@ Object.keys(functionBindings).forEach(func => { }); }); -QUnit.test("selectDown calls _moveSelection with 1", assert => { +QUnit.test("selectDown calls _moveSelection with 1", (assert) => { var stub = sandbox.stub(KeyboardShortcuts, "_moveSelection"); KeyboardShortcuts.selectDown(); assert.ok(stub.calledWith(1), "_moveSelection is called with 1"); }); -QUnit.test("selectUp calls _moveSelection with -1", assert => { +QUnit.test("selectUp calls _moveSelection with -1", (assert) => { var stub = sandbox.stub(KeyboardShortcuts, "_moveSelection"); KeyboardShortcuts.selectUp(); assert.ok(stub.calledWith(-1), "_moveSelection is called with -1"); }); -QUnit.test("goBack calls history.back", assert => { +QUnit.test("goBack calls history.back", (assert) => { var called = false; - sandbox.stub(history, "back").callsFake(function() { + sandbox.stub(history, "back").callsFake(function () { called = true; }); @@ -139,14 +139,14 @@ QUnit.test("goBack calls history.back", assert => { assert.ok(called, "history.back is called"); }); -QUnit.test("nextSection calls _changeSection with 1", assert => { +QUnit.test("nextSection calls _changeSection with 1", (assert) => { var spy = sandbox.spy(KeyboardShortcuts, "_changeSection"); KeyboardShortcuts.nextSection(); assert.ok(spy.calledWith(1), "_changeSection is called with 1"); }); -QUnit.test("prevSection calls _changeSection with -1", assert => { +QUnit.test("prevSection calls _changeSection with -1", (assert) => { var spy = sandbox.spy(KeyboardShortcuts, "_changeSection"); KeyboardShortcuts.prevSection(); diff --git a/test/javascripts/components/load-more-test.js b/test/javascripts/components/load-more-test.js index e564d86e71d..0d10793ee65 100644 --- a/test/javascripts/components/load-more-test.js +++ b/test/javascripts/components/load-more-test.js @@ -13,7 +13,7 @@ componentTest("updates once after initialization", { this.set("loadMore", () => this.set("loadedMore", true)); configureEyeline({ skipUpdate: false, - rootElement: "#ember-testing" + rootElement: "#ember-testing", }); }, @@ -23,5 +23,5 @@ componentTest("updates once after initialization", { test(assert) { assert.ok(this.loadedMore); - } + }, }); diff --git a/test/javascripts/components/secret-value-list-test.js b/test/javascripts/components/secret-value-list-test.js index 72cb70f759c..7ee2f9b0042 100644 --- a/test/javascripts/components/secret-value-list-test.js +++ b/test/javascripts/components/secret-value-list-test.js @@ -39,7 +39,7 @@ componentTest("adding a value", { "firstKey|FirstValue\nsecondKey|secondValue\nthirdKey|thirdValue", "it adds the value to the list of values" ); - } + }, }); componentTest("adding an invalid value", { @@ -67,7 +67,7 @@ componentTest("adding an invalid value", { .indexOf(I18n.t("admin.site_settings.secret_list.invalid_input")) > -1, "it shows validation error" ); - } + }, }); componentTest("removing a value", { @@ -88,5 +88,5 @@ componentTest("removing a value", { "secondKey|secondValue", "it removes the expected value" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/api-test.js b/test/javascripts/components/select-kit/api-test.js index 68414809b45..1b4efdae399 100644 --- a/test/javascripts/components/select-kit/api-test.js +++ b/test/javascripts/components/select-kit/api-test.js @@ -2,7 +2,7 @@ import componentTest from "helpers/component-test"; import selectKit, { testSelectKitModule, setDefaultState, - DEFAULT_CONTENT + DEFAULT_CONTENT, } from "helpers/select-kit-helper"; import { withPluginApi } from "discourse/lib/plugin-api"; import { clearCallbacks } from "select-kit/mixins/plugin-api"; @@ -11,13 +11,13 @@ testSelectKitModule("select-kit:api", { beforeEach() { this.setProperties({ comboBox: selectKit(".combo-box"), - singleSelect: selectKit(".single-select:not(.combo-box)") + singleSelect: selectKit(".single-select:not(.combo-box)"), }); }, afterEach() { clearCallbacks(); - } + }, }); componentTest("modifySelectKit(identifier).appendContent", { @@ -29,11 +29,11 @@ componentTest("modifySelectKit(identifier).appendContent", { beforeEach() { setDefaultState(this, null, { content: DEFAULT_CONTENT }); - withPluginApi("0.8.43", api => { + withPluginApi("0.8.43", (api) => { api.modifySelectKit("combo-box").appendContent(() => { return { id: "alpaca", - name: "Alpaca" + name: "Alpaca", }; }); api.modifySelectKit("combo-box").appendContent(() => {}); @@ -52,7 +52,7 @@ componentTest("modifySelectKit(identifier).appendContent", { await this.comboBox.collapse(); assert.notOk(this.singleSelect.rowByValue("alpaca").exists()); - } + }, }); componentTest("modifySelectKit(identifier).prependContent", { @@ -64,11 +64,11 @@ componentTest("modifySelectKit(identifier).prependContent", { beforeEach() { setDefaultState(this, null, { content: DEFAULT_CONTENT }); - withPluginApi("0.8.43", api => { + withPluginApi("0.8.43", (api) => { api.modifySelectKit("combo-box").prependContent(() => { return { id: "alpaca", - name: "Alpaca" + name: "Alpaca", }; }); api.modifySelectKit("combo-box").prependContent(() => {}); @@ -87,7 +87,7 @@ componentTest("modifySelectKit(identifier).prependContent", { await this.comboBox.collapse(); assert.notOk(this.singleSelect.rowByValue("alpaca").exists()); - } + }, }); componentTest("modifySelectKit(identifier).onChange", { @@ -99,7 +99,7 @@ componentTest("modifySelectKit(identifier).onChange", { beforeEach() { setDefaultState(this, null, { content: DEFAULT_CONTENT }); - withPluginApi("0.8.43", api => { + withPluginApi("0.8.43", (api) => { api.modifySelectKit("combo-box").onChange((component, value, item) => { find("#test").text(item.name); }); @@ -111,5 +111,5 @@ componentTest("modifySelectKit(identifier).onChange", { await this.comboBox.selectRowByIndex(0); assert.equal(find("#test").text(), "foo"); - } + }, }); diff --git a/test/javascripts/components/select-kit/category-chooser-test.js b/test/javascripts/components/select-kit/category-chooser-test.js index 3f921efec47..57e3fe68609 100644 --- a/test/javascripts/components/select-kit/category-chooser-test.js +++ b/test/javascripts/components/select-kit/category-chooser-test.js @@ -25,7 +25,7 @@ componentTest("with value", { async test(assert) { assert.equal(this.subject.header().value(), 2); assert.equal(this.subject.header().label(), "feature"); - } + }, }); componentTest("with excludeCategoryId", { @@ -34,7 +34,7 @@ componentTest("with excludeCategoryId", { await this.subject.expand(); assert.notOk(this.subject.rowByValue(2).exists()); - } + }, }); componentTest("with scopedCategoryId", { @@ -62,7 +62,7 @@ componentTest("with scopedCategoryId", { "bug", "search finds outside of scope" ); - } + }, }); componentTest("with allowUncategorized=null", { @@ -75,7 +75,7 @@ componentTest("with allowUncategorized=null", { test(assert) { assert.equal(this.subject.header().value(), null); assert.equal(this.subject.header().label(), "category…"); - } + }, }); componentTest("with allowUncategorized=null rootNone=true", { @@ -88,7 +88,7 @@ componentTest("with allowUncategorized=null rootNone=true", { test(assert) { assert.equal(this.subject.header().value(), null); assert.equal(this.subject.header().label(), "(no category)"); - } + }, }); componentTest("with disallowed uncategorized, none", { @@ -102,7 +102,7 @@ componentTest("with disallowed uncategorized, none", { test(assert) { assert.equal(this.subject.header().value(), null); assert.equal(this.subject.header().label(), "root none label"); - } + }, }); componentTest("with allowed uncategorized", { @@ -115,7 +115,7 @@ componentTest("with allowed uncategorized", { test(assert) { assert.equal(this.subject.header().value(), null); assert.equal(this.subject.header().label(), "uncategorized"); - } + }, }); componentTest("with allowed uncategorized and none=true", { @@ -128,7 +128,7 @@ componentTest("with allowed uncategorized and none=true", { test(assert) { assert.equal(this.subject.header().value(), null); assert.equal(this.subject.header().label(), "(no category)"); - } + }, }); componentTest("with allowed uncategorized and none", { @@ -142,5 +142,5 @@ componentTest("with allowed uncategorized and none", { test(assert) { assert.equal(this.subject.header().value(), null); assert.equal(this.subject.header().label(), "root none label"); - } + }, }); diff --git a/test/javascripts/components/select-kit/category-drop-test.js b/test/javascripts/components/select-kit/category-drop-test.js index 4bf28b93c59..914f68d1550 100644 --- a/test/javascripts/components/select-kit/category-drop-test.js +++ b/test/javascripts/components/select-kit/category-drop-test.js @@ -5,7 +5,7 @@ import componentTest from "helpers/component-test"; import { testSelectKitModule } from "helpers/select-kit-helper"; import { NO_CATEGORIES_ID, - ALL_CATEGORIES_ID + ALL_CATEGORIES_ID, } from "select-kit/components/category-drop"; import { set } from "@ember/object"; @@ -15,20 +15,20 @@ function initCategories(context) { const categories = context.site.categoriesList; context.setProperties({ category: categories.firstObject, - categories + categories, }); } function initCategoriesWithParentCategory(context) { const parentCategory = Category.findById(2); - const childCategories = context.site.categoriesList.filter(c => { + const childCategories = context.site.categoriesList.filter((c) => { return c.parentCategory === parentCategory; }); context.setProperties({ parentCategory, category: null, - categories: childCategories + categories: childCategories, }); } @@ -60,7 +60,7 @@ componentTest("caretUpIcon", { exists($header.find(`.d-icon-caret-right`)), "it uses the correct default icon" ); - } + }, }); componentTest("none", { @@ -78,7 +78,7 @@ componentTest("none", { I18n.t("category.all").toLowerCase(), "it uses the noneLabel" ); - } + }, }); componentTest("[not staff - TL0] displayCategoryDescription", { @@ -99,7 +99,7 @@ componentTest("[not staff - TL0] displayCategoryDescription", { exists(row.el().find(".category-desc")), "it shows category description for newcomers" ); - } + }, }); componentTest("[not staff - TL1] displayCategoryDescription", { @@ -120,7 +120,7 @@ componentTest("[not staff - TL1] displayCategoryDescription", { !exists(row.el().find(".category-desc")), "it doesn't shows category description for TL0+" ); - } + }, }); componentTest("[staff - TL0] displayCategoryDescription", { @@ -141,7 +141,7 @@ componentTest("[staff - TL0] displayCategoryDescription", { !exists(row.el().find(".category-desc")), "it doesn't show category description for staff" ); - } + }, }); componentTest("hideParentCategory (default: false)", { @@ -157,7 +157,7 @@ componentTest("hideParentCategory (default: false)", { const row = this.subject.rowByValue(this.category.id); assert.equal(row.value(), this.category.id); assert.equal(this.category.parent_category_id, null); - } + }, }); componentTest("hideParentCategory (true)", { @@ -179,13 +179,8 @@ componentTest("hideParentCategory (true)", { assert.ok(childRow.exists(), "the child row is showing"); const $categoryStatus = childRow.el().find(".category-status"); - assert.ok( - $categoryStatus - .text() - .trim() - .match(/^spec/) - ); - } + assert.ok($categoryStatus.text().trim().match(/^spec/)); + }, }); componentTest("allow_uncategorized_topics (true)", { @@ -202,7 +197,7 @@ componentTest("allow_uncategorized_topics (true)", { const uncategorizedCategoryId = this.site.uncategorized_category_id; const row = this.subject.rowByValue(uncategorizedCategoryId); assert.ok(row.exists(), "the uncategorized row is showing"); - } + }, }); componentTest("allow_uncategorized_topics (false)", { @@ -219,7 +214,7 @@ componentTest("allow_uncategorized_topics (false)", { const uncategorizedCategoryId = this.site.uncategorized_category_id; const row = this.subject.rowByValue(uncategorizedCategoryId); assert.notOk(row.exists(), "the uncategorized row is not showing"); - } + }, }); componentTest("countSubcategories (default: false)", { @@ -234,18 +229,14 @@ componentTest("countSubcategories (default: false)", { const category = Category.findById(7); const row = this.subject.rowByValue(category.id); - const topicCount = row - .el() - .find(".topic-count") - .text() - .trim(); + const topicCount = row.el().find(".topic-count").text().trim(); assert.equal( topicCount, "× 481", "it doesn't include the topic count of subcategories" ); - } + }, }); componentTest("countSubcategories (true)", { @@ -260,18 +251,14 @@ componentTest("countSubcategories (true)", { const category = Category.findById(7); const row = this.subject.rowByValue(category.id); - const topicCount = row - .el() - .find(".topic-count") - .text() - .trim(); + const topicCount = row.el().find(".topic-count").text().trim(); assert.equal( topicCount, "× 584", "it includes the topic count of subcategories" ); - } + }, }); componentTest("shortcuts:default", { @@ -290,7 +277,7 @@ componentTest("shortcuts:default", { this.categories.firstObject.id, "Shortcuts are not prepended when no category is selected" ); - } + }, }); componentTest("shortcuts:category is set", { @@ -304,7 +291,7 @@ componentTest("shortcuts:category is set", { await this.subject.expand(); assert.equal(this.subject.rowByIndex(0).value(), ALL_CATEGORIES_ID); - } + }, }); componentTest("shortcuts with parentCategory/subCategory=true:default", { @@ -318,7 +305,7 @@ componentTest("shortcuts with parentCategory/subCategory=true:default", { await this.subject.expand(); assert.equal(this.subject.rowByIndex(0).value(), NO_CATEGORIES_ID); - } + }, }); componentTest( @@ -336,7 +323,7 @@ componentTest( assert.equal(this.subject.rowByIndex(0).value(), ALL_CATEGORIES_ID); assert.equal(this.subject.rowByIndex(1).value(), NO_CATEGORIES_ID); - } + }, } ); @@ -356,5 +343,5 @@ componentTest("category url", { DiscourseURL.routeTo.calledWith("/c/feature/spec/26"), "it builds a correct URL" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/combo-box-test.js b/test/javascripts/components/select-kit/combo-box-test.js index f48cb602499..7ceb8599acd 100644 --- a/test/javascripts/components/select-kit/combo-box-test.js +++ b/test/javascripts/components/select-kit/combo-box-test.js @@ -5,13 +5,13 @@ moduleForComponent("select-kit/combo-box", { integration: true, beforeEach() { this.set("subject", selectKit()); - } + }, }); const DEFAULT_CONTENT = [ { id: 1, name: "foo" }, { id: 2, name: "bar" }, - { id: 3, name: "baz" } + { id: 3, name: "baz" }, ]; const DEFAULT_VALUE = 1; @@ -20,7 +20,7 @@ const setDefaultState = (ctx, options) => { const properties = Object.assign( { content: DEFAULT_CONTENT, - value: DEFAULT_VALUE + value: DEFAULT_VALUE, }, options || {} ); @@ -40,9 +40,9 @@ componentTest("options.clearable", { beforeEach() { setDefaultState(this, { clearable: true, - onChange: value => { + onChange: (value) => { this.set("value", value); - } + }, }); }, @@ -62,7 +62,7 @@ componentTest("options.clearable", { "it hides the clear button" ); assert.equal($header.value(), null); - } + }, }); componentTest("options.{caretUpIcon,caretDownIcon}", { @@ -80,7 +80,7 @@ componentTest("options.{caretUpIcon,caretDownIcon}", { beforeEach() { setDefaultState(this, { caretUpIcon: "pencil-alt", - caretDownIcon: "trash-alt" + caretDownIcon: "trash-alt", }); }, @@ -98,5 +98,5 @@ componentTest("options.{caretUpIcon,caretDownIcon}", { exists($header.find(`.d-icon-${this.caretUpIcon}`)), "it uses the icon provided" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/dropdown-select-box-test.js b/test/javascripts/components/select-kit/dropdown-select-box-test.js index 550d3babc44..4819533d136 100644 --- a/test/javascripts/components/select-kit/dropdown-select-box-test.js +++ b/test/javascripts/components/select-kit/dropdown-select-box-test.js @@ -5,13 +5,13 @@ moduleForComponent("select-kit/dropdown-select-box", { integration: true, beforeEach() { this.set("subject", selectKit()); - } + }, }); const DEFAULT_CONTENT = [ { id: 1, name: "foo" }, { id: 2, name: "bar" }, - { id: 3, name: "baz" } + { id: 3, name: "baz" }, ]; const DEFAULT_VALUE = 1; @@ -21,9 +21,9 @@ const setDefaultState = (ctx, options) => { { content: DEFAULT_CONTENT, value: DEFAULT_VALUE, - onChange: value => { + onChange: (value) => { this.set("value", value); - } + }, }, options || {} ); @@ -51,7 +51,7 @@ componentTest("selection behavior", { this.subject.isExpanded(), "it collapses the dropdown on select" ); - } + }, }); componentTest("options.showFullTitle=false", { @@ -71,30 +71,22 @@ componentTest("options.showFullTitle=false", { setDefaultState(this, { value: null, showFullTitle: false, - none: "test_none" + none: "test_none", }); }, async test(assert) { assert.ok( - !exists( - this.subject - .header() - .el() - .find(".selected-name") - ), + !exists(this.subject.header().el().find(".selected-name")), "it hides the text of the selected item" ); assert.equal( - this.subject - .header() - .el() - .attr("title"), + this.subject.header().el().attr("title"), "[en_US.test_none]", "it adds a title attribute to the button" ); - } + }, }); componentTest("options.showFullTitle=true", { @@ -114,13 +106,8 @@ componentTest("options.showFullTitle=true", { async test(assert) { assert.ok( - exists( - this.subject - .header() - .el() - .find(".selected-name") - ), + exists(this.subject.header().el().find(".selected-name")), "it shows the text of the selected item" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/list-setting-test.js b/test/javascripts/components/select-kit/list-setting-test.js index 5fddc9ea56d..b1f0571624e 100644 --- a/test/javascripts/components/select-kit/list-setting-test.js +++ b/test/javascripts/components/select-kit/list-setting-test.js @@ -31,5 +31,5 @@ componentTest("default", { assert.equal(this.subject.rows().length, 1); assert.equal(this.subject.rowByIndex(0).value(), "underline"); - } + }, }); diff --git a/test/javascripts/components/select-kit/mini-tag-chooser-test.js b/test/javascripts/components/select-kit/mini-tag-chooser-test.js index c17b01bd6ad..24ecb7c5d06 100644 --- a/test/javascripts/components/select-kit/mini-tag-chooser-test.js +++ b/test/javascripts/components/select-kit/mini-tag-chooser-test.js @@ -17,7 +17,7 @@ componentTest("displays tags", { async test(assert) { assert.equal(this.subject.header().value(), "foo,bar"); - } + }, }); componentTest("create a tag", { @@ -32,23 +32,13 @@ componentTest("create a tag", { await this.subject.expand(); await this.subject.fillInFilter("mon"); - assert.equal( - find(".select-kit-row") - .text() - .trim(), - "monkey x1" - ); + assert.equal(find(".select-kit-row").text().trim(), "monkey x1"); await this.subject.fillInFilter("key"); - assert.equal( - find(".select-kit-row") - .text() - .trim(), - "monkey x1" - ); + assert.equal(find(".select-kit-row").text().trim(), "monkey x1"); await this.subject.keyboard("enter"); assert.equal(this.subject.header().value(), "foo,bar,monkey"); - } + }, }); componentTest("max_tags_per_topic", { @@ -70,8 +60,8 @@ componentTest("max_tags_per_topic", { assert.equal( error, I18n.t("select_kit.max_content_reached", { - count: this.siteSettings.max_tags_per_topic + count: this.siteSettings.max_tags_per_topic, }) ); - } + }, }); diff --git a/test/javascripts/components/select-kit/multi-select-test.js b/test/javascripts/components/select-kit/multi-select-test.js index d3d022273e1..f501fa3a19a 100644 --- a/test/javascripts/components/select-kit/multi-select-test.js +++ b/test/javascripts/components/select-kit/multi-select-test.js @@ -18,14 +18,14 @@ function template(options = []) { const DEFAULT_CONTENT = [ { id: 1, name: "foo" }, { id: 2, name: "bar" }, - { id: 3, name: "baz" } + { id: 3, name: "baz" }, ]; const setDefaultState = (ctx, options) => { const properties = Object.assign( { content: DEFAULT_CONTENT, - value: null + value: null, }, options || {} ); @@ -59,5 +59,5 @@ componentTest("content", { null, "it doesn't set a value from the content" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/notifications-button-test.js b/test/javascripts/components/select-kit/notifications-button-test.js index 7da1f8002fa..50c168d19bf 100644 --- a/test/javascripts/components/select-kit/notifications-button-test.js +++ b/test/javascripts/components/select-kit/notifications-button-test.js @@ -1,7 +1,7 @@ import componentTest from "helpers/component-test"; import { testSelectKitModule, - setDefaultState + setDefaultState, } from "helpers/select-kit-helper"; testSelectKitModule("notifications-button"); @@ -39,5 +39,5 @@ componentTest("default", { icon.classList.contains("d-icon-d-regular"), "it shows the correct icon" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/pinned-options-test.js b/test/javascripts/components/select-kit/pinned-options-test.js index 11248cc69fc..e5503c43078 100644 --- a/test/javascripts/components/select-kit/pinned-options-test.js +++ b/test/javascripts/components/select-kit/pinned-options-test.js @@ -2,20 +2,20 @@ import selectKit from "helpers/select-kit-helper"; import componentTest from "helpers/component-test"; import Topic from "discourse/models/topic"; -const buildTopic = function(pinned = true) { +const buildTopic = function (pinned = true) { return Topic.create({ id: 1234, title: "Qunit Test Topic", deleted_at: new Date(), - pinned + pinned, }); }; moduleForComponent("select-kit/pinned-options", { integration: true, - beforeEach: function() { + beforeEach: function () { this.set("subject", selectKit()); - } + }, }); componentTest("unpinning", { @@ -33,7 +33,7 @@ componentTest("unpinning", { await this.subject.selectRowByValue("unpinned"); assert.equal(this.subject.header().name(), "unpinned"); - } + }, }); componentTest("pinning", { @@ -51,5 +51,5 @@ componentTest("pinning", { await this.subject.selectRowByValue("pinned"); assert.equal(this.subject.header().name(), "pinned"); - } + }, }); diff --git a/test/javascripts/components/select-kit/single-select-test.js b/test/javascripts/components/select-kit/single-select-test.js index e23d0c2d5e3..7e81a1f74bf 100644 --- a/test/javascripts/components/select-kit/single-select-test.js +++ b/test/javascripts/components/select-kit/single-select-test.js @@ -22,7 +22,7 @@ function template(options = []) { const DEFAULT_CONTENT = [ { id: 1, name: "foo" }, { id: 2, name: "bar" }, - { id: 3, name: "baz" } + { id: 3, name: "baz" }, ]; const DEFAULT_VALUE = 1; @@ -34,9 +34,9 @@ const setDefaultState = (ctx, options) => { value: DEFAULT_VALUE, nameProperty: "name", valueProperty: "id", - onChange: value => { + onChange: (value) => { ctx.set("value", value); - } + }, }, options || {} ); @@ -70,7 +70,7 @@ componentTest("content", { null, "it doesn't set a value from the content" ); - } + }, }); componentTest("value", { @@ -86,7 +86,7 @@ componentTest("value", { 1, "it selects the correct content to display" ); - } + }, }); componentTest("options.filterable", { @@ -107,7 +107,7 @@ componentTest("options.filterable", { filter, "it filters the list" ); - } + }, }); componentTest("options.limitMatches", { @@ -126,7 +126,7 @@ componentTest("options.limitMatches", { 1, "it returns only 1 result" ); - } + }, }); componentTest("valueAttribute (deprecated)", { @@ -146,7 +146,7 @@ componentTest("valueAttribute (deprecated)", { { name: "Smaller", value: "smaller" }, { name: "Normal", value: "normal" }, { name: "Larger", value: "larger" }, - { name: "Largest", value: "largest" } + { name: "Largest", value: "largest" }, ]; this.set("content", content); }, @@ -155,7 +155,7 @@ componentTest("valueAttribute (deprecated)", { await this.subject.expand(); assert.equal(this.subject.selectedRow().value(), this.value); - } + }, }); componentTest("none:string", { @@ -172,7 +172,7 @@ componentTest("none:string", { const noneRow = this.subject.rowByIndex(0); assert.equal(noneRow.value(), null); assert.equal(noneRow.name(), I18n.t("test.none")); - } + }, }); componentTest("none:object", { @@ -188,7 +188,7 @@ componentTest("none:object", { const noneRow = this.subject.rowByIndex(0); assert.equal(noneRow.value(), null); assert.equal(noneRow.name(), "(default)"); - } + }, }); componentTest("content is a basic array", { @@ -200,7 +200,7 @@ componentTest("content is a basic array", { nameProperty: null, valueProperty: null, value: "foo", - content: ["foo", "bar", "baz"] + content: ["foo", "bar", "baz"], }); }, @@ -215,7 +215,7 @@ componentTest("content is a basic array", { await this.subject.selectRowByIndex(0); assert.equal(this.value, null); - } + }, }); componentTest("selected value can be 0", { @@ -226,8 +226,8 @@ componentTest("selected value can be 0", { value: 1, content: [ { id: 0, name: "foo" }, - { id: 1, name: "bar" } - ] + { id: 1, name: "bar" }, + ], }); }, @@ -238,7 +238,7 @@ componentTest("selected value can be 0", { await this.subject.selectRowByValue(0); assert.equal(this.subject.header().value(), 0); - } + }, }); componentTest("prevents propagating click event on header", { @@ -249,7 +249,7 @@ componentTest("prevents propagating click event on header", { this.setProperties({ onClick: () => this.set("value", "foo"), content: DEFAULT_CONTENT, - value: DEFAULT_VALUE + value: DEFAULT_VALUE, }); }, @@ -257,7 +257,7 @@ componentTest("prevents propagating click event on header", { assert.equal(this.value, DEFAULT_VALUE); await this.subject.expand(); assert.equal(this.value, DEFAULT_VALUE); - } + }, }); componentTest("labelProperty", { @@ -266,7 +266,7 @@ componentTest("labelProperty", { beforeEach() { this.setProperties({ content: [{ id: 1, name: "john", foo: "JACKSON" }], - value: 1 + value: 1, }); }, @@ -278,7 +278,7 @@ componentTest("labelProperty", { const row = this.subject.rowByValue(1); assert.equal(row.label(), "JACKSON"); - } + }, }); componentTest("titleProperty", { @@ -287,7 +287,7 @@ componentTest("titleProperty", { beforeEach() { this.setProperties({ content: [{ id: 1, name: "john", foo: "JACKSON" }], - value: 1 + value: 1, }); }, @@ -299,5 +299,5 @@ componentTest("titleProperty", { const row = this.subject.rowByValue(1); assert.equal(row.title(), "JACKSON"); - } + }, }); diff --git a/test/javascripts/components/select-kit/tag-drop-test.js b/test/javascripts/components/select-kit/tag-drop-test.js index c66eee0a260..65f77024363 100644 --- a/test/javascripts/components/select-kit/tag-drop-test.js +++ b/test/javascripts/components/select-kit/tag-drop-test.js @@ -10,36 +10,36 @@ testSelectKitModule("tag-drop", { const site = Site.current(); set(site, "top_tags", ["jeff", "neil", "arpit", "régis"]); - const response = object => { + const response = (object) => { return [200, { "Content-Type": "application/json" }, object]; }; - pretender.get("/tags/filter/search", params => { + pretender.get("/tags/filter/search", (params) => { if (params.queryParams.q === "rég") { return response({ - results: [{ id: "régis", text: "régis", count: 2, pm_count: 0 }] + results: [{ id: "régis", text: "régis", count: 2, pm_count: 0 }], }); } else if (params.queryParams.q === "dav") { return response({ - results: [{ id: "David", text: "David", count: 2, pm_count: 0 }] + results: [{ id: "David", text: "David", count: 2, pm_count: 0 }], }); } }); - } + }, }); function initTags(context) { const categories = context.site.categoriesList; const parentCategory = categories.findBy("id", 2); const childCategories = categories.filter( - c => c.parentCategory === parentCategory + (c) => c.parentCategory === parentCategory ); // top_tags context.setProperties({ firstCategory: parentCategory, secondCategory: childCategories.firstObject, - tagId: "jeff" + tagId: "jeff", }); } @@ -85,5 +85,5 @@ componentTest("default", { I18n.t("tagging.selector_all_tags"), "it has the correct label for all-tags" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/topic-notifications-button-test.js b/test/javascripts/components/select-kit/topic-notifications-button-test.js index fd23bdf7923..16567159b8f 100644 --- a/test/javascripts/components/select-kit/topic-notifications-button-test.js +++ b/test/javascripts/components/select-kit/topic-notifications-button-test.js @@ -3,15 +3,15 @@ import selectKit from "helpers/select-kit-helper"; import componentTest from "helpers/component-test"; import Topic from "discourse/models/topic"; -const buildTopic = function(level, archetype = "regular") { +const buildTopic = function (level, archetype = "regular") { return Topic.create({ - id: 4563 + id: 4563, }).updateFromJson({ title: "Qunit Test Topic", details: { - notification_level: level + notification_level: level, }, - archetype + archetype, }); }; @@ -23,7 +23,7 @@ moduleForComponent("select-kit/topic-notifications-button", { afterEach() { I18n.translations.en.js.topic.notifications.tracking_pm.title = originalTranslation; - } + }, }); componentTest("the header has a localized title", { @@ -36,9 +36,7 @@ componentTest("the header has a localized title", { async test(assert) { assert.equal( - selectKit() - .header() - .label(), + selectKit().header().label(), "Normal", "it has the correct label" ); @@ -46,13 +44,11 @@ componentTest("the header has a localized title", { await this.set("topic", buildTopic(2)); assert.equal( - selectKit() - .header() - .label(), + selectKit().header().label(), "Tracking", "it correctly changes the label" ); - } + }, }); componentTest("the header has a localized title", { @@ -66,11 +62,9 @@ componentTest("the header has a localized title", { test(assert) { assert.equal( - selectKit() - .header() - .label(), + selectKit().header().label(), `${originalTranslation} PM`, "it has the correct label for PMs" ); - } + }, }); diff --git a/test/javascripts/components/select-kit/topic-notifications-options-test.js b/test/javascripts/components/select-kit/topic-notifications-options-test.js index c22fdc1911e..fb30a393db8 100644 --- a/test/javascripts/components/select-kit/topic-notifications-options-test.js +++ b/test/javascripts/components/select-kit/topic-notifications-options-test.js @@ -3,34 +3,34 @@ import selectKit from "helpers/select-kit-helper"; import componentTest from "helpers/component-test"; import Topic from "discourse/models/topic"; -const buildTopic = function(archetype) { +const buildTopic = function (archetype) { return Topic.create({ - id: 4563 + id: 4563, }).updateFromJson({ title: "Qunit Test Topic", details: { - notification_level: 1 + notification_level: 1, }, - archetype + archetype, }); }; function extractDescs(rows) { return Array.from( - rows.find(".desc").map(function() { + rows.find(".desc").map(function () { return this.textContent.trim(); }) ); } function getTranslations(type = "") { - return ["watching", "tracking", "regular", "muted"].map(key => { + return ["watching", "tracking", "regular", "muted"].map((key) => { return I18n.t(`topic.notifications.${key}${type}.description`); }); } moduleForComponent("select-kit/topic-notifications-options", { - integration: true + integration: true, }); componentTest("regular topic notification level descriptions", { @@ -59,7 +59,7 @@ componentTest("regular topic notification level descriptions", { "it has the correct copy" ); }); - } + }, }); componentTest("PM topic notification level descriptions", { @@ -89,5 +89,5 @@ componentTest("PM topic notification level descriptions", { "it has the correct copy" ); }); - } + }, }); diff --git a/test/javascripts/components/select-kit/user-chooser-test.js b/test/javascripts/components/select-kit/user-chooser-test.js index d980301f1ea..eed4e3b659f 100644 --- a/test/javascripts/components/select-kit/user-chooser-test.js +++ b/test/javascripts/components/select-kit/user-chooser-test.js @@ -16,7 +16,7 @@ componentTest("displays usernames", { async test(assert) { assert.equal(this.subject.header().name(), "bob,martin"); - } + }, }); componentTest("can remove a username", { @@ -29,5 +29,5 @@ componentTest("can remove a username", { async test(assert) { await this.subject.deselectItem("bob"); assert.equal(this.subject.header().name(), "martin"); - } + }, }); diff --git a/test/javascripts/components/share-button-test.js b/test/javascripts/components/share-button-test.js index 35032d2751b..e8bac153d79 100644 --- a/test/javascripts/components/share-button-test.js +++ b/test/javascripts/components/share-button-test.js @@ -12,5 +12,5 @@ componentTest("share button", { find('button[data-share-url="https://eviltrout.com"]').length, "it has the data attribute for sharing" ); - } + }, }); diff --git a/test/javascripts/components/share-button.js b/test/javascripts/components/share-button.js index 958f821ce6a..9e267d4bd61 100644 --- a/test/javascripts/components/share-button.js +++ b/test/javascripts/components/share-button.js @@ -9,5 +9,5 @@ export default Button.extend({ click() { return true; - } + }, }); diff --git a/test/javascripts/components/simple-list-test.js b/test/javascripts/components/simple-list-test.js index 5c8d26dd51c..4150381898e 100644 --- a/test/javascripts/components/simple-list-test.js +++ b/test/javascripts/components/simple-list-test.js @@ -34,7 +34,7 @@ componentTest("adding a value", { find(".values .value").length === 4, "it adds the value when keying Enter" ); - } + }, }); componentTest("removing a value", { @@ -56,7 +56,7 @@ componentTest("removing a value", { find(".values .value[data-index='0'] .value-input")[0].value === "osama", "it removes the correct value" ); - } + }, }); componentTest("delimiter support", { @@ -80,5 +80,5 @@ componentTest("delimiter support", { "eviltrout", "it adds the correct value" ); - } + }, }); diff --git a/test/javascripts/components/text-field-test.js b/test/javascripts/components/text-field-test.js index 0d458a02db1..11d43bd2111 100644 --- a/test/javascripts/components/text-field-test.js +++ b/test/javascripts/components/text-field-test.js @@ -8,7 +8,7 @@ componentTest("renders correctly with no properties set", { test(assert) { assert.ok(find("input[type=text]").length); - } + }, }); componentTest("support a placeholder", { @@ -21,7 +21,7 @@ componentTest("support a placeholder", { test(assert) { assert.ok(find("input[type=text]").length); assert.equal(find("input").prop("placeholder"), "placeholder.i18n.key"); - } + }, }); componentTest("sets the dir attribute to ltr for Hebrew text", { @@ -32,7 +32,7 @@ componentTest("sets the dir attribute to ltr for Hebrew text", { test(assert) { assert.equal(find("input").attr("dir"), "rtl"); - } + }, }); componentTest("sets the dir attribute to ltr for English text", { @@ -43,7 +43,7 @@ componentTest("sets the dir attribute to ltr for English text", { test(assert) { assert.equal(find("input").attr("dir"), "ltr"); - } + }, }); componentTest("supports onChange", { @@ -52,7 +52,7 @@ componentTest("supports onChange", { this.called = false; this.newValue = null; this.set("value", "hello"); - this.set("changed", v => { + this.set("changed", (v) => { this.newValue = v; this.called = true; }); @@ -63,7 +63,7 @@ componentTest("supports onChange", { await fillIn(".tf-test", "new text"); assert.ok(this.called); assert.equal(this.newValue, "new text"); - } + }, }); componentTest("supports onChangeImmediate", { @@ -72,7 +72,7 @@ componentTest("supports onChangeImmediate", { this.called = false; this.newValue = null; this.set("value", "old"); - this.set("changed", v => { + this.set("changed", (v) => { this.newValue = v; this.called = true; }); @@ -83,5 +83,5 @@ componentTest("supports onChangeImmediate", { await fillIn(".tf-test", "no longer old"); assert.ok(this.called); assert.equal(this.newValue, "no longer old"); - } + }, }); diff --git a/test/javascripts/components/time-input-test.js b/test/javascripts/components/time-input-test.js index a6ef6606c99..eed1195b413 100644 --- a/test/javascripts/components/time-input-test.js +++ b/test/javascripts/components/time-input-test.js @@ -6,7 +6,7 @@ moduleForComponent("time-input", { beforeEach() { this.set("subject", selectKit()); - } + }, }); function setTime(time) { @@ -22,7 +22,7 @@ componentTest("default", { test(assert) { assert.equal(this.subject.header().name(), "14:58"); - } + }, }); componentTest("prevents mutations", { @@ -36,7 +36,7 @@ componentTest("prevents mutations", { await this.subject.expand(); await this.subject.selectRowByIndex(3); assert.equal(this.subject.header().name(), "14:58"); - } + }, }); componentTest("allows mutations through actions", { @@ -51,5 +51,5 @@ componentTest("allows mutations through actions", { await this.subject.expand(); await this.subject.selectRowByIndex(3); assert.equal(this.subject.header().name(), "00:45"); - } + }, }); diff --git a/test/javascripts/components/user-selector-test.js b/test/javascripts/components/user-selector-test.js index 5ed444429af..d09816e3cf6 100644 --- a/test/javascripts/components/user-selector-test.js +++ b/test/javascripts/components/user-selector-test.js @@ -35,7 +35,7 @@ componentTest("pasting a list of usernames", { this.set("usernames", null); paste(element, "eviltrout\nsam\ncodinghorror"); assert.equal(this.get("usernames"), "eviltrout,sam,codinghorror"); - } + }, }); componentTest("excluding usernames", { @@ -50,5 +50,5 @@ componentTest("excluding usernames", { let element = find(".test-selector")[0]; paste(element, "roman,penar,jeff,robin"); assert.equal(this.get("usernames"), "mark,roman,penar"); - } + }, }); diff --git a/test/javascripts/components/value-list-test.js b/test/javascripts/components/value-list-test.js index 15365e22258..e0769901da6 100644 --- a/test/javascripts/components/value-list-test.js +++ b/test/javascripts/components/value-list-test.js @@ -26,7 +26,7 @@ componentTest("adding a value", { "vinkas\nosama\neviltrout", "it adds the value to the list of values" ); - } + }, }); componentTest("removing a value", { @@ -53,7 +53,7 @@ componentTest("removing a value", { .innerText === "vinkas", "it adds the removed value to choices" ); - } + }, }); componentTest("selecting a value", { @@ -62,7 +62,7 @@ componentTest("selecting a value", { beforeEach() { this.setProperties({ values: "vinkas\nosama", - choices: ["maja", "michael"] + choices: ["maja", "michael"], }); }, @@ -80,7 +80,7 @@ componentTest("selecting a value", { "vinkas\nosama\nmaja", "it adds the value to the list of values" ); - } + }, }); componentTest("array support", { @@ -107,7 +107,7 @@ componentTest("array support", { ["vinkas", "osama", "eviltrout"], "it adds the value to the list of values" ); - } + }, }); componentTest("delimiter support", { @@ -134,5 +134,5 @@ componentTest("delimiter support", { "vinkas|osama|eviltrout", "it adds the value to the list of values" ); - } + }, }); diff --git a/test/javascripts/controllers/avatar-selector-test.js b/test/javascripts/controllers/avatar-selector-test.js index a50addaccb0..c6e2301f4d1 100644 --- a/test/javascripts/controllers/avatar-selector-test.js +++ b/test/javascripts/controllers/avatar-selector-test.js @@ -4,10 +4,10 @@ moduleFor("controller:avatar-selector", "controller:avatar-selector", { beforeEach() { this.registry.register("router:main", mapRoutes()); }, - needs: ["controller:modal"] + needs: ["controller:modal"], }); -QUnit.test("avatarTemplate", function(assert) { +QUnit.test("avatarTemplate", function (assert) { const avatarSelectorController = this.subject(); avatarSelectorController.setProperties({ @@ -15,8 +15,8 @@ QUnit.test("avatarTemplate", function(assert) { user: { system_avatar_upload_id: 1, gravatar_avatar_upload_id: 2, - custom_avatar_upload_id: 3 - } + custom_avatar_upload_id: 3, + }, }); assert.equal( diff --git a/test/javascripts/controllers/bookmark-test.js b/test/javascripts/controllers/bookmark-test.js index 99198974714..3f26e9abd59 100644 --- a/test/javascripts/controllers/bookmark-test.js +++ b/test/javascripts/controllers/bookmark-test.js @@ -12,21 +12,21 @@ moduleFor("controller:bookmark", { KeyboardShortcutInitializer.initialize(this.container); BookmarkController = this.subject({ currentUser: User.current(), - site: { isMobileDevice: false } + site: { isMobileDevice: false }, }); BookmarkController.onShow(); }, afterEach() { sandbox.restore(); - } + }, }); function mockMomentTz(dateString) { fakeTime(dateString, BookmarkController.userTimezone); } -QUnit.test("showLaterToday when later today is tomorrow do not show", function( +QUnit.test("showLaterToday when later today is tomorrow do not show", function ( assert ) { mockMomentTz("2019-12-11T22:00:00"); @@ -36,13 +36,13 @@ QUnit.test("showLaterToday when later today is tomorrow do not show", function( QUnit.test( "showLaterToday when later today is after 5pm but before 6pm", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T15:00:00"); assert.equal(BookmarkController.get("showLaterToday"), true); } ); -QUnit.test("showLaterToday when now is after the cutoff time (5pm)", function( +QUnit.test("showLaterToday when now is after the cutoff time (5pm)", function ( assert ) { mockMomentTz("2019-12-11T17:00:00"); @@ -51,14 +51,14 @@ QUnit.test("showLaterToday when now is after the cutoff time (5pm)", function( QUnit.test( "showLaterToday when later today is before the end of the day, show", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T10:00:00"); assert.equal(BookmarkController.get("showLaterToday"), true); } ); -QUnit.test("nextWeek gets next week correctly", function(assert) { +QUnit.test("nextWeek gets next week correctly", function (assert) { mockMomentTz("2019-12-11T08:00:00"); assert.equal( @@ -67,7 +67,7 @@ QUnit.test("nextWeek gets next week correctly", function(assert) { ); }); -QUnit.test("nextMonth gets next month correctly", function(assert) { +QUnit.test("nextMonth gets next month correctly", function (assert) { mockMomentTz("2019-12-11T08:00:00"); assert.equal( @@ -76,7 +76,7 @@ QUnit.test("nextMonth gets next month correctly", function(assert) { ); }); -QUnit.test("laterThisWeek gets 2 days from now", function(assert) { +QUnit.test("laterThisWeek gets 2 days from now", function (assert) { mockMomentTz("2019-12-10T08:00:00"); assert.equal( @@ -85,26 +85,27 @@ QUnit.test("laterThisWeek gets 2 days from now", function(assert) { ); }); -QUnit.test("laterThisWeek returns null if we are at Thursday already", function( - assert -) { - mockMomentTz("2019-12-12T08:00:00"); +QUnit.test( + "laterThisWeek returns null if we are at Thursday already", + function (assert) { + mockMomentTz("2019-12-12T08:00:00"); - assert.equal(BookmarkController.laterThisWeek(), null); -}); + assert.equal(BookmarkController.laterThisWeek(), null); + } +); -QUnit.test("showLaterThisWeek returns true if < Thursday", function(assert) { +QUnit.test("showLaterThisWeek returns true if < Thursday", function (assert) { mockMomentTz("2019-12-10T08:00:00"); assert.equal(BookmarkController.showLaterThisWeek, true); }); -QUnit.test("showLaterThisWeek returns false if > Thursday", function(assert) { +QUnit.test("showLaterThisWeek returns false if > Thursday", function (assert) { mockMomentTz("2019-12-12T08:00:00"); assert.equal(BookmarkController.showLaterThisWeek, false); }); -QUnit.test("tomorrow gets tomorrow correctly", function(assert) { +QUnit.test("tomorrow gets tomorrow correctly", function (assert) { mockMomentTz("2019-12-11T08:00:00"); assert.equal( @@ -115,7 +116,7 @@ QUnit.test("tomorrow gets tomorrow correctly", function(assert) { QUnit.test( "startOfDay changes the time of the provided date to 8:00am correctly", - function(assert) { + function (assert) { let dt = moment.tz( "2019-12-11T11:37:16", BookmarkController.currentUser.resolvedTimezone( @@ -132,7 +133,7 @@ QUnit.test( QUnit.test( "laterToday gets 3 hours from now and if before half-past, it rounds down", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T08:13:00"); assert.equal( @@ -144,7 +145,7 @@ QUnit.test( QUnit.test( "laterToday gets 3 hours from now and if after half-past, it rounds up to the next hour", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T08:43:00"); assert.equal( @@ -156,7 +157,7 @@ QUnit.test( QUnit.test( "laterToday is capped to 6pm. later today at 3pm = 6pm, 3:30pm = 6pm, 4pm = 6pm, 4:59pm = 6pm", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T15:00:00"); assert.equal( @@ -191,19 +192,19 @@ QUnit.test( } ); -QUnit.test("showLaterToday returns false if >= 5PM", function(assert) { +QUnit.test("showLaterToday returns false if >= 5PM", function (assert) { mockMomentTz("2019-12-11T17:00:01"); assert.equal(BookmarkController.showLaterToday, false); }); -QUnit.test("showLaterToday returns false if >= 5PM", function(assert) { +QUnit.test("showLaterToday returns false if >= 5PM", function (assert) { mockMomentTz("2019-12-11T17:00:01"); assert.equal(BookmarkController.showLaterToday, false); }); QUnit.test( "reminderAt - custom - defaults to 8:00am if the time is not selected", - function(assert) { + function (assert) { BookmarkController.customReminderDate = "2028-12-12"; BookmarkController.selectedReminderType = BookmarkController.reminderTypes.CUSTOM; @@ -226,7 +227,7 @@ QUnit.test( QUnit.test( "loadLastUsedCustomReminderDatetime fills the custom reminder date + time if present in localStorage", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T08:00:00"); localStorage.lastCustomBookmarkReminderDate = "2019-12-12"; localStorage.lastCustomBookmarkReminderTime = "08:00"; @@ -240,7 +241,7 @@ QUnit.test( QUnit.test( "loadLastUsedCustomReminderDatetime does not fills the custom reminder date + time if the datetime in localStorage is < now", - function(assert) { + function (assert) { mockMomentTz("2019-12-11T08:00:00"); localStorage.lastCustomBookmarkReminderDate = "2019-12-11"; localStorage.lastCustomBookmarkReminderTime = "07:00"; @@ -252,7 +253,7 @@ QUnit.test( } ); -QUnit.test("user timezone updates when the modal is shown", function(assert) { +QUnit.test("user timezone updates when the modal is shown", function (assert) { User.current().changeTimezone(null); let stub = sandbox.stub(moment.tz, "guess").returns("Europe/Moscow"); BookmarkController.onShow(); @@ -275,7 +276,7 @@ QUnit.test("user timezone updates when the modal is shown", function(assert) { QUnit.test( "opening the modal with an existing bookmark with reminder at prefills the custom reminder type", - function(assert) { + function (assert) { let name = "test"; let reminderAt = "2020-05-15T09:45:00"; BookmarkController.model = { id: 1, name: name, reminderAt: reminderAt }; diff --git a/test/javascripts/controllers/create-account-test.js b/test/javascripts/controllers/create-account-test.js index 9afee507a34..1ab7aebf3bf 100644 --- a/test/javascripts/controllers/create-account-test.js +++ b/test/javascripts/controllers/create-account-test.js @@ -2,10 +2,10 @@ import I18n from "I18n"; import { controllerModule } from "helpers/qunit-helpers"; controllerModule("controller:create-account", { - needs: ["controller:modal", "controller:login"] + needs: ["controller:modal", "controller:login"], }); -test("basicUsernameValidation", async function(assert) { +test("basicUsernameValidation", async function (assert) { const subject = this.subject; const testInvalidUsername = async (username, expectedReason) => { @@ -34,7 +34,7 @@ test("basicUsernameValidation", async function(assert) { const controller = await subject(); controller.setProperties({ accountUsername: "porkchops", - prefilledUsername: "porkchops" + prefilledUsername: "porkchops", }); assert.equal( @@ -49,7 +49,7 @@ test("basicUsernameValidation", async function(assert) { ); }); -test("passwordValidation", async function(assert) { +test("passwordValidation", async function (assert) { const controller = await this.subject(); controller.set("authProvider", ""); @@ -86,7 +86,7 @@ test("passwordValidation", async function(assert) { testInvalidPassword("pork@chops.com", I18n.t("user.password.same_as_email")); }); -test("authProviderDisplayName", async function(assert) { +test("authProviderDisplayName", async function (assert) { const controller = this.subject(); assert.equal( diff --git a/test/javascripts/controllers/history-test.js b/test/javascripts/controllers/history-test.js index 6767e810234..20385f3638a 100644 --- a/test/javascripts/controllers/history-test.js +++ b/test/javascripts/controllers/history-test.js @@ -1,11 +1,11 @@ moduleFor("controller:history"); -QUnit.test("displayEdit", async function(assert) { +QUnit.test("displayEdit", async function (assert) { const HistoryController = this.subject(); HistoryController.setProperties({ model: { last_revision: 3, current_revision: 3, can_edit: false }, - topicController: {} + topicController: {}, }); assert.equal( @@ -99,9 +99,9 @@ QUnit.test("displayEdit", async function(assert) { viewMode: "side_by_side", model: { body_changes: { - side_by_side: html - } - } + side_by_side: html, + }, + }, }); await HistoryController.bodyDiffChanged(); diff --git a/test/javascripts/controllers/preferences-account-test.js b/test/javascripts/controllers/preferences-account-test.js index f79642e2bd3..e686c705e1d 100644 --- a/test/javascripts/controllers/preferences-account-test.js +++ b/test/javascripts/controllers/preferences-account-test.js @@ -1,22 +1,22 @@ import EmberObject from "@ember/object"; moduleFor("controller:preferences/account"); -QUnit.test("updating of associated accounts", function(assert) { +QUnit.test("updating of associated accounts", function (assert) { const controller = this.subject({ siteSettings: { - enable_google_oauth2_logins: true + enable_google_oauth2_logins: true, }, model: EmberObject.create({ id: 70, second_factor_enabled: true, - is_anonymous: true + is_anonymous: true, }), currentUser: EmberObject.create({ - id: 1234 + id: 1234, }), site: EmberObject.create({ - isMobileDevice: false - }) + isMobileDevice: false, + }), }); assert.equal(controller.get("canUpdateAssociatedAccounts"), false); diff --git a/test/javascripts/controllers/preferences-second-factor-test.js b/test/javascripts/controllers/preferences-second-factor-test.js index 3fd2366cfcd..5d6fd69c5b3 100644 --- a/test/javascripts/controllers/preferences-second-factor-test.js +++ b/test/javascripts/controllers/preferences-second-factor-test.js @@ -1,13 +1,14 @@ moduleFor("controller:preferences/second-factor"); -QUnit.test("displayOAuthWarning when OAuth login methods are enabled", function( - assert -) { - const controller = this.subject({ - siteSettings: { - enable_google_oauth2_logins: true - } - }); +QUnit.test( + "displayOAuthWarning when OAuth login methods are enabled", + function (assert) { + const controller = this.subject({ + siteSettings: { + enable_google_oauth2_logins: true, + }, + }); - assert.equal(controller.get("displayOAuthWarning"), true); -}); + assert.equal(controller.get("displayOAuthWarning"), true); + } +); diff --git a/test/javascripts/controllers/reorder-categories-test.js b/test/javascripts/controllers/reorder-categories-test.js index 386c05347ff..019bd63c8a6 100644 --- a/test/javascripts/controllers/reorder-categories-test.js +++ b/test/javascripts/controllers/reorder-categories-test.js @@ -6,10 +6,10 @@ moduleFor("controller:reorder-categories", "controller:reorder-categories", { beforeEach() { this.registry.register("router:main", mapRoutes()); }, - needs: ["controller:modal"] + needs: ["controller:modal"], }); -QUnit.test("reorder set unique position number", function(assert) { +QUnit.test("reorder set unique position number", function (assert) { const store = createStore(); const categories = []; @@ -31,30 +31,30 @@ QUnit.test("reorder set unique position number", function(assert) { QUnit.test( "reorder places subcategories after their parent categories, while maintaining the relative order", - function(assert) { + function (assert) { const store = createStore(); const parent = store.createRecord("category", { id: 1, position: 1, - slug: "parent" + slug: "parent", }); const child1 = store.createRecord("category", { id: 2, position: 3, slug: "child1", - parent_category_id: 1 + parent_category_id: 1, }); const child2 = store.createRecord("category", { id: 3, position: 0, slug: "child2", - parent_category_id: 1 + parent_category_id: 1, }); const other = store.createRecord("category", { id: 4, position: 2, - slug: "other" + slug: "other", }); const categories = [child2, parent, other, child1]; @@ -74,25 +74,25 @@ QUnit.test( QUnit.test( "changing the position number of a category should place it at given position", - function(assert) { + function (assert) { const store = createStore(); const elem1 = store.createRecord("category", { id: 1, position: 0, - slug: "foo" + slug: "foo", }); const elem2 = store.createRecord("category", { id: 2, position: 1, - slug: "bar" + slug: "bar", }); const elem3 = store.createRecord("category", { id: 3, position: 2, - slug: "test" + slug: "test", }); const categories = [elem1, elem2, elem3]; @@ -114,32 +114,32 @@ QUnit.test( QUnit.test( "changing the position number of a category should place it at given position and respect children", - function(assert) { + function (assert) { const store = createStore(); const elem1 = store.createRecord("category", { id: 1, position: 0, - slug: "foo" + slug: "foo", }); const child1 = store.createRecord("category", { id: 4, position: 1, slug: "foochild", - parent_category_id: 1 + parent_category_id: 1, }); const elem2 = store.createRecord("category", { id: 2, position: 2, - slug: "bar" + slug: "bar", }); const elem3 = store.createRecord("category", { id: 3, position: 3, - slug: "test" + slug: "test", }); const categories = [elem1, child1, elem2, elem3]; @@ -161,39 +161,39 @@ QUnit.test( QUnit.test( "changing the position through click on arrow of a category should place it at given position and respect children", - function(assert) { + function (assert) { const store = createStore(); const elem1 = store.createRecord("category", { id: 1, position: 0, - slug: "foo" + slug: "foo", }); const child1 = store.createRecord("category", { id: 4, position: 1, slug: "foochild", - parent_category_id: 1 + parent_category_id: 1, }); const child2 = store.createRecord("category", { id: 5, position: 2, slug: "foochildchild", - parent_category_id: 4 + parent_category_id: 4, }); const elem2 = store.createRecord("category", { id: 2, position: 3, - slug: "bar" + slug: "bar", }); const elem3 = store.createRecord("category", { id: 3, position: 4, - slug: "test" + slug: "test", }); const categories = [elem1, child1, child2, elem2, elem3]; diff --git a/test/javascripts/controllers/topic-test.js b/test/javascripts/controllers/topic-test.js index cf6ed4e6c06..197b6b11b0c 100644 --- a/test/javascripts/controllers/topic-test.js +++ b/test/javascripts/controllers/topic-test.js @@ -11,12 +11,12 @@ moduleFor("controller:topic", "controller:topic", { "controller:composer", "controller:application", "service:app-events", - "service:document-title" + "service:document-title", ], beforeEach() { this.registry.register("service:screen-track", {}, { instantiate: false }); this.registry.injection("controller", "appEvents", "service:app-events"); - } + }, }); function topicWithStream(streamDetails) { @@ -25,7 +25,7 @@ function topicWithStream(streamDetails) { return topic; } -QUnit.test("editTopic", function(assert) { +QUnit.test("editTopic", function (assert) { const model = Topic.create(); const controller = this.subject({ model }); @@ -60,7 +60,7 @@ QUnit.test("editTopic", function(assert) { ); }); -QUnit.test("toggleMultiSelect", function(assert) { +QUnit.test("toggleMultiSelect", function (assert) { const model = Topic.create(); const controller = this.subject({ model }); @@ -100,7 +100,7 @@ QUnit.test("toggleMultiSelect", function(assert) { ); }); -QUnit.test("selectedPosts", function(assert) { +QUnit.test("selectedPosts", function (assert) { let model = topicWithStream({ posts: [{ id: 1 }, { id: 2 }, { id: 3 }] }); const controller = this.subject({ model }); @@ -112,12 +112,12 @@ QUnit.test("selectedPosts", function(assert) { "selectedPosts only contains already loaded posts" ); assert.not( - controller.get("selectedPosts").some(p => p === undefined), + controller.get("selectedPosts").some((p) => p === undefined), "selectedPosts only contains valid post objects" ); }); -QUnit.test("selectedAllPosts", function(assert) { +QUnit.test("selectedAllPosts", function (assert) { let model = topicWithStream({ stream: [1, 2, 3] }); const controller = this.subject({ model }); @@ -138,7 +138,7 @@ QUnit.test("selectedAllPosts", function(assert) { model.setProperties({ "postStream.isMegaTopic": true, - posts_count: 1 + posts_count: 1, }); assert.ok( @@ -147,14 +147,14 @@ QUnit.test("selectedAllPosts", function(assert) { ); }); -QUnit.test("selectedPostsUsername", function(assert) { +QUnit.test("selectedPostsUsername", function (assert) { let model = topicWithStream({ posts: [ { id: 1, username: "gary" }, { id: 2, username: "gary" }, - { id: 3, username: "lili" } + { id: 3, username: "lili" }, ], - stream: [1, 2, 3] + stream: [1, 2, 3], }); const controller = this.subject({ model }); const selectedPostIds = controller.get("selectedPostIds"); @@ -198,7 +198,7 @@ QUnit.test("selectedPostsUsername", function(assert) { ); }); -QUnit.test("showSelectedPostsAtBottom", function(assert) { +QUnit.test("showSelectedPostsAtBottom", function (assert) { const site = EmberObject.create({ mobileView: false }); const model = Topic.create({ posts_count: 3 }); const controller = this.subject({ model, site }); @@ -220,19 +220,19 @@ QUnit.test("showSelectedPostsAtBottom", function(assert) { ); }); -QUnit.test("canDeleteSelected", function(assert) { +QUnit.test("canDeleteSelected", function (assert) { const currentUser = User.create({ admin: false }); this.registry.register("current-user:main", currentUser, { - instantiate: false + instantiate: false, }); this.registry.injection("controller", "currentUser", "current-user:main"); let model = topicWithStream({ posts: [ { id: 1, can_delete: false }, { id: 2, can_delete: true }, - { id: 3, can_delete: true } + { id: 3, can_delete: true }, ], - stream: [1, 2, 3] + stream: [1, 2, 3], }); const controller = this.subject({ model }); const selectedPostIds = controller.get("selectedPostIds"); @@ -271,14 +271,14 @@ QUnit.test("canDeleteSelected", function(assert) { ); }); -QUnit.test("Can split/merge topic", function(assert) { +QUnit.test("Can split/merge topic", function (assert) { let model = topicWithStream({ posts: [ { id: 1, post_number: 1, post_type: 1 }, { id: 2, post_number: 2, post_type: 4 }, - { id: 3, post_number: 3, post_type: 1 } + { id: 3, post_number: 3, post_type: 1 }, ], - stream: [1, 2, 3] + stream: [1, 2, 3], }); model.set("details.can_move_posts", false); const controller = this.subject({ model }); @@ -316,19 +316,19 @@ QUnit.test("Can split/merge topic", function(assert) { ); }); -QUnit.test("canChangeOwner", function(assert) { +QUnit.test("canChangeOwner", function (assert) { const currentUser = User.create({ admin: false }); this.registry.register("current-user:main", currentUser, { - instantiate: false + instantiate: false, }); this.registry.injection("controller", "currentUser", "current-user:main"); let model = topicWithStream({ posts: [ { id: 1, username: "gary" }, - { id: 2, username: "lili" } + { id: 2, username: "lili" }, ], - stream: [1, 2] + stream: [1, 2], }); model.set("currentUser", { admin: false }); const controller = this.subject({ model }); @@ -358,15 +358,15 @@ QUnit.test("canChangeOwner", function(assert) { ); }); -QUnit.test("canMergePosts", function(assert) { +QUnit.test("canMergePosts", function (assert) { let model = topicWithStream({ posts: [ { id: 1, username: "gary", can_delete: true }, { id: 2, username: "lili", can_delete: true }, { id: 3, username: "gary", can_delete: false }, - { id: 4, username: "gary", can_delete: true } + { id: 4, username: "gary", can_delete: true }, ], - stream: [1, 2, 3] + stream: [1, 2, 3], }); const controller = this.subject({ model }); const selectedPostIds = controller.get("selectedPostIds"); @@ -405,7 +405,7 @@ QUnit.test("canMergePosts", function(assert) { ); }); -QUnit.test("Select/deselect all", function(assert) { +QUnit.test("Select/deselect all", function (assert) { let model = topicWithStream({ stream: [1, 2, 3] }); const controller = this.subject({ model }); @@ -432,7 +432,7 @@ QUnit.test("Select/deselect all", function(assert) { ); }); -QUnit.test("togglePostSelection", function(assert) { +QUnit.test("togglePostSelection", function (assert) { const controller = this.subject(); const selectedPostIds = controller.get("selectedPostIds"); @@ -468,17 +468,17 @@ QUnit.test("togglePostSelection", function(assert) { // assert.equal(selectedPostIds[2], 100, "selected post #100"); // }); -QUnit.test("selectBelow", function(assert) { +QUnit.test("selectBelow", function (assert) { const site = EmberObject.create({ - post_types: { small_action: 3, whisper: 4 } + post_types: { small_action: 3, whisper: 4 }, }); let model = topicWithStream({ stream: [1, 2, 3, 4, 5, 6, 7, 8], posts: [ { id: 5, cooked: "whisper post", post_type: 4 }, { id: 6, cooked: "a small action", post_type: 3 }, - { id: 7, cooked: "", post_type: 4 } - ] + { id: 7, cooked: "", post_type: 4 }, + ], }); const controller = this.subject({ site, model }); let selectedPostIds = controller.get("selectedPostIds"); @@ -493,16 +493,16 @@ QUnit.test("selectBelow", function(assert) { assert.equal(selectedPostIds[3], 8, "also selected 3rd post below post #3"); }); -QUnit.test("topVisibleChanged", function(assert) { +QUnit.test("topVisibleChanged", function (assert) { let model = topicWithStream({ - posts: [{ id: 1 }] + posts: [{ id: 1 }], }); const controller = this.subject({ model }); const placeholder = new Placeholder("post-placeholder"); assert.equal( controller.send("topVisibleChanged", { - post: placeholder + post: placeholder, }), null, "it should work with a post-placehodler" @@ -511,7 +511,7 @@ QUnit.test("topVisibleChanged", function(assert) { QUnit.test( "deletePost - no modal is shown if post does not have replies", - function(assert) { + function (assert) { pretender.get("/posts/2/reply-ids.json", () => { return [200, { "Content-Type": "application/json" }, []]; }); @@ -525,13 +525,13 @@ QUnit.test( destroy: () => { destroyed = true; return Promise.resolve(); - } + }, }); const currentUser = EmberObject.create({ moderator: true }); let model = topicWithStream({ stream: [2, 3, 4], - posts: [post, { id: 3 }, { id: 4 }] + posts: [post, { id: 3 }, { id: 4 }], }); const controller = this.subject({ model, currentUser }); diff --git a/test/javascripts/ember/resolver-test.js b/test/javascripts/ember/resolver-test.js index e374abc56fd..62877d4dcc4 100644 --- a/test/javascripts/ember/resolver-test.js +++ b/test/javascripts/ember/resolver-test.js @@ -10,7 +10,7 @@ function lookupTemplate(assert, name, expectedTemplate, message) { } function setTemplates(lookupTemplateStrings) { - lookupTemplateStrings.forEach(function(lookupTemplateString) { + lookupTemplateStrings.forEach(function (lookupTemplateString) { Ember.TEMPLATES[lookupTemplateString] = lookupTemplateString; }); } @@ -27,10 +27,10 @@ QUnit.module("lib:resolver", { afterEach() { Ember.TEMPLATES = originalTemplates; - } + }, }); -QUnit.test("finds templates in top level dir", assert => { +QUnit.test("finds templates in top level dir", (assert) => { setTemplates(["foobar", "fooBar", "foo_bar", "foo.bar"]); lookupTemplate(assert, "template:foobar", "foobar", "by lowcased name"); @@ -39,7 +39,7 @@ QUnit.test("finds templates in top level dir", assert => { lookupTemplate(assert, "template:foo.bar", "foo.bar", "by dotted name"); }); -QUnit.test("finds templates in first-level subdir", assert => { +QUnit.test("finds templates in first-level subdir", (assert) => { setTemplates(["foo/bar_baz"]); lookupTemplate( @@ -70,7 +70,7 @@ QUnit.test("finds templates in first-level subdir", assert => { QUnit.test( "resolves precedence between overlapping top level dir and first level subdir templates", - assert => { + (assert) => { setTemplates(["fooBar", "foo_bar", "foo.bar", "foo/bar"]); lookupTemplate( @@ -94,7 +94,7 @@ QUnit.test( } ); -QUnit.test("finds templates in subdir deeper than one level", assert => { +QUnit.test("finds templates in subdir deeper than one level", (assert) => { setTemplates(["foo/bar/baz/qux"]); lookupTemplate( @@ -148,7 +148,7 @@ QUnit.test("finds templates in subdir deeper than one level", assert => { ); }); -QUnit.test("resolves mobile templates to 'mobile/' namespace", assert => { +QUnit.test("resolves mobile templates to 'mobile/' namespace", (assert) => { setTemplates(["mobile/foo", "bar", "mobile/bar", "baz"]); setResolverOption("mobileView", true); @@ -173,38 +173,41 @@ QUnit.test("resolves mobile templates to 'mobile/' namespace", assert => { ); }); -QUnit.test("resolves plugin templates to 'javascripts/' namespace", assert => { - setTemplates(["javascripts/foo", "bar", "javascripts/bar", "baz"]); +QUnit.test( + "resolves plugin templates to 'javascripts/' namespace", + (assert) => { + setTemplates(["javascripts/foo", "bar", "javascripts/bar", "baz"]); - lookupTemplate( - assert, - "template:foo", - "javascripts/foo", - "finding plugin version even if normal one is not present" - ); - lookupTemplate( - assert, - "template:bar", - "javascripts/bar", - "preferring plugin version when both versions are present" - ); - lookupTemplate( - assert, - "template:baz", - "baz", - "falling back to a normal version when plugin version is not present" - ); -}); + lookupTemplate( + assert, + "template:foo", + "javascripts/foo", + "finding plugin version even if normal one is not present" + ); + lookupTemplate( + assert, + "template:bar", + "javascripts/bar", + "preferring plugin version when both versions are present" + ); + lookupTemplate( + assert, + "template:baz", + "baz", + "falling back to a normal version when plugin version is not present" + ); + } +); QUnit.test( "resolves templates with 'admin' prefix to 'admin/templates/' namespace", - assert => { + (assert) => { setTemplates([ "admin/templates/foo", "adminBar", "admin_bar", "admin.bar", - "admin/templates/bar" + "admin/templates/bar", ]); lookupTemplate( @@ -255,7 +258,7 @@ QUnit.test( QUnit.test( "returns 'not_found' template when template name cannot be resolved", - assert => { + (assert) => { setTemplates(["not_found"]); lookupTemplate(assert, "template:foo/bar/baz", "not_found", ""); diff --git a/test/javascripts/helpers/component-test.js b/test/javascripts/helpers/component-test.js index b1a82209c6d..7fd57275446 100644 --- a/test/javascripts/helpers/component-test.js +++ b/test/javascripts/helpers/component-test.js @@ -7,24 +7,24 @@ import Site from "discourse/models/site"; import Session from "discourse/models/session"; import { currentSettings } from "helpers/site-settings"; -export default function(name, opts) { +export default function (name, opts) { opts = opts || {}; if (opts.skip) { return; } - test(name, function(assert) { + test(name, function (assert) { this.site = Site.current(); this.session = Session.current(); this.registry.register("site-settings:main", currentSettings(), { - instantiate: false + instantiate: false, }); this.registry.register("capabilities:main", EmberObject); this.registry.register("site:main", this.site, { instantiate: false }); this.registry.register("session:main", this.session, { - instantiate: false + instantiate: false, }); this.registry.injection("component", "siteSettings", "site-settings:main"); this.registry.injection("component", "appEvents", "service:app-events"); @@ -40,7 +40,7 @@ export default function(name, opts) { const currentUser = User.create({ username: "eviltrout" }); this.currentUser = currentUser; this.registry.register("current-user:main", this.currentUser, { - instantiate: false + instantiate: false, }); this.registry.injection("component", "currentUser", "current-user:main"); this.registry.register( diff --git a/test/javascripts/helpers/create-pretender.js b/test/javascripts/helpers/create-pretender.js index 3b648b5b912..4311954c5d0 100644 --- a/test/javascripts/helpers/create-pretender.js +++ b/test/javascripts/helpers/create-pretender.js @@ -3,7 +3,7 @@ import User from "discourse/models/user"; export function parsePostData(query) { const result = {}; if (query) { - query.split("&").forEach(function(part) { + query.split("&").forEach(function (part) { const item = part.split("="); const firstSeg = decodeURIComponent(item[0]); const m = /^([^\[]+)\[(.+)\]/.exec(firstSeg); @@ -42,7 +42,7 @@ export default new Pretender(); export function applyDefaultHandlers(pretender) { // Autoload any `*-pretender` files - Object.keys(requirejs.entries).forEach(e => { + Object.keys(requirejs.entries).forEach((e) => { let m = e.match(/^.*helpers\/([a-z-]+)\-pretender$/); if (m && m[1] !== "create") { let result = requirejs(e).default.call(pretender, helpers); @@ -90,7 +90,7 @@ export function applyDefaultHandlers(pretender) { tags: [ { id: "eviltrout", count: 1 }, { id: "planned", text: "planned", count: 7, pm_count: 0 }, - { id: "private", text: "private", count: 0, pm_count: 7 } + { id: "private", text: "private", count: 0, pm_count: 7 }, ], extras: { tag_groups: [ @@ -99,28 +99,28 @@ export function applyDefaultHandlers(pretender) { name: "Ford Cars", tags: [ { id: "Escort", text: "Escort", count: 1, pm_count: 0 }, - { id: "focus", text: "focus", count: 3, pm_count: 0 } - ] + { id: "focus", text: "focus", count: 3, pm_count: 0 }, + ], }, { id: 1, name: "Honda Cars", tags: [ { id: "civic", text: "civic", count: 4, pm_count: 0 }, - { id: "accord", text: "accord", count: 2, pm_count: 0 } - ] + { id: "accord", text: "accord", count: 2, pm_count: 0 }, + ], }, { id: 1, name: "Makes", tags: [ { id: "ford", text: "ford", count: 5, pm_count: 0 }, - { id: "honda", text: "honda", count: 6, pm_count: 0 } - ] - } - ] - } - } + { id: "honda", text: "honda", count: 6, pm_count: 0 }, + ], + }, + ], + }, + }, ]; }); @@ -128,14 +128,14 @@ export function applyDefaultHandlers(pretender) { return response({ results: [{ text: "monkey", count: 1 }] }); }); - pretender.get(`/u/:username/emails.json`, request => { + pretender.get(`/u/:username/emails.json`, (request) => { if (request.params.username === "regular2") { return response({ email: "regular2@example.com", secondary_emails: [ "regular2alt1@example.com", - "regular2alt2@example.com" - ] + "regular2alt2@example.com", + ], }); } return response({ email: "eviltrout@example.com" }); @@ -167,18 +167,18 @@ export function applyDefaultHandlers(pretender) { read_restricted: false, parent_category_id: null, topic_count: 1, - post_count: 1 - } - ] + post_count: 1, + }, + ], }, badges: [{ id: 444, count: 1 }], - topics: [{ id: 1234, title: "cool title", slug: "cool-title" }] + topics: [{ id: 1234, title: "cool title", slug: "cool-title" }], }); }); pretender.get("/u/eviltrout/invited_count.json", () => { return response({ - counts: { pending: 1, redeemed: 0, total: 0 } + counts: { pending: 1, redeemed: 0, total: 0 }, }); }); @@ -194,7 +194,7 @@ export function applyDefaultHandlers(pretender) { return response({ pinned_in_category_count: 0, pinned_globally_count: 0, - banner_count: 0 + banner_count: 0, }); }); @@ -209,34 +209,34 @@ export function applyDefaultHandlers(pretender) { pretender.put("/t/internationalization-localization/280/status", () => { return response({ success: "OK", - topic_status_update: null + topic_status_update: null, }); }); pretender.post("/clicks/track", success); - pretender.get("/search", request => { + pretender.get("/search", (request) => { if (request.queryParams.q === "posts") { return response({ posts: [ { - id: 1234 - } - ] + id: 1234, + }, + ], }); } else if (request.queryParams.q === "evil") { return response({ posts: [ { - id: 1234 - } + id: 1234, + }, ], tags: [ { id: 6, - name: "eviltrout" - } - ] + name: "eviltrout", + }, + ], }); } @@ -266,7 +266,7 @@ export function applyDefaultHandlers(pretender) { return response({ id: 280, slug: "internationalization-localization", - url: "/t/internationalization-localization/280" + url: "/t/internationalization-localization/280", }); }); @@ -277,7 +277,7 @@ export function applyDefaultHandlers(pretender) { pretender.get("/permalink-check.json", () => { return response({ found: false, - html: "
not found
" + html: "
not found
", }); }); @@ -293,9 +293,9 @@ export function applyDefaultHandlers(pretender) { id: 1, username: "eviltrout", avatar_template: "/user_avatar/default/eviltrout/{size}/1.png", - username_lower: "eviltrout" - } - ] + username_lower: "eviltrout", + }, + ], }); }); @@ -311,7 +311,7 @@ export function applyDefaultHandlers(pretender) { response(fixturesByUrl["/categories_and_latest.json"]) ); - pretender.put("/categories/:category_id", request => { + pretender.put("/categories/:category_id", (request) => { const category = parsePostData(request.requestBody); category.id = parseInt(request.params.category_id, 10); @@ -322,14 +322,14 @@ export function applyDefaultHandlers(pretender) { return response({ category }); }); - pretender.get("/draft.json", request => { + pretender.get("/draft.json", (request) => { if (request.queryParams.draft_key === "new_topic") { return response(fixturesByUrl["/draft.json"]); } else if (request.queryParams.draft_key.startsWith("topic_")) return response( fixturesByUrl[request.url] || { draft: null, - draft_sequence: 0 + draft_sequence: 0, } ); return response({}); @@ -337,17 +337,17 @@ export function applyDefaultHandlers(pretender) { pretender.get("/drafts.json", () => response(fixturesByUrl["/drafts.json"])); - pretender.put("/queued_posts/:queued_post_id", function(request) { + pretender.put("/queued_posts/:queued_post_id", function (request) { return response({ queued_post: { id: request.params.queued_post_id } }); }); - pretender.get("/queued_posts", function() { + pretender.get("/queued_posts", function () { return response({ - queued_posts: [{ id: 1, raw: "queued post text", can_delete_user: true }] + queued_posts: [{ id: 1, raw: "queued post text", can_delete_user: true }], }); }); - pretender.post("/session", function(request) { + pretender.post("/session", function (request) { const data = parsePostData(request.requestBody); if (data.password === "correct") { @@ -359,7 +359,7 @@ export function applyDefaultHandlers(pretender) { error: "not active", reason: "not_activated", sent_to_email: "eviltrout@example.com", - current_email: "current@example.com" + current_email: "current@example.com", }); } @@ -368,7 +368,7 @@ export function applyDefaultHandlers(pretender) { error: "not active", reason: "not_activated", sent_to_email: "eviltrout@example.com", - current_email: "current@example.com" + current_email: "current@example.com", }); } @@ -385,7 +385,7 @@ export function applyDefaultHandlers(pretender) { backup_enabled: true, security_key_enabled: false, totp_enabled: true, - multiple_second_factor_methods: false + multiple_second_factor_methods: false, }); } @@ -405,7 +405,7 @@ export function applyDefaultHandlers(pretender) { totp_enabled: false, multiple_second_factor_methods: false, allowed_credential_ids: ["allowed_credential_ids"], - challenge: "challenge" + challenge: "challenge", }); } @@ -415,14 +415,14 @@ export function applyDefaultHandlers(pretender) { pretender.post("/u/action/send_activation_email", success); pretender.put("/u/update-activation-email", success); - pretender.get("/u/hp.json", function() { + pretender.get("/u/hp.json", function () { return response({ value: "32faff1b1ef1ac3", - challenge: "61a3de0ccf086fb9604b76e884d75801" + challenge: "61a3de0ccf086fb9604b76e884d75801", }); }); - pretender.get("/session/csrf", function() { + pretender.get("/session/csrf", function () { return response({ csrf: "mgk906YLagHo2gOgM1ddYjAN4hQolBdJCqlY6jYzAYs=" }); }); @@ -430,7 +430,7 @@ export function applyDefaultHandlers(pretender) { return response({ available: true }); }); - pretender.get("/u/check_username", function(request) { + pretender.get("/u/check_username", function (request) { if (request.queryParams.username === "taken") { return response({ available: false, suggestion: "nottaken" }); } @@ -445,13 +445,13 @@ export function applyDefaultHandlers(pretender) { pretender.put("/posts/:post_id/recover", success); pretender.get("/posts/:post_id/expand-embed", success); - pretender.put("/posts/:post_id", request => { + pretender.put("/posts/:post_id", (request) => { const data = parsePostData(request.requestBody); if (data.post.raw === "this will 409") { return [ 409, { "Content-Type": "application/json" }, - { errors: ["edit conflict"] } + { errors: ["edit conflict"] }, ]; } data.post.id = request.params.post_id; @@ -463,7 +463,7 @@ export function applyDefaultHandlers(pretender) { pretender.get("/t/404.json", () => response(404, "not found")); pretender.get("/t/500.json", () => response(502, {})); - pretender.put("/t/:slug/:id", request => { + pretender.put("/t/:slug/:id", (request) => { const isJSON = request.requestHeaders["Content-Type"].includes( "application/json" ); @@ -477,8 +477,8 @@ export function applyDefaultHandlers(pretender) { id: request.params.id, title: data.title, fancy_title: data.title, - slug: request.params.slug - } + slug: request.params.slug, + }, }); }); @@ -510,25 +510,25 @@ export function applyDefaultHandlers(pretender) { return response(200, fixturesByUrl["/groups/discourse/members.json"]); }); - pretender.get("/t/:topic_id/posts.json", request => { + pretender.get("/t/:topic_id/posts.json", (request) => { const postIds = request.queryParams.post_ids; const postNumber = parseInt(request.queryParams.post_number, 10); let posts; if (postIds) { - posts = postIds.map(p => ({ + posts = postIds.map((p) => ({ id: parseInt(p, 10), - post_number: parseInt(p, 10) + post_number: parseInt(p, 10), })); } else if (postNumber && request.queryParams.asc === "true") { - posts = [...Array(5).keys()].map(p => ({ + posts = [...Array(5).keys()].map((p) => ({ id: p + postNumber + 1, - post_number: p + postNumber + 1 + post_number: p + postNumber + 1, })); } else if (postNumber && request.queryParams.asc === "false") { - posts = [...Array(5).keys()].map(p => ({ + posts = [...Array(5).keys()].map((p) => ({ id: postNumber - p - 1, - post_number: postNumber - p - 1 + post_number: postNumber - p - 1, })); } @@ -542,7 +542,7 @@ export function applyDefaultHandlers(pretender) { pretender.get("/posts/:post_id/reply-ids.json", () => { return response(200, { direct_reply_ids: [45], - all_reply_ids: [45, 100] + all_reply_ids: [45, 100], }); }); @@ -551,7 +551,7 @@ export function applyDefaultHandlers(pretender) { ); pretender.delete("/user_badges/:badge_id", success); - pretender.post("/posts", function(request) { + pretender.post("/posts", function (request) { const data = parsePostData(request.requestBody); if (data.title === "this title triggers an error") { @@ -564,8 +564,8 @@ export function applyDefaultHandlers(pretender) { action: "enqueued", pending_post: { id: 1234, - raw: data.raw - } + raw: data.raw, + }, }); } @@ -574,7 +574,7 @@ export function applyDefaultHandlers(pretender) { success: true, action: "custom", message: "This is a custom response", - route_to: "/faq" + route_to: "/faq", }); } @@ -584,8 +584,8 @@ export function applyDefaultHandlers(pretender) { post: { id: 12345, topic_id: 280, - topic_slug: "internationalization-localization" - } + topic_slug: "internationalization-localization", + }, }); }); @@ -595,27 +595,27 @@ export function applyDefaultHandlers(pretender) { const overridden = { id: "site.overridden", value: "Overridden", - overridden: true + overridden: true, }; - pretender.get("/admin/users/list/active.json", request => { + pretender.get("/admin/users/list/active.json", (request) => { let store = [ { id: 1, username: "eviltrout", - email: "eviltrout@example.com" + email: "eviltrout@example.com", }, { id: 3, username: "discobot", - email: "discobot_email" - } + email: "discobot_email", + }, ]; const showEmails = request.queryParams.show_emails; if (showEmails === "false") { - store = store.map(item => { + store = store.map((item) => { delete item.email; return item; }); @@ -625,7 +625,7 @@ export function applyDefaultHandlers(pretender) { const order = request.queryParams.order; if (order) { - store = store.sort(function(a, b) { + store = store.sort(function (a, b) { return a[order] - b[order]; }); } @@ -642,12 +642,12 @@ export function applyDefaultHandlers(pretender) { { id: 2, username: "sam", - email: "sam@example.com" - } + email: "sam@example.com", + }, ]); }); - pretender.get("/admin/customize/site_texts", request => { + pretender.get("/admin/customize/site_texts", (request) => { if (request.queryParams.overridden) { return response(200, { site_texts: [overridden] }); } else { @@ -662,7 +662,7 @@ export function applyDefaultHandlers(pretender) { response(200, { site_text: siteText }) ); - pretender.put("/admin/customize/site_texts/:key", request => { + pretender.put("/admin/customize/site_texts/:key", (request) => { const result = parsePostData(request.requestBody); result.id = request.params.key; result.can_revert = true; @@ -676,7 +676,7 @@ export function applyDefaultHandlers(pretender) { id: 1, username: "eviltrout", email: "eviltrout@example.com", - admin: true + admin: true, }); }); @@ -684,7 +684,7 @@ export function applyDefaultHandlers(pretender) { return response(200, { id: 2, username: "sam", - admin: true + admin: true, }); }); @@ -693,21 +693,21 @@ export function applyDefaultHandlers(pretender) { id: 3, username: "markvanlan", email: "markvanlan@example.com", - secondary_emails: ["markvanlan1@example.com", "markvanlan2@example.com"] + secondary_emails: ["markvanlan1@example.com", "markvanlan2@example.com"], }); }); pretender.get("/admin/users/1234.json", () => { return response(200, { id: 1234, - username: "regular" + username: "regular", }); }); pretender.get("/admin/users/1235.json", () => { return response(200, { id: 1235, - username: "regular2" + username: "regular2", }); }); @@ -720,7 +720,7 @@ export function applyDefaultHandlers(pretender) { pretender.get("/admin/logs/staff_action_logs.json", () => { return response(200, { staff_action_logs: [], - extras: { user_history_actions: [] } + extras: { user_history_actions: [] }, }); }); @@ -729,7 +729,7 @@ export function applyDefaultHandlers(pretender) { }); pretender.delete("/admin/logs/watched_words/:id.json", success); - pretender.post("/admin/logs/watched_words.json", request => { + pretender.post("/admin/logs/watched_words.json", (request) => { const result = parsePostData(request.requestBody); result.id = new Date().getTime(); return response(200, result); @@ -737,7 +737,7 @@ export function applyDefaultHandlers(pretender) { pretender.get("/admin/logs/search_logs.json", () => { return response(200, [ - { term: "foobar", searches: 35, click_through: 6, unique: 16 } + { term: "foobar", searches: 35, click_through: 6, unique: 16 }, ]); }); @@ -747,8 +747,8 @@ export function applyDefaultHandlers(pretender) { type: "search_log_term", title: "Search Count", term: "ruby", - data: [{ x: "2017-07-20", y: 2 }] - } + data: [{ x: "2017-07-20", y: 2 }], + }, }); }); @@ -757,23 +757,23 @@ export function applyDefaultHandlers(pretender) { imageFilename: "somefile.png", imageFilesize: "10 KB", imageWidth: "1", - imageHeight: "1" + imageHeight: "1", }); }); - pretender.get("/inline-onebox", request => { + pretender.get("/inline-onebox", (request) => { if ( request.queryParams.urls.includes("http://www.example.com/has-title.html") ) { return [ 200, { "Content-Type": "application/html" }, - '{"inline-oneboxes":[{"url":"http://www.example.com/has-title.html","title":"This is a great title"}]}' + '{"inline-oneboxes":[{"url":"http://www.example.com/has-title.html","title":"This is a great title"}]}', ]; } }); - pretender.get("/onebox", request => { + pretender.get("/onebox", (request) => { if ( request.queryParams.url === "http://www.example.com/has-title.html" || request.queryParams.url === @@ -782,7 +782,7 @@ export function applyDefaultHandlers(pretender) { return [ 200, { "Content-Type": "application/html" }, - '' + '', ]; } @@ -790,7 +790,7 @@ export function applyDefaultHandlers(pretender) { return [ 200, { "Content-Type": "application/html" }, - '' + '', ]; } @@ -798,7 +798,7 @@ export function applyDefaultHandlers(pretender) { return [ 200, { "Content-Type": "application/html" }, - '' + '', ]; } if (request.queryParams.url === "http://somegoodurl.com/") { @@ -818,7 +818,7 @@ export function applyDefaultHandlers(pretender) {
- ` + `, ]; } return [404, { "Content-Type": "application/html" }, ""]; diff --git a/test/javascripts/helpers/create-store.js b/test/javascripts/helpers/create-store.js index c4758165098..4556e8011cd 100644 --- a/test/javascripts/helpers/create-store.js +++ b/test/javascripts/helpers/create-store.js @@ -7,10 +7,10 @@ import { buildResolver } from "discourse-common/resolver"; import { currentSettings } from "helpers/site-settings"; const CatAdapter = RestAdapter.extend({ - primaryKey: "cat_id" + primaryKey: "cat_id", }); -export default function(customLookup = () => {}) { +export default function (customLookup = () => {}) { const resolver = buildResolver("discourse").create(); return Store.create({ @@ -51,9 +51,9 @@ export default function(customLookup = () => {}) { const split = type.split(":"); return resolver.customResolve({ type: split[0], - fullNameWithoutType: split[1] + fullNameWithoutType: split[1], }); - } - } + }, + }, }); } diff --git a/test/javascripts/helpers/d-editor-helper.js b/test/javascripts/helpers/d-editor-helper.js index 412409e8434..88d6cb2df9b 100644 --- a/test/javascripts/helpers/d-editor-helper.js +++ b/test/javascripts/helpers/d-editor-helper.js @@ -6,6 +6,6 @@ export default function formatTextWithSelection(text, [start, len]) { text.substr(start, len), ">", text.substr(start + len), - '"' + '"', ].join(""); } diff --git a/test/javascripts/helpers/fixture-pretender.js b/test/javascripts/helpers/fixture-pretender.js index c558c660597..8ed9babff43 100644 --- a/test/javascripts/helpers/fixture-pretender.js +++ b/test/javascripts/helpers/fixture-pretender.js @@ -1,14 +1,14 @@ -export default function(helpers) { +export default function (helpers) { const { response } = helpers; const fixturesByUrl = {}; // Load any fixtures automatically - Object.keys(require._eak_seen).forEach(entry => { + Object.keys(require._eak_seen).forEach((entry) => { if (/^fixtures/.test(entry)) { const fixture = require(entry, null, null, true); if (fixture && fixture.default) { const obj = fixture.default; - Object.keys(obj).forEach(url => { + Object.keys(obj).forEach((url) => { fixturesByUrl[url] = obj[url]; this.get(url, () => response(obj[url])); }); diff --git a/test/javascripts/helpers/qunit-helpers.js b/test/javascripts/helpers/qunit-helpers.js index e640473af2c..84b3e1d4ab1 100644 --- a/test/javascripts/helpers/qunit-helpers.js +++ b/test/javascripts/helpers/qunit-helpers.js @@ -8,7 +8,7 @@ import { forceMobile, resetMobile } from "discourse/lib/mobile"; import { resetPluginApi } from "discourse/lib/plugin-api"; import { clearCache as clearOutletCache, - resetExtraClasses + resetExtraClasses, } from "discourse/lib/plugin-connectors"; import { clearHTMLCache } from "discourse/helpers/custom-html"; import { flushMap } from "discourse/models/store"; @@ -54,7 +54,7 @@ export function fakeTime(timeString, timezone = null, advanceTime = false) { let now = moment.tz(timeString, timezone); return sandbox.useFakeTimers({ now: now.valueOf(), - shouldAdvanceTime: advanceTime + shouldAdvanceTime: advanceTime, }); } @@ -80,7 +80,7 @@ const Plugin = $.fn.modal; const Modal = Plugin.Constructor; function AcceptanceModal(option, _relatedTarget) { - return this.each(function() { + return this.each(function () { var $this = $(this); var data = $this.data("bs.modal"); var options = $.extend( @@ -118,7 +118,7 @@ export function controllerModule(name, args = {}) { args.setupController(controller); } }, - needs: args.needs + needs: args.needs, }); } @@ -135,7 +135,7 @@ export function discourseModule(name, hooks) { if (hooks && hooks.afterEach) { hooks.afterEach.call(this); } - } + }, }); } @@ -151,7 +151,7 @@ export function acceptance(name, options) { resetMobile(); // For now don't do scrolling stuff in Test Mode - HeaderComponent.reopen({ examineDockHeader: function() {} }); + HeaderComponent.reopen({ examineDockHeader: function () {} }); resetExtraClasses(); if (options.mobileView) { @@ -222,7 +222,7 @@ export function acceptance(name, options) { // We do this after reset so that the willClearRender will have already fired resetWidgetCleanCallbacks(); - } + }, }); } @@ -241,36 +241,36 @@ export function fixture(selector) { return $("#qunit-fixture"); } -QUnit.assert.not = function(actual, message) { +QUnit.assert.not = function (actual, message) { this.pushResult({ result: !actual, actual, expected: !actual, - message + message, }); }; -QUnit.assert.blank = function(actual, message) { +QUnit.assert.blank = function (actual, message) { this.pushResult({ result: isEmpty(actual), actual, - message + message, }); }; -QUnit.assert.present = function(actual, message) { +QUnit.assert.present = function (actual, message) { this.pushResult({ result: !isEmpty(actual), actual, - message + message, }); }; -QUnit.assert.containsInstance = function(collection, klass, message) { +QUnit.assert.containsInstance = function (collection, klass, message) { const result = klass.detectInstance(collection[0]); this.pushResult({ result, - message + message, }); }; diff --git a/test/javascripts/helpers/review-pretender.js b/test/javascripts/helpers/review-pretender.js index 406e02ebc39..dd7f9259929 100644 --- a/test/javascripts/helpers/review-pretender.js +++ b/test/javascripts/helpers/review-pretender.js @@ -1,5 +1,5 @@ import { set } from "@ember/object"; -export default function(helpers) { +export default function (helpers) { const { response } = helpers; let flag = { @@ -8,7 +8,7 @@ export default function(helpers) { score: 3.0, target_created_by_id: 1, cooked: "cooked content", - reviewable_score_ids: [1, 2] + reviewable_score_ids: [1, 2], }; this.get("/review", () => { @@ -24,7 +24,7 @@ export default function(helpers) { created_at: "2019-01-14T19:49:53.571Z", username: "newbie", email: "newbie@example.com", - bundled_action_ids: ["approve", "reject"] + bundled_action_ids: ["approve", "reject"], }, { id: 4321, @@ -35,7 +35,7 @@ export default function(helpers) { target_created_by_id: 1, payload: { raw: "existing body", - tags: ["hello", "world"] + tags: ["hello", "world"], }, version: 1, can_edit: true, @@ -43,33 +43,33 @@ export default function(helpers) { { id: "category_id", type: "category" }, { id: "payload.title", type: "text" }, { id: "payload.raw", type: "textarea" }, - { id: "payload.tags", type: "tags" } + { id: "payload.tags", type: "tags" }, ], - bundled_action_ids: ["approve", "reject"] + bundled_action_ids: ["approve", "reject"], }, - flag + flag, ], bundled_actions: [ { id: "approve", - action_ids: ["approve"] + action_ids: ["approve"], }, { id: "reject", - action_ids: ["reject"] - } + action_ids: ["reject"], + }, ], actions: [ { id: "approve", label: "Approve", - icon: "far-thumbs-up" + icon: "far-thumbs-up", }, { id: "reject", label: "Reject", - icon: "far-thumbs-down" - } + icon: "far-thumbs-down", + }, ], reviewable_scores: [{ id: 1 }, { id: 2 }], users: [{ id: 1, username: "eviltrout" }], @@ -77,16 +77,16 @@ export default function(helpers) { total_rows_reviewables: 2, types: { created_by: "user", - target_created_by: "user" - } + target_created_by: "user", + }, }, - __rest_serializer: "1" + __rest_serializer: "1", }); }); this.get("/review/topics", () => { return response(200, { - reviewable_topics: [{ id: 1234, title: "Cool topic" }] + reviewable_topics: [{ id: 1234, title: "Cool topic" }], }); }); @@ -96,13 +96,13 @@ export default function(helpers) { { id: 3, title: "Off-Topic", - reviewable_priority: 0 + reviewable_priority: 0, }, { id: 4, title: "Inappropriate", - reviewable_priority: 5 - } + reviewable_priority: 5, + }, ], reviewable_settings: { id: 13870, @@ -110,10 +110,10 @@ export default function(helpers) { reviewable_priorities: [ { id: 0, name: "Low" }, { id: 5, name: "Medium" }, - { id: 10, name: "High" } - ] + { id: 10, name: "High" }, + ], }, - __rest_serializer: "1" + __rest_serializer: "1", }); }); @@ -121,22 +121,22 @@ export default function(helpers) { this.get("/review/:id", () => { return response(200, { - reviewable: flag + reviewable: flag, }); }); - this.put("/review/:id/perform/:actionId", request => { + this.put("/review/:id/perform/:actionId", (request) => { return response(200, { reviewable_perform_result: { success: true, - remove_reviewable_ids: [parseInt(request.params.id, 10)] - } + remove_reviewable_ids: [parseInt(request.params.id, 10)], + }, }); }); - this.put("/review/:id", request => { + this.put("/review/:id", (request) => { let result = { payload: {} }; - Object.entries(JSON.parse(request.requestBody).reviewable).forEach(t => { + Object.entries(JSON.parse(request.requestBody).reviewable).forEach((t) => { set(result, t[0], t[1]); }); return response(200, result); diff --git a/test/javascripts/helpers/select-kit-helper.js b/test/javascripts/helpers/select-kit-helper.js index f470d5c1f24..63c45adc3ec 100644 --- a/test/javascripts/helpers/select-kit-helper.js +++ b/test/javascripts/helpers/select-kit-helper.js @@ -73,7 +73,7 @@ async function keyboardHelper(value, target, selector) { escape: { keyCode: 27 }, down: { keyCode: 40 }, up: { keyCode: 38 }, - tab: { keyCode: 9 } + tab: { keyCode: 9 }, }; await triggerEvent( @@ -96,10 +96,7 @@ function rowHelper(row) { return row.attr("title"); }, label() { - return row - .find(".name") - .text() - .trim(); + return row.find(".name").text().trim(); }, value() { const value = row.attr("data-value"); @@ -110,7 +107,7 @@ function rowHelper(row) { }, el() { return row; - } + }, }; } @@ -134,7 +131,7 @@ function headerHelper(header) { }, el() { return header; - } + }, }; } @@ -151,7 +148,7 @@ function filterHelper(filter) { }, el() { return filter; - } + }, }; } @@ -228,7 +225,7 @@ export default function selectKit(selector) { .map((_, row) => { return { name: row.getAttribute("data-name"), - id: row.getAttribute("data-value") + id: row.getAttribute("data-value"), }; }) .toArray(); @@ -280,15 +277,13 @@ export default function selectKit(selector) { async deselectItem(value) { await click( - find(selector) - .find(".select-kit-header") - .find(`[data-value=${value}]`) + find(selector).find(".select-kit-header").find(`[data-value=${value}]`) ); }, exists() { return exists(selector); - } + }, }; } @@ -303,23 +298,23 @@ export function testSelectKitModule(moduleName, options = {}) { afterEach() { options.afterEach && options.afterEach.call(this); - } + }, }); } export const DEFAULT_CONTENT = [ { id: 1, name: "foo" }, { id: 2, name: "bar" }, - { id: 3, name: "baz" } + { id: 3, name: "baz" }, ]; export function setDefaultState(ctx, value, options = {}) { const properties = Object.assign( { value, - onChange: v => { + onChange: (v) => { ctx.set("value", v); - } + }, }, options || {} ); diff --git a/test/javascripts/helpers/site-settings.js b/test/javascripts/helpers/site-settings.js index dd040c90663..4d2242cc880 100644 --- a/test/javascripts/helpers/site-settings.js +++ b/test/javascripts/helpers/site-settings.js @@ -97,7 +97,7 @@ const ORIGINAL_SETTINGS = { enable_mentions: true, enable_personal_messages: true, unicode_usernames: false, - secure_media: false + secure_media: false, }; let siteSettings = Object.assign({}, ORIGINAL_SETTINGS); diff --git a/test/javascripts/helpers/site.js b/test/javascripts/helpers/site.js index a1432aac5ec..fea6bab73b6 100644 --- a/test/javascripts/helpers/site.js +++ b/test/javascripts/helpers/site.js @@ -13,7 +13,7 @@ PreloadStore.store("site", { invited_to_private_message: 7, invitee_accepted: 8, posted: 9, - moved_post: 10 + moved_post: 10, }, post_types: { regular: 1, moderator_action: 2 }, groups: [ @@ -27,7 +27,7 @@ PreloadStore.store("site", { { id: 13, name: "trust_level_3" }, { id: 14, name: "trust_level_4" }, { id: 20, name: "ubuntu" }, - { id: 21, name: "test" } + { id: 21, name: "test" }, ], filters: ["latest", "unread", "new", "starred", "read", "posted"], periods: ["all", "yearly", "monthly", "weekly", "daily"], @@ -39,7 +39,7 @@ PreloadStore.store("site", { "read", "posted", "categories", - "top" + "top", ], anonymous_top_menu_items: ["latest", "categories", "top"], uncategorized_category_id: 17, @@ -56,7 +56,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-extensibility/28", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 7, @@ -70,7 +70,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-dev/1026", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 1, @@ -84,7 +84,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-bug/2", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 8, @@ -98,7 +98,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-hosting/2626", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 6, @@ -112,7 +112,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-support/389", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 2, @@ -126,7 +126,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-feature/11", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 13, @@ -140,7 +140,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-blog/5250", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 12, @@ -154,7 +154,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-discourse-hub/3038", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 11, @@ -168,7 +168,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-login/2828", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 3, @@ -182,7 +182,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-meta/24", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 10, @@ -196,7 +196,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-howto/2629", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 14, @@ -210,7 +210,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-marketplace/5425", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 17, @@ -223,7 +223,7 @@ PreloadStore.store("site", { topic_url: null, hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 9, @@ -237,7 +237,7 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-ux/2628", hotness: 5.0, read_restricted: false, - permission: null + permission: null, }, { id: 4, @@ -251,8 +251,8 @@ PreloadStore.store("site", { topic_url: "/t/category-definition-for-faq/25", hotness: 5.0, read_restricted: false, - permission: null - } + permission: null, + }, ], post_action_types: [ { @@ -263,7 +263,7 @@ PreloadStore.store("site", { is_flag: false, icon: null, id: 1, - is_custom_flag: false + is_custom_flag: false, }, { name_key: "like", @@ -273,7 +273,7 @@ PreloadStore.store("site", { is_flag: false, icon: "heart", id: 2, - is_custom_flag: false + is_custom_flag: false, }, { name_key: "off_topic", @@ -284,7 +284,7 @@ PreloadStore.store("site", { is_flag: true, icon: null, id: 3, - is_custom_flag: false + is_custom_flag: false, }, { name_key: "inappropriate", @@ -295,7 +295,7 @@ PreloadStore.store("site", { is_flag: true, icon: null, id: 4, - is_custom_flag: false + is_custom_flag: false, }, { name_key: "vote", @@ -305,7 +305,7 @@ PreloadStore.store("site", { is_flag: false, icon: null, id: 5, - is_custom_flag: false + is_custom_flag: false, }, { name_key: "spam", @@ -316,7 +316,7 @@ PreloadStore.store("site", { is_flag: true, icon: null, id: 8, - is_custom_flag: false + is_custom_flag: false, }, { name_key: "notify_user", @@ -327,7 +327,7 @@ PreloadStore.store("site", { is_flag: true, icon: null, id: 6, - is_custom_flag: true + is_custom_flag: true, }, { name_key: "notify_moderators", @@ -338,15 +338,15 @@ PreloadStore.store("site", { is_flag: true, icon: null, id: 7, - is_custom_flag: true - } + is_custom_flag: true, + }, ], trust_levels: [ { id: 0, name: "new user" }, { id: 1, name: "basic user" }, { id: 2, name: "member" }, { id: 3, name: "regular" }, - { id: 4, name: "leader" } + { id: 4, name: "leader" }, ], - archetypes: [{ id: "regular", name: "Regular Topic", options: [] }] + archetypes: [{ id: "regular", name: "Regular Topic", options: [] }], }); diff --git a/test/javascripts/helpers/store-pretender.js b/test/javascripts/helpers/store-pretender.js index 1579abaace5..033c0bb5c1d 100644 --- a/test/javascripts/helpers/store-pretender.js +++ b/test/javascripts/helpers/store-pretender.js @@ -1,77 +1,77 @@ const _widgets = [ { id: 123, name: "Trout Lure" }, - { id: 124, name: "Evil Repellant" } + { id: 124, name: "Evil Repellant" }, ]; const _moreWidgets = [ { id: 223, name: "Bass Lure" }, - { id: 224, name: "Good Repellant" } + { id: 224, name: "Good Repellant" }, ]; const fruits = [ { id: 1, name: "apple", farmer_id: 1, color_ids: [1, 2], category_id: 4 }, { id: 2, name: "banana", farmer_id: 1, color_ids: [3], category_id: 3 }, { id: 3, name: "grape", farmer_id: 2, color_ids: [2], category_id: 5 }, - { id: 4, name: "orange", farmer_id: null, color_ids: [2], category_id: 5 } + { id: 4, name: "orange", farmer_id: null, color_ids: [2], category_id: 5 }, ]; const farmers = [ { id: 1, name: "Old MacDonald" }, - { id: 2, name: "Luke Skywalker" } + { id: 2, name: "Luke Skywalker" }, ]; const colors = [ { id: 1, name: "Red" }, { id: 2, name: "Green" }, - { id: 3, name: "Yellow" } + { id: 3, name: "Yellow" }, ]; const cats = [ { cat_id: 1, - name: "souna" - } + name: "souna", + }, ]; -export default function(helpers) { +export default function (helpers) { const { response, success, parsePostData } = helpers; - this.get("/cats", function() { + this.get("/cats", function () { return response({ __rest_serializer: "1", - cats + cats, }); }); - this.get("/fruits/:id", function(request) { - const fruit = fruits.find(f => f.id === parseInt(request.params.id, 10)); + this.get("/fruits/:id", function (request) { + const fruit = fruits.find((f) => f.id === parseInt(request.params.id, 10)); return response({ __rest_serializer: "1", fruit, farmers, colors }); }); - this.get("/fruits", function() { + this.get("/fruits", function () { return response({ __rest_serializer: "1", fruits, farmers, colors, - extras: { hello: "world" } + extras: { hello: "world" }, }); }); - this.get("/barns/:id", function() { + this.get("/barns/:id", function () { return response({ __rest_serializer: "1", meta: { types: { - owner: "farmer" - } + owner: "farmer", + }, }, barn: { id: 1234, owner_id: farmers[0].id }, - farmers: [farmers[0]] + farmers: [farmers[0]], }); }); - this.get("/widgets/:widget_id", function(request) { + this.get("/widgets/:widget_id", function (request) { const w = _widgets.findBy("id", parseInt(request.params.widget_id, 10)); if (w) { return response({ widget: w, extras: { hello: "world" } }); @@ -80,23 +80,23 @@ export default function(helpers) { } }); - this.post("/widgets", function(request) { + this.post("/widgets", function (request) { const widget = parsePostData(request.requestBody).widget; widget.id = 100; return response(200, { widget }); }); - this.put("/widgets/:widget_id", function(request) { + this.put("/widgets/:widget_id", function (request) { const widget = parsePostData(request.requestBody).widget; return response({ widget }); }); - this.put("/cool_things/:cool_thing_id", function(request) { + this.put("/cool_things/:cool_thing_id", function (request) { const cool_thing = parsePostData(request.requestBody).cool_thing; return response({ cool_thing }); }); - this.get("/widgets", function(request) { + this.get("/widgets", function (request) { let result = _widgets; const qp = request.queryParams; @@ -114,16 +114,16 @@ export default function(helpers) { meta: { total_rows_widgets: 4, load_more_widgets: "/load-more-widgets", - refresh_widgets: "/widgets?refresh=true" - } + refresh_widgets: "/widgets?refresh=true", + }, }); }); - this.get("/load-more-widgets", function() { + this.get("/load-more-widgets", function () { return response({ widgets: _moreWidgets, total_rows_widgets: 4, - load_more_widgets: "/load-more-widgets" + load_more_widgets: "/load-more-widgets", }); }); diff --git a/test/javascripts/initializers/localization-test.js b/test/javascripts/initializers/localization-test.js index 40de7c5c8f5..0df80f57dd3 100644 --- a/test/javascripts/initializers/localization-test.js +++ b/test/javascripts/initializers/localization-test.js @@ -13,19 +13,19 @@ QUnit.module("initializer:localization", { fr: { js: { composer: { - reply: "Répondre" - } - } + reply: "Répondre", + }, + }, }, en: { js: { topic: { reply: { - help: "begin composing a reply to this topic" - } - } - } - } + help: "begin composing a reply to this topic", + }, + }, + }, + }, }; }, @@ -33,13 +33,13 @@ QUnit.module("initializer:localization", { I18n.locale = this._locale; I18n.translations = this._translations; I18n._overrides = this._overrides; - } + }, }); -QUnit.test("translation overrides", function(assert) { +QUnit.test("translation overrides", function (assert) { I18n._overrides = { "js.composer.reply": "WAT", - "js.topic.reply.help": "foobar" + "js.topic.reply.help": "foobar", }; LocalizationInitializer.initialize(this.registry); @@ -57,10 +57,10 @@ QUnit.test("translation overrides", function(assert) { QUnit.test( "skip translation override if parent node is not an object", - function(assert) { + function (assert) { I18n._overrides = { "js.composer.reply": "WAT", - "js.composer.reply.help": "foobar" + "js.composer.reply.help": "foobar", }; LocalizationInitializer.initialize(this.registry); diff --git a/test/javascripts/lib/bbcode-test.js b/test/javascripts/lib/bbcode-test.js index 2bac57057c4..f8b72253355 100644 --- a/test/javascripts/lib/bbcode-test.js +++ b/test/javascripts/lib/bbcode-test.js @@ -2,7 +2,7 @@ import { parseBBCodeTag } from "pretty-text/engines/discourse-markdown/bbcode-bl QUnit.module("lib:pretty-text:bbcode"); -QUnit.test("block with multiple quoted attributes", assert => { +QUnit.test("block with multiple quoted attributes", (assert) => { const parsed = parseBBCodeTag('[test one="foo" two="bar bar"]', 0, 30); assert.equal(parsed.tag, "test"); diff --git a/test/javascripts/lib/bookmark-test.js b/test/javascripts/lib/bookmark-test.js index c863c8884f1..2670248c025 100644 --- a/test/javascripts/lib/bookmark-test.js +++ b/test/javascripts/lib/bookmark-test.js @@ -8,12 +8,12 @@ QUnit.module("lib:bookmark", { afterEach() { sandbox.restore(); - } + }, }); QUnit.test( "formattedReminderTime works when the reminder time is tomorrow", - assert => { + (assert) => { let reminderAt = "2020-04-12 09:45:00"; let reminderAtDate = moment .tz(reminderAt, "Australia/Brisbane") @@ -27,7 +27,7 @@ QUnit.test( QUnit.test( "formattedReminderTime works when the reminder time is today", - assert => { + (assert) => { let reminderAt = "2020-04-11 09:45:00"; let reminderAtDate = moment .tz(reminderAt, "Australia/Brisbane") @@ -41,7 +41,7 @@ QUnit.test( QUnit.test( "formattedReminderTime works when the reminder time is in the future", - assert => { + (assert) => { let reminderAt = "2020-04-15 09:45:00"; let reminderAtDate = moment .tz(reminderAt, "Australia/Brisbane") diff --git a/test/javascripts/lib/break-string-test.js b/test/javascripts/lib/break-string-test.js index e46a7f12519..32bd03fb28d 100644 --- a/test/javascripts/lib/break-string-test.js +++ b/test/javascripts/lib/break-string-test.js @@ -2,8 +2,8 @@ QUnit.module("lib:breakString", {}); -QUnit.test("breakString", assert => { - var b = function(s, hint) { +QUnit.test("breakString", (assert) => { + var b = function (s, hint) { return new BreakString(s).break(hint); }; diff --git a/test/javascripts/lib/category-badge-test.js b/test/javascripts/lib/category-badge-test.js index 21f2956d935..35dd2318501 100644 --- a/test/javascripts/lib/category-badge-test.js +++ b/test/javascripts/lib/category-badge-test.js @@ -6,18 +6,18 @@ discourseModule("lib:category-link"); import { categoryBadgeHTML } from "discourse/helpers/category-link"; -QUnit.test("categoryBadge without a category", assert => { +QUnit.test("categoryBadge without a category", (assert) => { assert.blank(categoryBadgeHTML(), "it returns no HTML"); }); -QUnit.test("Regular categoryBadge", assert => { +QUnit.test("Regular categoryBadge", (assert) => { const store = createStore(); const category = store.createRecord("category", { name: "hello", id: 123, description_text: "cool description", color: "ff0", - text_color: "f00" + text_color: "f00", }); const tag = $.parseHTML(categoryBadgeHTML(category))[0]; @@ -37,7 +37,7 @@ QUnit.test("Regular categoryBadge", assert => { ); }); -QUnit.test("undefined color", assert => { +QUnit.test("undefined color", (assert) => { const store = createStore(); const noColor = store.createRecord("category", { name: "hello", id: 123 }); const tag = $.parseHTML(categoryBadgeHTML(noColor))[0]; @@ -48,7 +48,7 @@ QUnit.test("undefined color", assert => { ); }); -QUnit.test("topic count", assert => { +QUnit.test("topic count", (assert) => { const store = createStore(); const category = store.createRecord("category", { name: "hello", id: 123 }); @@ -63,11 +63,11 @@ QUnit.test("topic count", assert => { ); }); -QUnit.test("allowUncategorized", assert => { +QUnit.test("allowUncategorized", (assert) => { const store = createStore(); const uncategorized = store.createRecord("category", { name: "uncategorized", - id: 345 + id: 345, }); sandbox @@ -85,7 +85,7 @@ QUnit.test("allowUncategorized", assert => { ); }); -QUnit.test("category names are wrapped in dir-spans", function(assert) { +QUnit.test("category names are wrapped in dir-spans", function (assert) { this.siteSettings.support_mixed_text_direction = true; const store = createStore(); const rtlCategory = store.createRecord("category", { @@ -93,12 +93,12 @@ QUnit.test("category names are wrapped in dir-spans", function(assert) { id: 123, description_text: "cool description", color: "ff0", - text_color: "f00" + text_color: "f00", }); const ltrCategory = store.createRecord("category", { name: "Programming in Ruby", - id: 234 + id: 234, }); let tag = $.parseHTML(categoryBadgeHTML(rtlCategory))[0]; @@ -110,24 +110,24 @@ QUnit.test("category names are wrapped in dir-spans", function(assert) { assert.equal(dirSpan.dir, "ltr"); }); -QUnit.test("recursive", function(assert) { +QUnit.test("recursive", function (assert) { const store = createStore(); const foo = store.createRecord("category", { name: "foo", - id: 1 + id: 1, }); const bar = store.createRecord("category", { name: "bar", id: 2, - parent_category_id: foo.id + parent_category_id: foo.id, }); const baz = store.createRecord("category", { name: "baz", id: 3, - parent_category_id: bar.id + parent_category_id: bar.id, }); this.siteSettings.max_category_nesting = 0; diff --git a/test/javascripts/lib/click-track-edit-history-test.js b/test/javascripts/lib/click-track-edit-history-test.js index f38f4c9fe1f..c0e10fabbd8 100644 --- a/test/javascripts/lib/click-track-edit-history-test.js +++ b/test/javascripts/lib/click-track-edit-history-test.js @@ -8,7 +8,7 @@ QUnit.module("lib:click-track-edit-history", { beforeEach() { logIn(); - let win = { focus: function() {} }; + let win = { focus: function () {} }; sandbox.stub(window, "open").returns(win); sandbox.stub(win, "focus"); @@ -49,7 +49,7 @@ QUnit.module("lib:click-track-edit-history", { ` ); - } + }, }); var track = ClickTrack.trackClick; @@ -58,12 +58,12 @@ function generateClickEventOn(selector) { return $.Event("click", { currentTarget: fixture(selector).first() }); } -QUnit.skip("tracks internal URLs", async assert => { +QUnit.skip("tracks internal URLs", async (assert) => { assert.expect(2); sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com"); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.equal( request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337" @@ -74,11 +74,11 @@ QUnit.skip("tracks internal URLs", async assert => { assert.notOk(track(generateClickEventOn("#same-site"))); }); -QUnit.skip("tracks external URLs", async assert => { +QUnit.skip("tracks external URLs", async (assert) => { assert.expect(2); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.equal( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" @@ -91,12 +91,12 @@ QUnit.skip("tracks external URLs", async assert => { QUnit.skip( "tracks external URLs when opening in another window", - async assert => { + async (assert) => { assert.expect(3); User.currentProp("external_links_in_new_tab", true); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.equal( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" diff --git a/test/javascripts/lib/click-track-profile-page-test.js b/test/javascripts/lib/click-track-profile-page-test.js index d46027a9d23..84c0c437cdb 100644 --- a/test/javascripts/lib/click-track-profile-page-test.js +++ b/test/javascripts/lib/click-track-profile-page-test.js @@ -7,7 +7,7 @@ QUnit.module("lib:click-track-profile-page", { beforeEach() { logIn(); - let win = { focus: function() {} }; + let win = { focus: function () {} }; sandbox.stub(window, "open").returns(win); sandbox.stub(win, "focus"); @@ -42,7 +42,7 @@ QUnit.module("lib:click-track-profile-page", { #hashtag

` ); - } + }, }); var track = ClickTrack.trackClick; @@ -51,12 +51,12 @@ function generateClickEventOn(selector) { return $.Event("click", { currentTarget: fixture(selector).first() }); } -QUnit.skip("tracks internal URLs", async assert => { +QUnit.skip("tracks internal URLs", async (assert) => { assert.expect(2); sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com"); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.equal(request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com"); done(); }); @@ -64,11 +64,11 @@ QUnit.skip("tracks internal URLs", async assert => { assert.notOk(track(generateClickEventOn("#same-site"))); }); -QUnit.skip("tracks external URLs", async assert => { +QUnit.skip("tracks external URLs", async (assert) => { assert.expect(2); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.equal( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" @@ -79,11 +79,11 @@ QUnit.skip("tracks external URLs", async assert => { assert.notOk(track(generateClickEventOn("a"))); }); -QUnit.skip("tracks external URLs in other posts", async assert => { +QUnit.skip("tracks external URLs in other posts", async (assert) => { assert.expect(2); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.equal( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331" diff --git a/test/javascripts/lib/click-track-test.js b/test/javascripts/lib/click-track-test.js index 15693bc3b64..55d29ee425f 100644 --- a/test/javascripts/lib/click-track-test.js +++ b/test/javascripts/lib/click-track-test.js @@ -9,7 +9,7 @@ QUnit.module("lib:click-track", { beforeEach() { logIn(); - let win = { focus: function() {} }; + let win = { focus: function () {} }; sandbox.stub(window, "open").returns(win); sandbox.stub(win, "focus"); @@ -42,7 +42,7 @@ QUnit.module("lib:click-track", { ` ); - } + }, }); var track = ClickTrack.trackClick; @@ -51,12 +51,12 @@ function generateClickEventOn(selector) { return $.Event("click", { currentTarget: fixture(selector).first() }); } -QUnit.skip("tracks internal URLs", async assert => { +QUnit.skip("tracks internal URLs", async (assert) => { assert.expect(2); sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com"); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.ok( request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337" @@ -67,11 +67,11 @@ QUnit.skip("tracks internal URLs", async assert => { assert.notOk(track(generateClickEventOn("#same-site"))); }); -QUnit.test("does not track elements with no href", async assert => { +QUnit.test("does not track elements with no href", async (assert) => { assert.ok(track(generateClickEventOn(".a-without-href"))); }); -QUnit.test("does not track attachments", async assert => { +QUnit.test("does not track attachments", async (assert) => { sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com"); pretender.post("/clicks/track", () => assert.ok(false)); @@ -84,11 +84,11 @@ QUnit.test("does not track attachments", async assert => { ); }); -QUnit.skip("tracks external URLs", async assert => { +QUnit.skip("tracks external URLs", async (assert) => { assert.expect(2); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.ok( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" @@ -101,12 +101,12 @@ QUnit.skip("tracks external URLs", async assert => { QUnit.skip( "tracks external URLs when opening in another window", - async assert => { + async (assert) => { assert.expect(3); User.currentProp("external_links_in_new_tab", true); const done = assert.async(); - pretender.post("/clicks/track", request => { + pretender.post("/clicks/track", (request) => { assert.ok( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" @@ -119,52 +119,55 @@ QUnit.skip( } ); -QUnit.test("does not track clicks on lightboxes", async assert => { +QUnit.test("does not track clicks on lightboxes", async (assert) => { assert.notOk(track(generateClickEventOn(".lightbox"))); }); -QUnit.test("does not track clicks when forcibly disabled", async assert => { +QUnit.test("does not track clicks when forcibly disabled", async (assert) => { assert.notOk(track(generateClickEventOn(".no-track-link"))); }); -QUnit.test("does not track clicks on back buttons", async assert => { +QUnit.test("does not track clicks on back buttons", async (assert) => { assert.notOk(track(generateClickEventOn(".back"))); }); -QUnit.test("does not track right clicks inside quotes", async assert => { +QUnit.test("does not track right clicks inside quotes", async (assert) => { const event = generateClickEventOn(".quote a:first-child"); event.which = 3; assert.ok(track(event)); }); -QUnit.test("does not track clicks links in quotes", async assert => { +QUnit.test("does not track clicks links in quotes", async (assert) => { User.currentProp("external_links_in_new_tab", true); assert.notOk(track(generateClickEventOn(".quote a:last-child"))); assert.ok(window.open.calledWith("https://google.com/", "_blank")); }); -QUnit.test("does not track clicks on category badges", async assert => { +QUnit.test("does not track clicks on category badges", async (assert) => { assert.notOk(track(generateClickEventOn(".hashtag"))); }); -QUnit.test("does not track clicks on mailto", async assert => { +QUnit.test("does not track clicks on mailto", async (assert) => { assert.ok(track(generateClickEventOn(".mailto"))); }); -QUnit.test("removes the href and put it as a data attribute", async assert => { - User.currentProp("external_links_in_new_tab", true); +QUnit.test( + "removes the href and put it as a data attribute", + async (assert) => { + User.currentProp("external_links_in_new_tab", true); - assert.notOk(track(generateClickEventOn("a"))); + assert.notOk(track(generateClickEventOn("a"))); - var $link = fixture("a").first(); - assert.ok($link.hasClass("no-href")); - assert.equal($link.data("href"), "http://www.google.com/"); - assert.blank($link.attr("href")); - assert.ok($link.data("auto-route")); - assert.ok(window.open.calledWith("http://www.google.com/", "_blank")); -}); + var $link = fixture("a").first(); + assert.ok($link.hasClass("no-href")); + assert.equal($link.data("href"), "http://www.google.com/"); + assert.blank($link.attr("href")); + assert.ok($link.data("auto-route")); + assert.ok(window.open.calledWith("http://www.google.com/", "_blank")); + } +); -QUnit.test("restores the href after a while", async assert => { +QUnit.test("restores the href after a while", async (assert) => { assert.expect(2); assert.notOk(track(generateClickEventOn("a"))); @@ -184,30 +187,24 @@ function badgeClickCount(assert, id, expected) { assert.equal(parseInt($badge.html(), 10), expected); } -QUnit.test("does not update badge clicks on my own link", async assert => { - sandbox - .stub(User, "currentProp") - .withArgs("id") - .returns(314); +QUnit.test("does not update badge clicks on my own link", async (assert) => { + sandbox.stub(User, "currentProp").withArgs("id").returns(314); badgeClickCount(assert, "with-badge", 1); }); -QUnit.test("does not update badge clicks in my own post", async assert => { - sandbox - .stub(User, "currentProp") - .withArgs("id") - .returns(3141); +QUnit.test("does not update badge clicks in my own post", async (assert) => { + sandbox.stub(User, "currentProp").withArgs("id").returns(3141); badgeClickCount(assert, "with-badge-but-not-mine", 1); }); -QUnit.test("updates badge counts correctly", async assert => { +QUnit.test("updates badge counts correctly", async (assert) => { badgeClickCount(assert, "inside-onebox", 1); badgeClickCount(assert, "inside-onebox-forced", 2); badgeClickCount(assert, "with-badge", 2); }); function testOpenInANewTab(description, clickEventModifier) { - QUnit.test(description, async assert => { + QUnit.test(description, async (assert) => { var clickEvent = generateClickEventOn("a"); clickEventModifier(clickEvent); assert.ok(track(clickEvent)); @@ -215,18 +212,18 @@ function testOpenInANewTab(description, clickEventModifier) { }); } -testOpenInANewTab("it opens in a new tab when pressing shift", clickEvent => { +testOpenInANewTab("it opens in a new tab when pressing shift", (clickEvent) => { clickEvent.shiftKey = true; }); -testOpenInANewTab("it opens in a new tab when pressing meta", clickEvent => { +testOpenInANewTab("it opens in a new tab when pressing meta", (clickEvent) => { clickEvent.metaKey = true; }); -testOpenInANewTab("it opens in a new tab when pressing ctrl", clickEvent => { +testOpenInANewTab("it opens in a new tab when pressing ctrl", (clickEvent) => { clickEvent.ctrlKey = true; }); -testOpenInANewTab("it opens in a new tab on middle click", clickEvent => { +testOpenInANewTab("it opens in a new tab on middle click", (clickEvent) => { clickEvent.button = 2; }); diff --git a/test/javascripts/lib/computed-test.js b/test/javascripts/lib/computed-test.js index 60aee875b64..6bb386fdba3 100644 --- a/test/javascripts/lib/computed-test.js +++ b/test/javascripts/lib/computed-test.js @@ -7,28 +7,28 @@ import { fmt, i18n, url, - htmlSafe + htmlSafe, } from "discourse/lib/computed"; import { setPrefix } from "discourse-common/lib/get-url"; import { discourseModule } from "helpers/qunit-helpers"; discourseModule("lib:computed", { beforeEach() { - sandbox.stub(I18n, "t").callsFake(function(scope) { + sandbox.stub(I18n, "t").callsFake(function (scope) { return "%@ translated: " + scope; }); }, afterEach() { I18n.t.restore(); - } + }, }); -QUnit.test("setting", function(assert) { +QUnit.test("setting", function (assert) { let t = EmberObject.extend({ siteSettings: this.siteSettings, vehicle: setting("vehicle"), - missingProp: setting("madeUpThing") + missingProp: setting("madeUpThing"), }).create(); this.siteSettings.vehicle = "airplane"; @@ -43,12 +43,12 @@ QUnit.test("setting", function(assert) { ); }); -QUnit.test("propertyEqual", assert => { +QUnit.test("propertyEqual", (assert) => { var t = EmberObject.extend({ - same: propertyEqual("cookies", "biscuits") + same: propertyEqual("cookies", "biscuits"), }).create({ cookies: 10, - biscuits: 10 + biscuits: 10, }); assert.ok(t.get("same"), "it is true when the properties are the same"); @@ -56,12 +56,12 @@ QUnit.test("propertyEqual", assert => { assert.ok(!t.get("same"), "it isn't true when one property is different"); }); -QUnit.test("propertyNotEqual", assert => { +QUnit.test("propertyNotEqual", (assert) => { var t = EmberObject.extend({ - diff: propertyNotEqual("cookies", "biscuits") + diff: propertyNotEqual("cookies", "biscuits"), }).create({ cookies: 10, - biscuits: 10 + biscuits: 10, }); assert.ok(!t.get("diff"), "it isn't true when the properties are the same"); @@ -69,13 +69,13 @@ QUnit.test("propertyNotEqual", assert => { assert.ok(t.get("diff"), "it is true when one property is different"); }); -QUnit.test("fmt", assert => { +QUnit.test("fmt", (assert) => { var t = EmberObject.extend({ exclaimyUsername: fmt("username", "!!! %@ !!!"), - multiple: fmt("username", "mood", "%@ is %@") + multiple: fmt("username", "mood", "%@ is %@"), }).create({ username: "eviltrout", - mood: "happy" + mood: "happy", }); assert.equal( @@ -103,13 +103,13 @@ QUnit.test("fmt", assert => { ); }); -QUnit.test("i18n", assert => { +QUnit.test("i18n", (assert) => { var t = EmberObject.extend({ exclaimyUsername: i18n("username", "!!! %@ !!!"), - multiple: i18n("username", "mood", "%@ is %@") + multiple: i18n("username", "mood", "%@ is %@"), }).create({ username: "eviltrout", - mood: "happy" + mood: "happy", }); assert.equal( @@ -137,11 +137,11 @@ QUnit.test("i18n", assert => { ); }); -QUnit.test("url", assert => { +QUnit.test("url", (assert) => { var t, testClass; testClass = EmberObject.extend({ - userUrl: url("username", "/u/%@") + userUrl: url("username", "/u/%@"), }); t = testClass.create({ username: "eviltrout" }); @@ -160,10 +160,10 @@ QUnit.test("url", assert => { ); }); -QUnit.test("htmlSafe", assert => { +QUnit.test("htmlSafe", (assert) => { const cookies = "

cookies and biscuits

"; const t = EmberObject.extend({ - desc: htmlSafe("cookies") + desc: htmlSafe("cookies"), }).create({ cookies }); assert.equal(t.get("desc").string, cookies); diff --git a/test/javascripts/lib/emoji-store-test.js b/test/javascripts/lib/emoji-store-test.js index 14d104898be..8068b2b5063 100644 --- a/test/javascripts/lib/emoji-store-test.js +++ b/test/javascripts/lib/emoji-store-test.js @@ -7,25 +7,25 @@ discourseModule("lib:emoji-emojiStore", { }, afterEach() { this.emojiStore.reset(); - } + }, }); -QUnit.test("defaults", function(assert) { +QUnit.test("defaults", function (assert) { assert.deepEqual(this.emojiStore.favorites, []); assert.equal(this.emojiStore.diversity, 1); }); -QUnit.test("diversity", function(assert) { +QUnit.test("diversity", function (assert) { this.emojiStore.diversity = 2; assert.equal(this.emojiStore.diversity, 2); }); -QUnit.test("favorites", function(assert) { +QUnit.test("favorites", function (assert) { this.emojiStore.favorites = ["smile"]; assert.deepEqual(this.emojiStore.favorites, ["smile"]); }); -QUnit.test("track", function(assert) { +QUnit.test("track", function (assert) { this.emojiStore.track("woman:t4"); assert.deepEqual(this.emojiStore.favorites, ["woman:t4"]); this.emojiStore.track("otter"); diff --git a/test/javascripts/lib/emoji-test.js b/test/javascripts/lib/emoji-test.js index 793d724b3c6..3a3fed402bf 100644 --- a/test/javascripts/lib/emoji-test.js +++ b/test/javascripts/lib/emoji-test.js @@ -5,7 +5,7 @@ import { discourseModule } from "helpers/qunit-helpers"; discourseModule("lib:emoji"); -QUnit.test("emojiUnescape", function(assert) { +QUnit.test("emojiUnescape", function (assert) { const testUnescape = (input, expected, description, settings = {}) => { const originalSettings = {}; for (const [key, value] of Object.entries(settings)) { @@ -103,7 +103,7 @@ QUnit.test("emojiUnescape", function(assert) { "Hello😊World", "keeps Unicode emoji when inline translation disabled", { - enable_inline_emoji_translation: false + enable_inline_emoji_translation: false, } ); testUnescape( @@ -111,7 +111,7 @@ QUnit.test("emojiUnescape", function(assert) { `HelloblushWorld`, "emoji from Unicode emoji when inline translation enabled", { - enable_inline_emoji_translation: true + enable_inline_emoji_translation: true, } ); testUnescape( @@ -119,7 +119,7 @@ QUnit.test("emojiUnescape", function(assert) { "hi:smile:", "no emojis when inline translation disabled", { - enable_inline_emoji_translation: false + enable_inline_emoji_translation: false, } ); testUnescape( @@ -130,7 +130,7 @@ QUnit.test("emojiUnescape", function(assert) { ); }); -QUnit.test("Emoji search", assert => { +QUnit.test("Emoji search", (assert) => { // able to find an alias assert.equal(emojiSearch("+1").length, 1); diff --git a/test/javascripts/lib/formatter-test.js b/test/javascripts/lib/formatter-test.js index 75e58e779fe..14becfdcf6c 100644 --- a/test/javascripts/lib/formatter-test.js +++ b/test/javascripts/lib/formatter-test.js @@ -4,7 +4,7 @@ import { updateRelativeAge, number, longDate, - durationTiny + durationTiny, } from "discourse/lib/formatter"; import { discourseModule } from "helpers/qunit-helpers"; @@ -15,14 +15,14 @@ discourseModule("lib:formatter", { afterEach() { this.clock.restore(); - } + }, }); function formatMins(mins, opts = {}) { let dt = new Date(new Date() - mins * 60 * 1000); return relativeAge(dt, { format: opts.format || "tiny", - leaveAgo: opts.leaveAgo + leaveAgo: opts.leaveAgo, }); } @@ -35,16 +35,12 @@ function formatDays(days, opts) { } function shortDate(days) { - return moment() - .subtract(days, "days") - .format("MMM D"); + return moment().subtract(days, "days").format("MMM D"); } function shortDateTester(format) { - return function(days) { - return moment() - .subtract(days, "days") - .format(format); + return function (days) { + return moment().subtract(days, "days").format(format); }; } @@ -52,7 +48,7 @@ function strip(html) { return $(html).text(); } -QUnit.test("formating medium length dates", function(assert) { +QUnit.test("formating medium length dates", function (assert) { let shortDateYear = shortDateTester("MMM D, 'YY"); assert.equal( @@ -123,7 +119,7 @@ QUnit.test("formating medium length dates", function(assert) { assert.equal(strip(formatDays(10, { format: "medium" })), shortDateYear(10)); }); -QUnit.test("formating tiny dates", function(assert) { +QUnit.test("formating tiny dates", function (assert) { let shortDateYear = shortDateTester("MMM 'YY"); assert.equal(formatMins(0), "1m"); @@ -186,10 +182,8 @@ QUnit.test("formating tiny dates", function(assert) { this.siteSettings.relative_date_duration = originalValue; }); -QUnit.test("autoUpdatingRelativeAge", function(assert) { - var d = moment() - .subtract(1, "day") - .toDate(); +QUnit.test("autoUpdatingRelativeAge", function (assert) { + var d = moment().subtract(1, "day").toDate(); var $elem = $(autoUpdatingRelativeAge(d)); assert.equal($elem.data("format"), "tiny"); @@ -203,7 +197,7 @@ QUnit.test("autoUpdatingRelativeAge", function(assert) { autoUpdatingRelativeAge(d, { format: "medium", title: true, - leaveAgo: true + leaveAgo: true, }) ); assert.equal($elem.data("format"), "medium-with-ago"); @@ -218,7 +212,7 @@ QUnit.test("autoUpdatingRelativeAge", function(assert) { assert.equal($elem.html(), "1 day"); }); -QUnit.test("updateRelativeAge", function(assert) { +QUnit.test("updateRelativeAge", function (assert) { var d = new Date(); var $elem = $(autoUpdatingRelativeAge(d)); $elem.data("time", d.getTime() - 2 * 60 * 1000); @@ -236,7 +230,7 @@ QUnit.test("updateRelativeAge", function(assert) { assert.equal($elem.html(), "2 mins ago"); }); -QUnit.test("number", function(assert) { +QUnit.test("number", function (assert) { assert.equal(number(123), "123", "it returns a string version of the number"); assert.equal(number("123"), "123", "it works with a string command"); assert.equal(number(NaN), "0", "it returns 0 for NaN"); @@ -267,7 +261,7 @@ QUnit.test("number", function(assert) { ); }); -QUnit.test("durationTiny", function(assert) { +QUnit.test("durationTiny", function (assert) { assert.equal(durationTiny(), "—", "undefined is a dash"); assert.equal(durationTiny(null), "—", "null is a dash"); assert.equal(durationTiny(0), "< 1m", "0 seconds shows as < 1m"); diff --git a/test/javascripts/lib/get-url-test.js b/test/javascripts/lib/get-url-test.js index 1d889242109..d11ee283e2f 100644 --- a/test/javascripts/lib/get-url-test.js +++ b/test/javascripts/lib/get-url-test.js @@ -6,24 +6,24 @@ import { isAbsoluteURL, getAbsoluteURL, setPrefix, - withoutPrefix + withoutPrefix, } from "discourse-common/lib/get-url"; QUnit.module("lib:get-url"); -QUnit.test("isAbsoluteURL", assert => { +QUnit.test("isAbsoluteURL", (assert) => { setupURL(null, "https://example.com", "/forum"); assert.ok(isAbsoluteURL("https://example.com/test/thing")); assert.ok(!isAbsoluteURL("http://example.com/test/thing")); assert.ok(!isAbsoluteURL("https://discourse.org/test/thing")); }); -QUnit.test("getAbsoluteURL", assert => { +QUnit.test("getAbsoluteURL", (assert) => { setupURL(null, "https://example.com", "/forum"); assert.equal(getAbsoluteURL("/cool/path"), "https://example.com/cool/path"); }); -QUnit.test("withoutPrefix", assert => { +QUnit.test("withoutPrefix", (assert) => { setPrefix("/eviltrout"); assert.equal(withoutPrefix("/eviltrout/hello"), "/hello"); assert.equal(withoutPrefix("/eviltrout/"), "/"); @@ -40,7 +40,7 @@ QUnit.test("withoutPrefix", assert => { assert.equal(withoutPrefix("/"), "/"); }); -QUnit.test("getURL with empty paths", assert => { +QUnit.test("getURL with empty paths", (assert) => { setupURL(null, "https://example.com", "/"); assert.equal(getURL("/"), "/"); assert.equal(getURL(""), ""); @@ -52,7 +52,7 @@ QUnit.test("getURL with empty paths", assert => { assert.equal(getURL(""), ""); }); -QUnit.test("getURL on subfolder install", assert => { +QUnit.test("getURL on subfolder install", (assert) => { setupURL(null, "", "/forum"); assert.equal(getURL("/"), "/forum/", "root url has subfolder"); assert.equal( @@ -80,7 +80,7 @@ QUnit.test("getURL on subfolder install", assert => { ); }); -QUnit.test("getURLWithCDN on subfolder install with S3", assert => { +QUnit.test("getURLWithCDN on subfolder install with S3", (assert) => { setupURL(null, "", "/forum"); setupS3CDN( "//test.s3-us-west-1.amazonaws.com/site", diff --git a/test/javascripts/lib/highlight-search-test.js.es6 b/test/javascripts/lib/highlight-search-test.js.es6 index fcbc9f4fa42..47c1ab3ed6b 100644 --- a/test/javascripts/lib/highlight-search-test.js.es6 +++ b/test/javascripts/lib/highlight-search-test.js.es6 @@ -3,7 +3,7 @@ import { fixture } from "helpers/qunit-helpers"; QUnit.module("lib:highlight-search"); -QUnit.test("highlighting text", assert => { +QUnit.test("highlighting text", (assert) => { fixture().html( `

This is some text to highlight

@@ -25,7 +25,7 @@ QUnit.test("highlighting text", assert => { ); }); -QUnit.test("highlighting unicode text", assert => { +QUnit.test("highlighting unicode text", (assert) => { fixture().html( `

This is some தமிழ் & русский text to highlight

diff --git a/test/javascripts/lib/i18n-test.js b/test/javascripts/lib/i18n-test.js index 78c26ccddd1..351bbb16f8e 100644 --- a/test/javascripts/lib/i18n-test.js +++ b/test/javascripts/lib/i18n-test.js @@ -14,21 +14,21 @@ QUnit.module("lib:i18n", { js: { topic: { reply: { - title: "Foo" - } - } - } + title: "Foo", + }, + }, + }, }, fr: { js: { hello: "Bonjour", topic: { reply: { - title: "Répondre" + title: "Répondre", }, share: { - title: "Partager" - } + title: "Partager", + }, }, character_count: { zero: "{{count}} ZERO", @@ -36,40 +36,40 @@ QUnit.module("lib:i18n", { two: "{{count}} TWO", few: "{{count}} FEW", many: "{{count}} MANY", - other: "{{count}} OTHER" + other: "{{count}} OTHER", }, days: { - other: "%{count} jours" - } - } + other: "%{count} jours", + }, + }, }, en: { js: { hello: { world: "Hello World!", - universe: "" + universe: "", }, topic: { reply: { - help: "begin composing a reply to this topic" - } + help: "begin composing a reply to this topic", + }, }, word_count: { one: "1 word", - other: "{{count}} words" + other: "{{count}} words", }, days: { one: "%{count} day", - other: "%{count} days" + other: "%{count} days", }, - dollar_sign: "Hi {{description}}" - } - } + dollar_sign: "Hi {{description}}", + }, + }, }; // fake pluralization rules I18n.pluralizationRules = Object.assign({}, I18n.pluralizationRules); - I18n.pluralizationRules.fr = function(n) { + I18n.pluralizationRules.fr = function (n) { if (n === 0) return "zero"; if (n === 1) return "one"; if (n === 2) return "two"; @@ -85,15 +85,15 @@ QUnit.module("lib:i18n", { I18n.translations = this._translations; I18n.extras = this._extras; I18n.pluralizationRules = this._pluralizationRules; - } + }, }); -QUnit.test("defaults", assert => { +QUnit.test("defaults", (assert) => { assert.equal(I18n.defaultLocale, "en", "it has English as default locale"); assert.ok(I18n.pluralizationRules["en"], "it has English pluralizer"); }); -QUnit.test("translations", assert => { +QUnit.test("translations", (assert) => { assert.equal( I18n.t("topic.reply.title"), "Répondre", @@ -112,7 +112,7 @@ QUnit.test("translations", assert => { assert.equal(I18n.t("hello.universe"), "", "allows empty strings"); }); -QUnit.test("extra translations", assert => { +QUnit.test("extra translations", (assert) => { I18n.locale = "pl_PL"; I18n.extras = { en: { @@ -121,23 +121,23 @@ QUnit.test("extra translations", assert => { title: "Dashboard", backup_count: { one: "%{count} backup", - other: "%{count} backups" - } + other: "%{count} backups", + }, }, web_hooks: { events: { incoming: { one: "There is a new event.", - other: "There are %{count} new events." - } - } - } - } + other: "There are %{count} new events.", + }, + }, + }, + }, }, pl_PL: { admin: { dashboard: { - title: "Raporty" + title: "Raporty", }, web_hooks: { events: { @@ -145,14 +145,14 @@ QUnit.test("extra translations", assert => { one: "Istnieje nowe wydarzenie", few: "Istnieją %{count} nowe wydarzenia.", many: "Istnieje %{count} nowych wydarzeń.", - other: "Istnieje %{count} nowych wydarzeń." - } - } - } - } - } + other: "Istnieje %{count} nowych wydarzeń.", + }, + }, + }, + }, + }, }; - I18n.pluralizationRules.pl_PL = function(n) { + I18n.pluralizationRules.pl_PL = function (n) { if (n === 1) return "one"; if (n % 10 >= 2 && n % 10 <= 4) return "few"; if (n % 10 === 0) return "many"; @@ -178,7 +178,7 @@ QUnit.test("extra translations", assert => { ); }); -QUnit.test("pluralizations", assert => { +QUnit.test("pluralizations", (assert) => { assert.equal(I18n.t("character_count", { count: 0 }), "0 ZERO"); assert.equal(I18n.t("character_count", { count: 1 }), "1 ONE"); assert.equal(I18n.t("character_count", { count: 2 }), "2 TWO"); @@ -194,7 +194,7 @@ QUnit.test("pluralizations", assert => { assert.equal(I18n.t("word_count", { count: 100 }), "100 words"); }); -QUnit.test("fallback", assert => { +QUnit.test("fallback", (assert) => { assert.equal( I18n.t("days", { count: 1 }), "1 day", @@ -226,10 +226,10 @@ QUnit.test("fallback", assert => { ); }); -QUnit.test("Dollar signs are properly escaped", assert => { +QUnit.test("Dollar signs are properly escaped", (assert) => { assert.equal( I18n.t("dollar_sign", { - description: "$& $&" + description: "$& $&", }), "Hi $& $&" ); diff --git a/test/javascripts/lib/icon-library-test.js b/test/javascripts/lib/icon-library-test.js index cf59cb70374..fbfae424e7b 100644 --- a/test/javascripts/lib/icon-library-test.js +++ b/test/javascripts/lib/icon-library-test.js @@ -1,12 +1,12 @@ import { iconHTML, iconNode, - convertIconClass + convertIconClass, } from "discourse-common/lib/icon-library"; QUnit.module("lib:icon-library"); -QUnit.test("return icon markup", assert => { +QUnit.test("return icon markup", (assert) => { assert.ok(iconHTML("bars").indexOf('use xlink:href="#bars"') > -1); const nodeIcon = iconNode("bars"); @@ -17,7 +17,7 @@ QUnit.test("return icon markup", assert => { ); }); -QUnit.test("convert icon names", assert => { +QUnit.test("convert icon names", (assert) => { const fa5Icon = convertIconClass("fab fa-facebook"); assert.ok(iconHTML(fa5Icon).indexOf("fab-facebook") > -1, "FA 5 syntax"); diff --git a/test/javascripts/lib/key-value-store-test.js b/test/javascripts/lib/key-value-store-test.js index 5e21cb87709..70d4469c4e7 100644 --- a/test/javascripts/lib/key-value-store-test.js +++ b/test/javascripts/lib/key-value-store-test.js @@ -2,13 +2,13 @@ import KeyValueStore from "discourse/lib/key-value-store"; QUnit.module("lib:key-value-store"); -QUnit.test("it's able to get the result back from the store", assert => { +QUnit.test("it's able to get the result back from the store", (assert) => { const store = new KeyValueStore("_test"); store.set({ key: "bob", value: "uncle" }); assert.equal(store.get("bob"), "uncle"); }); -QUnit.test("is able to nuke the store", assert => { +QUnit.test("is able to nuke the store", (assert) => { const store = new KeyValueStore("_test"); store.set({ key: "bob1", value: "uncle" }); store.abandonLocal(); diff --git a/test/javascripts/lib/link-mentions-test.js b/test/javascripts/lib/link-mentions-test.js index a7c309cbbbd..5f4908d4575 100644 --- a/test/javascripts/lib/link-mentions-test.js +++ b/test/javascripts/lib/link-mentions-test.js @@ -1,13 +1,13 @@ import { fetchUnseenMentions, - linkSeenMentions + linkSeenMentions, } from "discourse/lib/link-mentions"; import { Promise } from "rsvp"; import pretender from "helpers/create-pretender"; QUnit.module("lib:link-mentions"); -QUnit.test("linkSeenMentions replaces users and groups", async assert => { +QUnit.test("linkSeenMentions replaces users and groups", async (assert) => { pretender.get("/u/is_local_username", () => [ 200, { "Content-Type": "application/json" }, @@ -17,19 +17,19 @@ QUnit.test("linkSeenMentions replaces users and groups", async assert => { mentionable_groups: [ { name: "mentionable_group", - user_count: 1 - } + user_count: 1, + }, ], cannot_see: [], - max_users_notified_per_group_mention: 100 - } + max_users_notified_per_group_mention: 100, + }, ]); await fetchUnseenMentions([ "valid_user", "mentionable_group", "valid_group", - "invalid" + "invalid", ]); let $root = $(` @@ -45,7 +45,7 @@ QUnit.test("linkSeenMentions replaces users and groups", async assert => { // Ember.Test.registerWaiter is not available here, so we are implementing // our own - await new Promise(resolve => { + await new Promise((resolve) => { const interval = setInterval(() => { if ($("a", $root).length > 0) { clearInterval(interval); diff --git a/test/javascripts/lib/load-script-test.js b/test/javascripts/lib/load-script-test.js index e73a1bafa96..d3f433108ab 100644 --- a/test/javascripts/lib/load-script-test.js +++ b/test/javascripts/lib/load-script-test.js @@ -4,7 +4,7 @@ QUnit.module("lib:load-script"); QUnit.skip( "load with a script tag, and callbacks are only executed after script is loaded", - async assert => { + async (assert) => { assert.ok( typeof window.ace === "undefined", "ensures ace is not previously loaded" diff --git a/test/javascripts/lib/oneboxer-test.js b/test/javascripts/lib/oneboxer-test.js index 1572a0476ef..512f2fc3049 100644 --- a/test/javascripts/lib/oneboxer-test.js +++ b/test/javascripts/lib/oneboxer-test.js @@ -10,13 +10,13 @@ function loadOnebox(element) { ajax, synchronous: true, categoryId: 1, - topicId: 1 + topicId: 1, }); } QUnit.module("lib:oneboxer"); -QUnit.test("load - failed onebox", async assert => { +QUnit.test("load - failed onebox", async (assert) => { let element = document.createElement("A"); element.setAttribute("href", "http://somebadurl.com"); @@ -34,7 +34,7 @@ QUnit.test("load - failed onebox", async assert => { ); }); -QUnit.test("load - successful onebox", async assert => { +QUnit.test("load - successful onebox", async (assert) => { const html = `