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 += "`, 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 `, "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 `, "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(), `TestTitle`, "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, "
"; }); @@ -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({ )}
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, ''); - } + }, }); 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: '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) { `HelloWorld`, "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 = `