A platform for community discussion. Free, open, simple.
DEV: enforces eslint’s curly rule to the codebase (#10720)
Joffrey JAFFEUX530d9ab07168
diff --git a/app/assets/javascripts/admin/components/admin-backups-logs.js b/app/assets/javascripts/admin/components/admin-backups-logs.jsindex 2531a521162..1bb36931a09 100644--- a/app/assets/javascripts/admin/components/admin-backups-logs.js+++ b/app/assets/javascripts/admin/components/admin-backups-logs.js@@ -37,7 +37,9 @@ export default Component.extend({@observes("logs.[]")_updateFormattedLogs: discourseDebounce(function () {const logs = this.logs;- if (logs.length === 0) return;+ if (logs.length === 0) {+ return;+ }// do the log formatting only once for HELLish performancelet formattedLogs = this.formattedLogs;diff --git a/app/assets/javascripts/admin/components/admin-report-chart.js b/app/assets/javascripts/admin/components/admin-report-chart.jsindex 632d76f2596..20a190d9d2b 100644--- a/app/assets/javascripts/admin/components/admin-report-chart.js+++ b/app/assets/javascripts/admin/components/admin-report-chart.js@@ -47,7 +47,9 @@ export default Component.extend({},_renderChart(model, chartCanvas) {- if (!chartCanvas) return;+ if (!chartCanvas) {+ return;+ }const context = chartCanvas.getContext("2d");const chartData = this._applyChartGrouping(@@ -137,7 +139,9 @@ export default Component.extend({display: true,ticks: {userCallback: (label) => {- if (Math.floor(label) === label) return label;+ if (Math.floor(label) === label) {+ return label;+ }},callback: (label) => number(label),sampleSize: 5,diff --git a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js b/app/assets/javascripts/admin/components/admin-report-stacked-chart.jsindex 4b46eec840c..3519e6a163b 100644--- a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js+++ b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js@@ -48,7 +48,9 @@ export default Component.extend({},_renderChart(model, chartCanvas) {- if (!chartCanvas) return;+ if (!chartCanvas) {+ return;+ }const context = chartCanvas.getContext("2d");@@ -115,7 +117,9 @@ export default Component.extend({display: true,ticks: {userCallback: (label) => {- if (Math.floor(label) === label) return label;+ if (Math.floor(label) === label) {+ return label;+ }},callback: (label) => number(label),sampleSize: 5,diff --git a/app/assets/javascripts/admin/components/admin-report-table.js b/app/assets/javascripts/admin/components/admin-report-table.jsindex d5c76b23a9d..b44ea784ddd 100644--- a/app/assets/javascripts/admin/components/admin-report-table.js+++ b/app/assets/javascripts/admin/components/admin-report-table.js@@ -74,7 +74,9 @@ export default Component.extend({@discourseComputed("model.data", "model.computedLabels")totalsForSampleRow(rows, labels) {- if (!rows || !rows.length) return {};+ if (!rows || !rows.length) {+ return {};+ }let totalsRow = {};@@ -130,7 +132,9 @@ export default Component.extend({@discourseComputed("model.data", "perPage", "page")pages(data, perPage, page) {- if (!data || data.length <= perPage) return [];+ if (!data || data.length <= perPage) {+ return [];+ }const pagesIndexes = [];for (let i = 0; i < Math.ceil(data.length / perPage); i++) {diff --git a/app/assets/javascripts/admin/components/admin-report.js b/app/assets/javascripts/admin/components/admin-report.jsindex b5e81f7f05d..eb9b06f703a 100644--- a/app/assets/javascripts/admin/components/admin-report.js+++ b/app/assets/javascripts/admin/components/admin-report.js@@ -171,7 +171,9 @@ export default Component.extend({"filters.customFilters")reportKey(dataSourceName, startDate, endDate, customFilters) {- if (!dataSourceName || !startDate || !endDate) return null;+ if (!dataSourceName || !startDate || !endDate) {+ return null;+ }startDate = startDate.toISOString(true).split("T")[0];endDate = endDate.toISOString(true).split("T")[0];@@ -310,7 +312,9 @@ export default Component.extend({filteredReports.filter((r) => r.report_key.includes(this.reportKey)))[0];- if (!report) return;+ if (!report) {+ return;+ }}if (report.error === "not_found") {diff --git a/app/assets/javascripts/admin/components/admin-theme-editor.js b/app/assets/javascripts/admin/components/admin-theme-editor.jsindex 4c5eca33cfd..c453c877d62 100644--- a/app/assets/javascripts/admin/components/admin-theme-editor.js+++ b/app/assets/javascripts/admin/components/admin-theme-editor.js@@ -29,9 +29,15 @@ export default Component.extend({@discourseComputed("currentTargetName", "fieldName")activeSectionMode(targetName, fieldName) {- if (["settings", "translations"].includes(targetName)) return "yaml";- if (["extra_scss"].includes(targetName)) return "scss";- if (["color_definitions"].includes(fieldName)) return "scss";+ if (["settings", "translations"].includes(targetName)) {+ return "yaml";+ }+ if (["extra_scss"].includes(targetName)) {+ return "scss";+ }+ if (["color_definitions"].includes(fieldName)) {+ return "scss";+ }return fieldName && fieldName.indexOf("scss") > -1 ? "scss" : "html";},@@ -88,7 +94,9 @@ export default Component.extend({},addField(name) {- if (!name) return;+ if (!name) {+ return;+ }name = name.replace(/[^a-zA-Z0-9-_/]/g, "");this.theme.setField(this.currentTargetName, name, "");this.setProperties({ newFieldName: "", addingField: false });diff --git a/app/assets/javascripts/admin/components/admin-web-hook-event.js b/app/assets/javascripts/admin/components/admin-web-hook-event.jsindex 20f889037cf..75f1326a483 100644--- a/app/assets/javascripts/admin/components/admin-web-hook-event.js+++ b/app/assets/javascripts/admin/components/admin-web-hook-event.js@@ -14,7 +14,9 @@ export default Component.extend({@discourseComputed("model.status")statusColorClasses(status) {- if (!status) return "";+ if (!status) {+ return "";+ }if (status >= 200 && status <= 299) {return "text-successful";diff --git a/app/assets/javascripts/admin/components/secret-value-list.js b/app/assets/javascripts/admin/components/secret-value-list.jsindex b773336bdc6..9b59c26d3ac 100644--- a/app/assets/javascripts/admin/components/secret-value-list.js+++ b/app/assets/javascripts/admin/components/secret-value-list.js@@ -23,17 +23,23 @@ export default Component.extend({actions: {changeKey(index, newValue) {- if (this._checkInvalidInput(newValue)) return;+ if (this._checkInvalidInput(newValue)) {+ return;+ }this._replaceValue(index, newValue, "key");},changeSecret(index, newValue) {- if (this._checkInvalidInput(newValue)) return;+ if (this._checkInvalidInput(newValue)) {+ return;+ }this._replaceValue(index, newValue, "secret");},addValue() {- if (this._checkInvalidInput([this.newKey, this.newSecret])) return;+ if (this._checkInvalidInput([this.newKey, this.newSecret])) {+ return;+ }this._addValue(this.newKey, this.newSecret);this.setProperties({ newKey: "", newSecret: "" });},diff --git a/app/assets/javascripts/admin/components/simple-list.js b/app/assets/javascripts/admin/components/simple-list.jsindex 4158447c0fc..f3db4c59731 100644--- a/app/assets/javascripts/admin/components/simple-list.js+++ b/app/assets/javascripts/admin/components/simple-list.js@@ -32,7 +32,9 @@ export default Component.extend({@actionaddValue(newValue) {- if (this.inputEmpty) return;+ if (this.inputEmpty) {+ return;+ }this.set("newValue", null);this.collection.addObject(newValue);diff --git a/app/assets/javascripts/admin/components/site-settings/color.js b/app/assets/javascripts/admin/components/site-settings/color.jsindex 5b81fa2f688..7e5e71effc6 100644--- a/app/assets/javascripts/admin/components/site-settings/color.js+++ b/app/assets/javascripts/admin/components/site-settings/color.js@@ -11,9 +11,15 @@ function RGBToHex(rgb) {g = (+rgb[1]).toString(16),b = (+rgb[2]).toString(16);- if (r.length === 1) r = "0" + r;- if (g.length === 1) g = "0" + g;- if (b.length === 1) b = "0" + b;+ if (r.length === 1) {+ r = "0" + r;+ }+ if (g.length === 1) {+ g = "0" + g;+ }+ if (b.length === 1) {+ b = "0" + b;+ }return "#" + r + g + b;}diff --git a/app/assets/javascripts/admin/components/site-text-summary.js b/app/assets/javascripts/admin/components/site-text-summary.jsindex 7a8c57c9b88..abe4f5fa63e 100644--- a/app/assets/javascripts/admin/components/site-text-summary.js+++ b/app/assets/javascripts/admin/components/site-text-summary.js@@ -32,7 +32,9 @@ export default Component.extend({if (regex && siteText) {const matches = siteText.value.match(new RegExp(regex, "i"));- if (matches) return matches[0];+ if (matches) {+ return matches[0];+ }}return this.term;diff --git a/app/assets/javascripts/admin/components/value-list.js b/app/assets/javascripts/admin/components/value-list.jsindex dbd7d25bfe7..bfba8f7dd19 100644--- a/app/assets/javascripts/admin/components/value-list.js+++ b/app/assets/javascripts/admin/components/value-list.js@@ -34,7 +34,9 @@ export default Component.extend({},keyDown(event) {- if (event.keyCode === 13) this.send("addValue", this.newValue);+ if (event.keyCode === 13) {+ this.send("addValue", this.newValue);+ }},actions: {@@ -43,7 +45,9 @@ export default Component.extend({},addValue(newValue) {- if (this.inputInvalid) return;+ if (this.inputInvalid) {+ return;+ }this.set("newValue", null);this._addValue(newValue);diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js b/app/assets/javascripts/admin/controllers/admin-api-keys-new.jsindex 9f9ea6bda64..06e495109c1 100644--- a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js+++ b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js@@ -20,8 +20,12 @@ export default Controller.extend({@discourseComputed("model.description", "model.username", "userMode")saveDisabled(description, username, userMode) {- if (isBlank(description)) return true;- if (userMode === "single" && isBlank(username)) return true;+ if (isBlank(description)) {+ return true;+ }+ if (userMode === "single" && isBlank(username)) {+ return true;+ }return false;},diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js b/app/assets/javascripts/admin/controllers/admin-dashboard-general.jsindex 6878c916d63..0384e06a0ab 100644--- a/app/assets/javascripts/admin/controllers/admin-dashboard-general.js+++ b/app/assets/javascripts/admin/controllers/admin-dashboard-general.js@@ -112,7 +112,9 @@ export default Controller.extend(PeriodComputationMixin, {storageReport: staticReport("storage_report"),fetchDashboard() {- if (this.isLoading) return;+ if (this.isLoading) {+ return;+ }if (!this.dashboardFetchedAt ||diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard.js b/app/assets/javascripts/admin/controllers/admin-dashboard.jsindex d91e5c515f3..29e1ad0c5a6 100644--- a/app/assets/javascripts/admin/controllers/admin-dashboard.js+++ b/app/assets/javascripts/admin/controllers/admin-dashboard.js@@ -37,7 +37,9 @@ export default Controller.extend({}),fetchProblems() {- if (this.isLoadingProblems) return;+ if (this.isLoadingProblems) {+ return;+ }if (!this.problemsFetchedAt ||@@ -51,7 +53,9 @@ export default Controller.extend({fetchDashboard() {const versionChecks = this.siteSettings.version_checks;- if (this.isLoading || !versionChecks) return;+ if (this.isLoading || !versionChecks) {+ return;+ }if (!this.dashboardFetchedAt ||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.jsindex 11d34dabc30..68ac649425d 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@@ -63,7 +63,9 @@ export default Controller.extend({} else {bootbox.alert(I18n.t("generic_error"));}- if (wasEditing) record.set("editing", true);+ if (wasEditing) {+ record.set("editing", true);+ }});},diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js b/app/assets/javascripts/admin/controllers/admin-site-settings.jsindex 493bf579d03..02e7ab8f07c 100644--- a/app/assets/javascripts/admin/controllers/admin-site-settings.js+++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js@@ -14,7 +14,9 @@ export default Controller.extend({filterContentNow(category) {// If we have no content, don't bother filtering anything- if (!!isEmpty(this.allSiteSettings)) return;+ if (!!isEmpty(this.allSiteSettings)) {+ return;+ }let filter, pluginFilter;if (this.filter) {@@ -59,8 +61,12 @@ export default Controller.extend({const matches = [];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 (this.onlyOverridden && !item.get("overridden")) {+ return false;+ }+ if (pluginFilter && item.plugin !== pluginFilter) {+ return false;+ }if (filter) {const setting = item.get("setting").toLowerCase();return (diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js b/app/assets/javascripts/admin/controllers/admin-user-index.jsindex 8f58755ef06..8ab62307fd0 100644--- a/app/assets/javascripts/admin/controllers/admin-user-index.js+++ b/app/assets/javascripts/admin/controllers/admin-user-index.js@@ -40,7 +40,9 @@ export default Controller.extend(CanCheckEmails, {@discourseComputed("customGroupIdsBuffer", "customGroupIds")customGroupsDirty(buffer, original) {- if (buffer === null) return false;+ if (buffer === null) {+ return false;+ }return buffer.length === original.length? buffer.any((id) => !original.includes(id))diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js b/app/assets/javascripts/admin/controllers/admin-watched-words-action.jsindex 373b3caa028..6a9b78bf297 100644--- a/app/assets/javascripts/admin/controllers/admin-watched-words-action.js+++ b/app/assets/javascripts/admin/controllers/admin-watched-words-action.js@@ -58,7 +58,9 @@ export default Controller.extend({// remove from other actions listslet match = null;this.get("adminWatchedWords.model").forEach((action) => {- if (match) return;+ if (match) {+ return;+ }if (action.nameKey !== this.actionNameKey) {match = action.words.findBy("id", arg.id);diff --git a/app/assets/javascripts/admin/controllers/admin-watched-words.js b/app/assets/javascripts/admin/controllers/admin-watched-words.jsindex 7a9a4ca8dc2..151fc82c33a 100644--- a/app/assets/javascripts/admin/controllers/admin-watched-words.js+++ b/app/assets/javascripts/admin/controllers/admin-watched-words.js@@ -14,7 +14,9 @@ export default Controller.extend({regularExpressions: null,filterContentNow() {- if (!!isEmpty(this.allWatchedWords)) return;+ if (!!isEmpty(this.allWatchedWords)) {+ return;+ }let filter;if (this.filter) {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.jsindex 7b269eb3369..b088cccb753 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@@ -5,7 +5,9 @@ import ModalFunctionality from "discourse/mixins/modal-functionality";export default Controller.extend(ModalFunctionality, {@discourseComputed("value", "model.compiledRegularExpression")matches(value, regexpString) {- if (!value || !regexpString) return;+ if (!value || !regexpString) {+ return;+ }let censorRegexp = new RegExp(regexpString, "ig");return value.match(censorRegexp);},diff --git a/app/assets/javascripts/admin/mixins/setting-component.js b/app/assets/javascripts/admin/mixins/setting-component.jsindex 4204c4ec90d..c7d42df43a3 100644--- a/app/assets/javascripts/admin/mixins/setting-component.js+++ b/app/assets/javascripts/admin/mixins/setting-component.js@@ -47,8 +47,12 @@ export default Mixin.create({@discourseComputed("buffered.value", "setting.value")dirty(bufferVal, settingVal) {- if (bufferVal === null || bufferVal === undefined) bufferVal = "";- if (settingVal === null || settingVal === undefined) settingVal = "";+ if (bufferVal === null || bufferVal === undefined) {+ bufferVal = "";+ }+ if (settingVal === null || settingVal === undefined) {+ settingVal = "";+ }return bufferVal.toString() !== settingVal.toString();},diff --git a/app/assets/javascripts/admin/mixins/setting-object.js b/app/assets/javascripts/admin/mixins/setting-object.jsindex f971bfb749f..5a40360b084 100644--- a/app/assets/javascripts/admin/mixins/setting-object.js+++ b/app/assets/javascripts/admin/mixins/setting-object.js@@ -7,8 +7,12 @@ import { isPresent } from "@ember/utils";export default Mixin.create({@discourseComputed("value", "default")overridden(val, defaultVal) {- if (val === null) val = "";- if (defaultVal === null) defaultVal = "";+ if (val === null) {+ val = "";+ }+ if (defaultVal === null) {+ defaultVal = "";+ }return val.toString() !== defaultVal.toString();},diff --git a/app/assets/javascripts/admin/models/api-key.js b/app/assets/javascripts/admin/models/api-key.jsindex b9d6c07d2a3..adf186d4548 100644--- a/app/assets/javascripts/admin/models/api-key.js+++ b/app/assets/javascripts/admin/models/api-key.js@@ -22,7 +22,9 @@ const ApiKey = RestModel.extend({@discourseComputed("description")shortDescription(description) {- if (!description || description.length < 40) return description;+ if (!description || description.length < 40) {+ return description;+ }return `${description.substring(0, 40)}...`;},diff --git a/app/assets/javascripts/admin/models/color-scheme-color.js b/app/assets/javascripts/admin/models/color-scheme-color.jsindex 98cdfa13f4f..f5427d542ce 100644--- a/app/assets/javascripts/admin/models/color-scheme-color.js+++ b/app/assets/javascripts/admin/models/color-scheme-color.js@@ -18,8 +18,12 @@ const ColorSchemeColor = EmberObject.extend({// Whether value has changed since it was last saved.@discourseComputed("hex")changed(hex) {- if (!this.originals) return false;- if (hex !== this.originals.hex) return true;+ if (!this.originals) {+ return false;+ }+ if (hex !== this.originals.hex) {+ return true;+ }return false;},diff --git a/app/assets/javascripts/admin/models/color-scheme.js b/app/assets/javascripts/admin/models/color-scheme.jsindex aa160835cfb..513f8cb3ee1 100644--- a/app/assets/javascripts/admin/models/color-scheme.js+++ b/app/assets/javascripts/admin/models/color-scheme.js@@ -48,9 +48,15 @@ const ColorScheme = EmberObject.extend({@discourseComputed("name", "[email protected]", "saving")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.originals) {+ return false;+ }+ if (this.originals.name !== name) {+ return true;+ }+ if (this.colors.any((c) => c.get("changed"))) {+ return true;+ }return false;},@@ -67,7 +73,9 @@ const ColorScheme = EmberObject.extend({newRecord: not("id"),save(opts) {- if (this.is_base || this.disableSave) return;+ if (this.is_base || this.disableSave) {+ return;+ }this.setProperties({ savingStatus: I18n.t("saving"), saving: true });@@ -108,7 +116,9 @@ const ColorScheme = EmberObject.extend({},updateUserSelectable(value) {- if (!this.id) return;+ if (!this.id) {+ return;+ }return ajax(`/admin/color_schemes/${this.id}.json`, {data: JSON.stringify({ color_scheme: { user_selectable: value } }),diff --git a/app/assets/javascripts/admin/models/report.js b/app/assets/javascripts/admin/models/report.jsindex 7713c06c4f4..811370547fc 100644--- a/app/assets/javascripts/admin/models/report.js+++ b/app/assets/javascripts/admin/models/report.js@@ -252,7 +252,9 @@ const Report = EmberObject.extend({@discourseComputed("data")xAxisIsDate() {- if (!this.data[0]) return false;+ if (!this.data[0]) {+ return false;+ }return this.data && this.data[0].x.match(/\d{4}-\d{1,2}-\d{1,2}/);},@@ -262,12 +264,17 @@ const Report = EmberObject.extend({const type = label.type || "string";let mainProperty;- if (label.property) mainProperty = label.property;- else if (type === "user") mainProperty = label.properties["username"];- else if (type === "topic") mainProperty = label.properties["title"];- else if (type === "post")+ if (label.property) {+ mainProperty = label.property;+ } else if (type === "user") {+ mainProperty = label.properties["username"];+ } else if (type === "topic") {+ mainProperty = label.properties["title"];+ } else if (type === "post") {mainProperty = label.properties["truncated_raw"];- else mainProperty = label.properties[0];+ } else {+ mainProperty = label.properties[0];+ }return {title: label.title,@@ -283,25 +290,45 @@ const Report = EmberObject.extend({value = row[mainProperty];}- if (type === "user") return this._userLabel(label.properties, row);- if (type === "post") return this._postLabel(label.properties, row);- if (type === "topic") return this._topicLabel(label.properties, row);- if (type === "seconds") return this._secondsLabel(value);- if (type === "link") return this._linkLabel(label.properties, row);- if (type === "percent") return this._percentLabel(value);- if (type === "bytes") return this._bytesLabel(value);+ if (type === "user") {+ return this._userLabel(label.properties, row);+ }+ if (type === "post") {+ return this._postLabel(label.properties, row);+ }+ if (type === "topic") {+ return this._topicLabel(label.properties, row);+ }+ if (type === "seconds") {+ return this._secondsLabel(value);+ }+ if (type === "link") {+ return this._linkLabel(label.properties, row);+ }+ if (type === "percent") {+ return this._percentLabel(value);+ }+ if (type === "bytes") {+ return this._bytesLabel(value);+ }if (type === "number") {return this._numberLabel(value, opts);}if (type === "date") {const date = moment(value);- if (date.isValid()) return this._dateLabel(value, date);+ if (date.isValid()) {+ return this._dateLabel(value, date);+ }}if (type === "precise_date") {const date = moment(value);- if (date.isValid()) return this._dateLabel(value, date, "LLL");+ if (date.isValid()) {+ return this._dateLabel(value, date, "LLL");+ }+ }+ if (type === "text") {+ return this._textLabel(value);}- if (type === "text") return this._textLabel(value);return {value,diff --git a/app/assets/javascripts/discourse-common/addon/lib/get-url.js b/app/assets/javascripts/discourse-common/addon/lib/get-url.jsindex 7f2a9be1fef..1981a38bfbe 100644--- a/app/assets/javascripts/discourse-common/addon/lib/get-url.js+++ b/app/assets/javascripts/discourse-common/addon/lib/get-url.js@@ -11,12 +11,18 @@ export default function getURL(url) {}// if it's a non relative URL, return it.- if (url !== "/" && !/^\/[^\/]/.test(url)) return url;+ if (url !== "/" && !/^\/[^\/]/.test(url)) {+ return url;+ }const found = url.indexOf(baseUri);- if (found >= 0 && found < 3) return url;- if (url[0] !== "/") url = "/" + url;+ if (found >= 0 && found < 3) {+ return url;+ }+ if (url[0] !== "/") {+ url = "/" + url;+ }return baseUri + url;}diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.jsindex 82e358b93f9..28b0998d85b 100644--- a/app/assets/javascripts/discourse-loader.js+++ b/app/assets/javascripts/discourse-loader.js@@ -300,7 +300,9 @@ var define, requirejs;function transformForAliases(name) {var alias = ALIASES[name];- if (!alias) return name;+ if (!alias) {+ return name;+ }deprecatedModule(name, alias);return alias;diff --git a/app/assets/javascripts/discourse/app/components/add-category-tag-classes.js b/app/assets/javascripts/discourse/app/components/add-category-tag-classes.jsindex 40025c433fc..5120b187356 100644--- a/app/assets/javascripts/discourse/app/components/add-category-tag-classes.js+++ b/app/assets/javascripts/discourse/app/components/add-category-tag-classes.js@@ -24,8 +24,12 @@ export default Component.extend({classes.push("category");classes.push(`category-${slug}`);}- if (tags) tags.forEach((t) => classes.push(`tag-${t}`));- if (classes.length > 0) $("body").addClass(classes.join(" "));+ if (tags) {+ tags.forEach((t) => classes.push(`tag-${t}`));+ }+ if (classes.length > 0) {+ $("body").addClass(classes.join(" "));+ }},@observes("category.fullSlug", "tags")diff --git a/app/assets/javascripts/discourse/app/components/backup-codes.js b/app/assets/javascripts/discourse/app/components/backup-codes.jsindex ecd29a0c4d1..1b74cf1462d 100644--- a/app/assets/javascripts/discourse/app/components/backup-codes.js+++ b/app/assets/javascripts/discourse/app/components/backup-codes.js@@ -38,7 +38,9 @@ export default Component.extend({@discourseComputed("backupCodes")formattedBackupCodes(backupCodes) {- if (!backupCodes) return null;+ if (!backupCodes) {+ return null;+ }return backupCodes.join("\n").trim();},diff --git a/app/assets/javascripts/discourse/app/components/badge-selector.js b/app/assets/javascripts/discourse/app/components/badge-selector.jsindex f903e6e9634..bf97777dc1f 100644--- a/app/assets/javascripts/discourse/app/components/badge-selector.js+++ b/app/assets/javascripts/discourse/app/components/badge-selector.js@@ -42,7 +42,9 @@ export default Component.extend({dataSource(term) {return this.badgeFinder(term).then((badges) => {- if (!selectedBadges) return badges;+ if (!selectedBadges) {+ return badges;+ }return badges.filter((badge) => !selectedBadges.any((s) => s === badge.name)diff --git a/app/assets/javascripts/discourse/app/components/categories-only.js b/app/assets/javascripts/discourse/app/components/categories-only.jsindex fbfa539c7ad..9be4c383a59 100644--- a/app/assets/javascripts/discourse/app/components/categories-only.js+++ b/app/assets/javascripts/discourse/app/components/categories-only.js@@ -14,7 +14,9 @@ export default Component.extend({return;}- if (showMutedCategories) return "minus";+ if (showMutedCategories) {+ return "minus";+ }return "plus";},diff --git a/app/assets/javascripts/discourse/app/components/choose-topic.js b/app/assets/javascripts/discourse/app/components/choose-topic.jsindex c03c065b259..f9bd7da4960 100644--- a/app/assets/javascripts/discourse/app/components/choose-topic.js+++ b/app/assets/javascripts/discourse/app/components/choose-topic.js@@ -103,7 +103,9 @@ export default Component.extend({next(() => {document.getElementById(`choose-topic-${topic.id}`).checked = true;});- if (this.topicChangedCallback) this.topicChangedCallback(topic);+ if (this.topicChangedCallback) {+ this.topicChangedCallback(topic);+ }},},});diff --git a/app/assets/javascripts/discourse/app/components/composer-editor.js b/app/assets/javascripts/discourse/app/components/composer-editor.jsindex 95078306260..b58eeed6042 100644--- a/app/assets/javascripts/discourse/app/components/composer-editor.js+++ b/app/assets/javascripts/discourse/app/components/composer-editor.js@@ -320,7 +320,9 @@ export default Component.extend({schedule("afterRender", () => {$input.on("touchstart mouseenter", () => {- if (!$preview.is(":visible")) return;+ if (!$preview.is(":visible")) {+ return;+ }$preview.off("scroll");$input.on("scroll", () => {@@ -495,7 +497,9 @@ export default Component.extend({},_syncPreviewAndEditorScroll($input, $preview, scrollMap) {- if (scrollMap.length < 1) return;+ if (scrollMap.length < 1) {+ return;+ }let scrollTop;const previewScrollTop = $preview.scrollTop();@@ -670,8 +674,12 @@ export default Component.extend({const isPrivateMessage = this.get("composer.privateMessage");data.formData = { type: "composer" };- if (isPrivateMessage) data.formData.for_private_message = true;- if (this._pasted) data.formData.pasted = true;+ if (isPrivateMessage) {+ data.formData.for_private_message = true;+ }+ if (this._pasted) {+ data.formData.pasted = true;+ }const opts = {user: this.currentUser,@@ -819,8 +827,9 @@ export default Component.extend({);});- if (this._enableAdvancedEditorPreviewSync())+ if (this._enableAdvancedEditorPreviewSync()) {this._teardownInputPreviewSync();+ }},showUploadSelector(toolbarEvent) {@@ -921,7 +930,9 @@ export default Component.extend({refresh);- if (refresh && paintedCount > 0) post.set("refreshedPost", true);+ if (refresh && paintedCount > 0) {+ post.set("refreshedPost", true);+ }};debounce(this, paintFunc, 450);diff --git a/app/assets/javascripts/discourse/app/components/composer-user-selector.js b/app/assets/javascripts/discourse/app/components/composer-user-selector.jsindex 030e18896e9..2f6f81e675a 100644--- a/app/assets/javascripts/discourse/app/components/composer-user-selector.js+++ b/app/assets/javascripts/discourse/app/components/composer-user-selector.js@@ -31,7 +31,9 @@ export default Component.extend({width += $(item).outerWidth(true);const result = width < limit;- if (result) this.incrementProperty("defaultUsernameCount");+ if (result) {+ this.incrementProperty("defaultUsernameCount");+ }return result;});@@ -84,7 +86,9 @@ export default Component.extend({triggerResize() {this.appEvents.trigger("composer:resize");const $this = $(this.element).find(".ac-wrap");- if ($this.height() >= 150) $this.scrollTop($this.height());+ if ($this.height() >= 150) {+ $this.scrollTop($this.height());+ }},},});diff --git a/app/assets/javascripts/discourse/app/components/cook-text.js b/app/assets/javascripts/discourse/app/components/cook-text.jsindex c6c4e14d2ce..87765cc40bd 100644--- a/app/assets/javascripts/discourse/app/components/cook-text.js+++ b/app/assets/javascripts/discourse/app/components/cook-text.js@@ -12,7 +12,9 @@ const CookText = Component.extend({this._super(...arguments);cookAsync(this.rawText).then((cooked) => {this.set("cooked", cooked);- if (this.paintOneboxes) this._loadOneboxes();+ if (this.paintOneboxes) {+ this._loadOneboxes();+ }this._resolveUrls();});},diff --git a/app/assets/javascripts/discourse/app/components/d-button.js b/app/assets/javascripts/discourse/app/components/d-button.jsindex 22f861174da..a501bbf2b51 100644--- a/app/assets/javascripts/discourse/app/components/d-button.js+++ b/app/assets/javascripts/discourse/app/components/d-button.js@@ -64,20 +64,28 @@ export default Component.extend({@discourseComputed("title", "translatedTitle")computedTitle(title, translatedTitle) {- if (this.title) return I18n.t(title);+ if (this.title) {+ return I18n.t(title);+ }return translatedTitle;},@discourseComputed("label", "translatedLabel")computedLabel(label, translatedLabel) {- if (this.label) return I18n.t(label);+ if (this.label) {+ return I18n.t(label);+ }return translatedLabel;},@discourseComputed("ariaLabel", "translatedAriaLabel", "computedLabel")computedAriaLabel(ariaLabel, translatedAriaLabel, computedLabel) {- if (ariaLabel) return I18n.t(ariaLabel);- if (translatedAriaLabel) return translatedAriaLabel;+ if (ariaLabel) {+ return I18n.t(ariaLabel);+ }+ if (translatedAriaLabel) {+ return translatedAriaLabel;+ }return computedLabel;},diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.jsindex 1557c461c7d..2874203547e 100644--- a/app/assets/javascripts/discourse/app/components/d-editor.js+++ b/app/assets/javascripts/discourse/app/components/d-editor.js@@ -240,7 +240,9 @@ export default Component.extend({@discourseComputed("placeholder")placeholderTranslated(placeholder) {- if (placeholder) return I18n.t(placeholder);+ if (placeholder) {+ return I18n.t(placeholder);+ }return null;},@@ -375,7 +377,9 @@ export default Component.extend({return;}- if (this.preview === cooked) return;+ if (this.preview === cooked) {+ return;+ }this.set("preview", cooked);schedule("afterRender", () => {@@ -383,7 +387,9 @@ export default Component.extend({return;}const $preview = $(this.element.querySelector(".d-editor-preview"));- if ($preview.length === 0) return;+ if ($preview.length === 0) {+ return;+ }if (this.previewUpdated) {this.previewUpdated($preview);diff --git a/app/assets/javascripts/discourse/app/components/date-input.js b/app/assets/javascripts/discourse/app/components/date-input.jsindex 83a6df23ceb..7c8cd58989a 100644--- a/app/assets/javascripts/discourse/app/components/date-input.js+++ b/app/assets/javascripts/discourse/app/components/date-input.js@@ -117,7 +117,9 @@ export default Component.extend({},_handleSelection(value) {- if (!this.element || this.isDestroying || this.isDestroyed) return;+ if (!this.element || this.isDestroying || this.isDestroyed) {+ return;+ }if (this.onChange) {this.onChange(value ? moment(value) : null);diff --git a/app/assets/javascripts/discourse/app/components/date-picker.js b/app/assets/javascripts/discourse/app/components/date-picker.jsindex 4ecbf479ce3..f54b48da8d4 100644--- a/app/assets/javascripts/discourse/app/components/date-picker.js+++ b/app/assets/javascripts/discourse/app/components/date-picker.js@@ -66,7 +66,9 @@ export default Component.extend({_handleSelection(value) {const formattedDate = moment(value).format(DATE_FORMAT);- if (!this.element || this.isDestroying || this.isDestroyed) return;+ if (!this.element || this.isDestroying || this.isDestroyed) {+ return;+ }if (this.onSelect) {this.onSelect(formattedDate);diff --git a/app/assets/javascripts/discourse/app/components/discourse-linked-text.js b/app/assets/javascripts/discourse/app/components/discourse-linked-text.jsindex e72df0d8cd2..0c60dd1b6d6 100644--- a/app/assets/javascripts/discourse/app/components/discourse-linked-text.js+++ b/app/assets/javascripts/discourse/app/components/discourse-linked-text.js@@ -7,7 +7,9 @@ export default Component.extend({@discourseComputed("text")translatedText(text) {- if (text) return I18n.t(text);+ if (text) {+ return I18n.t(text);+ }},click(event) {diff --git a/app/assets/javascripts/discourse/app/components/discourse-topic.js b/app/assets/javascripts/discourse/app/components/discourse-topic.jsindex 210e43bc4a5..dcfbc4b21a7 100644--- a/app/assets/javascripts/discourse/app/components/discourse-topic.js+++ b/app/assets/javascripts/discourse/app/components/discourse-topic.js@@ -67,7 +67,9 @@ export default Component.extend(},_showTopicInHeader(topic) {- if (this.pauseHeaderTopicUpdate) return;+ if (this.pauseHeaderTopicUpdate) {+ return;+ }this.appEvents.trigger("header:show-topic", topic);this._lastShowTopic = true;},diff --git a/app/assets/javascripts/discourse/app/components/edit-category-settings.js b/app/assets/javascripts/discourse/app/components/edit-category-settings.jsindex c355b9431f2..b18e84d5c05 100644--- a/app/assets/javascripts/discourse/app/components/edit-category-settings.js+++ b/app/assets/javascripts/discourse/app/components/edit-category-settings.js@@ -110,8 +110,12 @@ export default buildCategoryPanel("settings", {@discourseComputed("category.sort_ascending")sortAscendingOption(sortAscending) {- if (sortAscending === "false") return false;- if (sortAscending === "true") return true;+ if (sortAscending === "false") {+ return false;+ }+ if (sortAscending === "true") {+ return true;+ }return sortAscending;},diff --git a/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js b/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.jsindex ecacbdf95ea..fd3652d5cce 100644--- a/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js+++ b/app/assets/javascripts/discourse/app/components/edit-topic-timer-form.js@@ -34,7 +34,9 @@ export default Component.extend({@discourseComputed("topic.visible")excludeCategoryId(visible) {- if (visible) return this.get("topic.category_id");+ if (visible) {+ return this.get("topic.category_id");+ }},@observes("selection")diff --git a/app/assets/javascripts/discourse/app/components/emoji-picker.js b/app/assets/javascripts/discourse/app/components/emoji-picker.jsindex edeccd3781e..3bf856aa4a7 100644--- a/app/assets/javascripts/discourse/app/components/emoji-picker.js+++ b/app/assets/javascripts/discourse/app/components/emoji-picker.js@@ -84,7 +84,9 @@ export default Component.extend({document.addEventListener("click", this.handleOutsideClick);const emojiPicker = document.querySelector(".emoji-picker");- if (!emojiPicker) return;+ if (!emojiPicker) {+ return;+ }if (!this.site.isMobileDevice) {this._popper = createPopper(@@ -276,7 +278,9 @@ export default Component.extend({".emoji-picker .emoji-picker-category-buttons");- if (!categoryButtons) return;+ if (!categoryButtons) {+ return;+ }const button = categoryButtons.querySelector(`.category-button[data-section="${sectionName}"]`diff --git a/app/assets/javascripts/discourse/app/components/flat-button.js b/app/assets/javascripts/discourse/app/components/flat-button.jsindex c353035b304..927d19a2c43 100644--- a/app/assets/javascripts/discourse/app/components/flat-button.js+++ b/app/assets/javascripts/discourse/app/components/flat-button.js@@ -9,7 +9,9 @@ export default Component.extend({@discourseComputed("title")translatedTitle(title) {- if (title) return I18n.t(title);+ if (title) {+ return I18n.t(title);+ }},click() {diff --git a/app/assets/javascripts/discourse/app/components/future-date-input.js b/app/assets/javascripts/discourse/app/components/future-date-input.jsindex 9815cb23d53..9457e900b38 100644--- a/app/assets/javascripts/discourse/app/components/future-date-input.js+++ b/app/assets/javascripts/discourse/app/components/future-date-input.js@@ -104,7 +104,9 @@ export default Component.extend({didReceiveAttrs() {this._super(...arguments);- if (this.label) this.set("displayLabel", I18n.t(this.label));+ if (this.label) {+ this.set("displayLabel", I18n.t(this.label));+ }},@discourseComputed(@@ -129,7 +131,9 @@ export default Component.extend({displayNumberInput,duration) {- if (!statusType || willCloseImmediately) return false;+ if (!statusType || willCloseImmediately) {+ return false;+ }if (statusType === PUBLISH_TO_CATEGORY_STATUS_TYPE && isEmpty(categoryId)) {return false;diff --git a/app/assets/javascripts/discourse/app/components/global-notice.js b/app/assets/javascripts/discourse/app/components/global-notice.jsindex a1bc3fb2ef2..9eb7abdc765 100644--- a/app/assets/javascripts/discourse/app/components/global-notice.js+++ b/app/assets/javascripts/discourse/app/components/global-notice.js@@ -193,7 +193,9 @@ export default Component.extend({}const alert = document.getElementById(`global-notice-${notice.id}`);- if (alert) alert.style.display = "none";+ if (alert) {+ alert.style.display = "none";+ }},},diff --git a/app/assets/javascripts/discourse/app/components/group-flair-inputs.js b/app/assets/javascripts/discourse/app/components/group-flair-inputs.jsindex 36b02e5ff9f..1e4c43cd8d1 100644--- a/app/assets/javascripts/discourse/app/components/group-flair-inputs.js+++ b/app/assets/javascripts/discourse/app/components/group-flair-inputs.js@@ -42,11 +42,15 @@ export default Component.extend({h = "ajax-icon-holder",singleIconEl = `${c} .${h}`;- if (!icon) return;+ if (!icon) {+ return;+ }if (!$(`${c} symbol#${icon}`).length) {ajax(`/svg-sprite/search/${icon}`).then(function (data) {- if ($(singleIconEl).length === 0) $(c).append(`<div class="${h}">`);+ if ($(singleIconEl).length === 0) {+ $(c).append(`<div class="${h}">`);+ }$(singleIconEl).html(`<svg xmlns='http://www.w3.org/2000/svg' style='display: none;'>${data}</svg>`@@ -87,14 +91,18 @@ export default Component.extend({style += `background-color: #${flairBackgroundHexColor};`;}- if (flairHexColor) style += `color: #${flairHexColor};`;+ if (flairHexColor) {+ style += `color: #${flairHexColor};`;+ }return htmlSafe(style);},@discourseComputed("model.flairBackgroundHexColor")flairPreviewClasses(flairBackgroundHexColor) {- if (flairBackgroundHexColor) return "rounded";+ if (flairBackgroundHexColor) {+ return "rounded";+ }},@discourseComputed("flairPreviewImage")diff --git a/app/assets/javascripts/discourse/app/components/group-selector.js b/app/assets/javascripts/discourse/app/components/group-selector.jsindex b956fb68026..2516de122c3 100644--- a/app/assets/javascripts/discourse/app/components/group-selector.js+++ b/app/assets/javascripts/discourse/app/components/group-selector.js@@ -15,8 +15,9 @@ export default Component.extend({@observes("groupNames")_update() {- if (this.canReceiveUpdates === "true")+ if (this.canReceiveUpdates === "true") {this._initializeAutocomplete({ updateData: true });+ }},@on("didInsertElement")@@ -49,7 +50,9 @@ export default Component.extend({},dataSource: (term) => {return this.groupFinder(term).then((groups) => {- if (!selectedGroups) return groups;+ if (!selectedGroups) {+ return groups;+ }return groups.filter((group) => {return !selectedGroups.any((s) => s === group.name);diff --git a/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js b/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.jsindex 16d69d84333..e6c2af54baa 100644--- a/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js+++ b/app/assets/javascripts/discourse/app/components/groups-form-profile-fields.js@@ -32,7 +32,9 @@ export default Component.extend({@observes("nameInput")_validateName() {- if (this.nameInput === this.get("model.name")) return;+ if (this.nameInput === this.get("model.name")) {+ return;+ }if (this.nameInput === undefined) {return this._failedInputValidation();@@ -63,7 +65,9 @@ export default Component.extend({},checkGroupName: discourseDebounce(function () {- if (isEmpty(this.nameInput)) return;+ if (isEmpty(this.nameInput)) {+ return;+ }Group.checkName(this.nameInput).then((response) => {@@ -99,7 +103,9 @@ export default Component.extend({this.set("disableSave", true);const options = { failed: true };- if (reason) options.reason = reason;+ if (reason) {+ options.reason = reason;+ }this.set("basicNameValidation", EmberObject.create(options));},});diff --git a/app/assets/javascripts/discourse/app/components/image-uploader.js b/app/assets/javascripts/discourse/app/components/image-uploader.jsindex e30bbe8e302..c292d20641e 100644--- a/app/assets/javascripts/discourse/app/components/image-uploader.js+++ b/app/assets/javascripts/discourse/app/components/image-uploader.js@@ -54,7 +54,9 @@ export default Component.extend(UploadMixin, {@discourseComputed("imageUrl")imageBaseName(imageUrl) {- if (isEmpty(imageUrl)) return;+ if (isEmpty(imageUrl)) {+ return;+ }return imageUrl.split("/").slice(-1)[0];},@@ -86,7 +88,9 @@ export default Component.extend(UploadMixin, {},_applyLightbox() {- if (this.imageUrl) next(() => lightbox(this.element, this.siteSettings));+ if (this.imageUrl) {+ next(() => lightbox(this.element, this.siteSettings));+ }},actions: {diff --git a/app/assets/javascripts/discourse/app/components/invite-link-panel.js b/app/assets/javascripts/discourse/app/components/invite-link-panel.jsindex 93d7d7355ec..793b7426179 100644--- a/app/assets/javascripts/discourse/app/components/invite-link-panel.js+++ b/app/assets/javascripts/discourse/app/components/invite-link-panel.js@@ -30,9 +30,15 @@ export default Component.extend({@discourseComputed("isStaff", "inviteModel.saving", "maxRedemptionAllowed")disabled(isStaff, saving, canInviteTo, maxRedemptionAllowed) {- if (saving) return true;- if (!isStaff) return true;- if (maxRedemptionAllowed < 2) return true;+ if (saving) {+ return true;+ }+ if (!isStaff) {+ return true;+ }+ if (maxRedemptionAllowed < 2) {+ return true;+ }return false;},diff --git a/app/assets/javascripts/discourse/app/components/invite-panel.js b/app/assets/javascripts/discourse/app/components/invite-panel.jsindex 5fdf5815571..703195ae9ab 100644--- a/app/assets/javascripts/discourse/app/components/invite-panel.js+++ b/app/assets/javascripts/discourse/app/components/invite-panel.js@@ -57,8 +57,12 @@ export default Component.extend({saving,can_invite_to) {- if (saving) return true;- if (isEmpty(emailOrUsername)) return true;+ if (saving) {+ return true;+ }+ if (isEmpty(emailOrUsername)) {+ return true;+ }const emailTrimmed = emailOrUsername.trim();@@ -77,7 +81,9 @@ export default Component.extend({return true;}- if (can_invite_to) return false;+ if (can_invite_to) {+ return false;+ }return false;},@@ -98,9 +104,15 @@ export default Component.extend({groupIds,hasCustomMessage) {- if (hasCustomMessage) return true;- if (saving) return true;- if (isEmpty(emailOrUsername)) return true;+ if (hasCustomMessage) {+ return true;+ }+ if (saving) {+ return true;+ }+ if (isEmpty(emailOrUsername)) {+ return true;+ }const email = emailOrUsername.trim();diff --git a/app/assets/javascripts/discourse/app/components/quote-button.js b/app/assets/javascripts/discourse/app/components/quote-button.jsindex 0d075dbf54f..6665453a3a3 100644--- a/app/assets/javascripts/discourse/app/components/quote-button.js+++ b/app/assets/javascripts/discourse/app/components/quote-button.js@@ -16,7 +16,9 @@ import { alias } from "@ember/object/computed";function getQuoteTitle(element) {const titleEl = element.querySelector(".title");- if (!titleEl) return;+ if (!titleEl) {+ return;+ }return titleEl.textContent.trim().replace(/:$/, "");}diff --git a/app/assets/javascripts/discourse/app/components/search-advanced-options.js b/app/assets/javascripts/discourse/app/components/search-advanced-options.jsindex ecea3238a9d..4667653051d 100644--- a/app/assets/javascripts/discourse/app/components/search-advanced-options.js+++ b/app/assets/javascripts/discourse/app/components/search-advanced-options.js@@ -162,14 +162,20 @@ export default Component.extend({findSearchTerms() {const searchTerm = escapeExpression(this.searchTerm);- if (!searchTerm) return [];+ if (!searchTerm) {+ return [];+ }const blocks = searchTerm.match(REGEXP_BLOCKS);- if (!blocks) return [];+ if (!blocks) {+ return [];+ }let result = [];blocks.forEach((block) => {- if (block.length !== 0) result.push(block);+ if (block.length !== 0) {+ result.push(block);+ }});return result;@@ -177,11 +183,15 @@ export default Component.extend({filterBlocks(regexPrefix) {const blocks = this.findSearchTerms();- if (!blocks) return [];+ if (!blocks) {+ return [];+ }let result = [];blocks.forEach((block) => {- if (block.search(regexPrefix) !== -1) result.push(block);+ if (block.search(regexPrefix) !== -1) {+ result.push(block);+ }});return result;@@ -256,7 +266,9 @@ export default Component.extend({},setSearchedTermValueForTags() {- if (!this.siteSettings.tagging_enabled) return;+ if (!this.siteSettings.tagging_enabled) {+ return;+ }const match = this.filterBlocks(REGEXP_TAGS_PREFIX);const tags = this.get("searchedTerms.tags");@@ -455,36 +467,42 @@ export default Component.extend({const slug = categoryFilter.slug;if (categoryFilter.parentCategory) {const parentSlug = categoryFilter.parentCategory.slug;- if (slugCategoryMatches)+ if (slugCategoryMatches) {searchTerm = searchTerm.replace(slugCategoryMatches[0],`#${parentSlug}:${slug}`);- else if (idCategoryMatches)+ } else if (idCategoryMatches) {searchTerm = searchTerm.replace(idCategoryMatches[0],`category:${id}`);- else searchTerm += ` #${parentSlug}:${slug}`;+ } else {+ searchTerm += ` #${parentSlug}:${slug}`;+ }this._updateSearchTerm(searchTerm);} else {- if (slugCategoryMatches)+ if (slugCategoryMatches) {searchTerm = searchTerm.replace(slugCategoryMatches[0], `#${slug}`);- else if (idCategoryMatches)+ } else if (idCategoryMatches) {searchTerm = searchTerm.replace(idCategoryMatches[0],`category:${id}`);- else searchTerm += ` #${slug}`;+ } else {+ searchTerm += ` #${slug}`;+ }this._updateSearchTerm(searchTerm);}} else {- if (slugCategoryMatches)+ if (slugCategoryMatches) {searchTerm = searchTerm.replace(slugCategoryMatches[0], "");- if (idCategoryMatches)+ }+ if (idCategoryMatches) {searchTerm = searchTerm.replace(idCategoryMatches[0], "");+ }this._updateSearchTerm(searchTerm);}diff --git a/app/assets/javascripts/discourse/app/components/second-factor-input.js b/app/assets/javascripts/discourse/app/components/second-factor-input.jsindex 98ae6057032..f1a2ac9fcd2 100644--- a/app/assets/javascripts/discourse/app/components/second-factor-input.js+++ b/app/assets/javascripts/discourse/app/components/second-factor-input.js@@ -5,20 +5,31 @@ import { SECOND_FACTOR_METHODS } from "discourse/models/user";export default Component.extend({@discourseComputed("secondFactorMethod")type(secondFactorMethod) {- if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) return "tel";- if (secondFactorMethod === SECOND_FACTOR_METHODS.BACKUP_CODE) return "text";+ if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) {+ return "tel";+ }+ if (secondFactorMethod === SECOND_FACTOR_METHODS.BACKUP_CODE) {+ return "text";+ }},@discourseComputed("secondFactorMethod")pattern(secondFactorMethod) {- if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) return "[0-9]{6}";- if (secondFactorMethod === SECOND_FACTOR_METHODS.BACKUP_CODE)+ if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) {+ return "[0-9]{6}";+ }+ if (secondFactorMethod === SECOND_FACTOR_METHODS.BACKUP_CODE) {return "[a-z0-9]{16}";+ }},@discourseComputed("secondFactorMethod")maxlength(secondFactorMethod) {- if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) return "6";- if (secondFactorMethod === SECOND_FACTOR_METHODS.BACKUP_CODE) return "32";+ if (secondFactorMethod === SECOND_FACTOR_METHODS.TOTP) {+ return "6";+ }+ if (secondFactorMethod === SECOND_FACTOR_METHODS.BACKUP_CODE) {+ return "32";+ }},});diff --git a/app/assets/javascripts/discourse/app/components/site-header.js b/app/assets/javascripts/discourse/app/components/site-header.jsindex d69bfbd20c4..3784dcf4b46 100644--- a/app/assets/javascripts/discourse/app/components/site-header.js+++ b/app/assets/javascripts/discourse/app/components/site-header.js@@ -161,7 +161,9 @@ const SiteHeaderComponent = MountWidget.extend(Docking, PanEvents, {const $header = $("header.d-header");if (this.docAt === null) {- if (!($header && $header.length === 1)) return;+ if (!($header && $header.length === 1)) {+ return;+ }this.docAt = $header.offset().top;}diff --git a/app/assets/javascripts/discourse/app/components/tag-info.js b/app/assets/javascripts/discourse/app/components/tag-info.jsindex 15cb3a3f30a..5dc585f2d50 100644--- a/app/assets/javascripts/discourse/app/components/tag-info.js+++ b/app/assets/javascripts/discourse/app/components/tag-info.js@@ -89,7 +89,9 @@ export default Component.extend({bootbox.confirm(I18n.t("tagging.delete_synonym_confirm", { tag_name: tag.text }),(result) => {- if (!result) return;+ if (!result) {+ return;+ }tag.destroyRecord()@@ -106,7 +108,9 @@ export default Component.extend({tag_name: this.tagInfo.name,}),(result) => {- if (!result) return;+ if (!result) {+ return;+ }ajax(`/tag/${this.tagInfo.name}/synonyms`, {type: "POST",diff --git a/app/assets/javascripts/discourse/app/components/text-field.js b/app/assets/javascripts/discourse/app/components/text-field.jsindex 35c1f8bc11d..1a90c693406 100644--- a/app/assets/javascripts/discourse/app/components/text-field.js+++ b/app/assets/javascripts/discourse/app/components/text-field.js@@ -82,7 +82,9 @@ export default TextField.extend({@discourseComputed("placeholderKey")placeholder: {get() {- if (this._placeholder) return this._placeholder;+ if (this._placeholder) {+ return this._placeholder;+ }return this.placeholderKey ? I18n.t(this.placeholderKey) : "";},set(value) {diff --git a/app/assets/javascripts/discourse/app/components/time-input.js b/app/assets/javascripts/discourse/app/components/time-input.jsindex e40b9edd038..0163ee1dd98 100644--- a/app/assets/javascripts/discourse/app/components/time-input.js+++ b/app/assets/javascripts/discourse/app/components/time-input.js@@ -150,10 +150,18 @@ export default Component.extend({if (typeof time === "string" && time.length) {let [hours, minutes] = time.split(":");if (hours && minutes) {- if (hours < 0) hours = 0;- if (hours > 23) hours = 23;- if (minutes < 0) minutes = 0;- if (minutes > 59) minutes = 59;+ if (hours < 0) {+ hours = 0;+ }+ if (hours > 23) {+ hours = 23;+ }+ if (minutes < 0) {+ minutes = 0;+ }+ if (minutes > 59) {+ minutes = 59;+ }this.onChange({hours: parseInt(hours, 10),diff --git a/app/assets/javascripts/discourse/app/components/topic-list.js b/app/assets/javascripts/discourse/app/components/topic-list.jsindex d6e19135fbe..178fe9c82d1 100644--- a/app/assets/javascripts/discourse/app/components/topic-list.js+++ b/app/assets/javascripts/discourse/app/components/topic-list.js@@ -59,13 +59,17 @@ export default Component.extend(LoadMore, {scrolled() {this._super(...arguments);let onScroll = this.onScroll;- if (!onScroll) return;+ if (!onScroll) {+ return;+ }onScroll.call(this);},scrollToLastPosition() {- if (!this.scrollOnLoad) return;+ if (!this.scrollOnLoad) {+ return;+ }let scrollTo = this.session.get("topicListScrollPosition");if (scrollTo && scrollTo >= 0) {diff --git a/app/assets/javascripts/discourse/app/components/topic-progress.js b/app/assets/javascripts/discourse/app/components/topic-progress.jsindex 6bfb92a0763..1fa674c713e 100644--- a/app/assets/javascripts/discourse/app/components/topic-progress.js+++ b/app/assets/javascripts/discourse/app/components/topic-progress.js@@ -145,7 +145,9 @@ export default Component.extend({_dock() {const $wrapper = $(this.element);- if (!$wrapper || $wrapper.length === 0) return;+ if (!$wrapper || $wrapper.length === 0) {+ return;+ }const $html = $("html");const offset = window.pageYOffset || $html.scrollTop();diff --git a/app/assets/javascripts/discourse/app/components/topic-timer-info.js b/app/assets/javascripts/discourse/app/components/topic-timer-info.jsindex 177b5d9d6e5..da3ce4e7e22 100644--- a/app/assets/javascripts/discourse/app/components/topic-timer-info.js+++ b/app/assets/javascripts/discourse/app/components/topic-timer-info.js@@ -41,7 +41,9 @@ export default Component.extend({const topicStatus = this.topicClosed ? "close" : "open";const topicStatusKnown = this.topicClosed !== undefined;- if (topicStatusKnown && topicStatus === this.statusType) return;+ if (topicStatusKnown && topicStatus === this.statusType) {+ return;+ }const statusUpdateAt = moment(this.executeAt);const duration = moment.duration(statusUpdateAt - moment());diff --git a/app/assets/javascripts/discourse/app/controllers/change-timestamp.js b/app/assets/javascripts/discourse/app/controllers/change-timestamp.jsindex 81bd5e5b0ae..309555915fe 100644--- a/app/assets/javascripts/discourse/app/controllers/change-timestamp.js+++ b/app/assets/javascripts/discourse/app/controllers/change-timestamp.js@@ -32,7 +32,9 @@ export default Controller.extend(ModalFunctionality, {@discourseComputed("saving", "date", "validTimestamp")buttonDisabled(saving, date, validTimestamp) {- if (saving || validTimestamp) return true;+ if (saving || validTimestamp) {+ return true;+ }return isEmpty(date);},diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.jsindex 37421ae7a43..5e6ecde3495 100644--- a/app/assets/javascripts/discourse/app/controllers/composer.js+++ b/app/assets/javascripts/discourse/app/controllers/composer.js@@ -223,15 +223,20 @@ export default Controller.extend({@discourseComputed("model.action", "isWhispering")saveIcon(modelAction, isWhispering) {- if (isWhispering) return "far-eye-slash";+ if (isWhispering) {+ return "far-eye-slash";+ }return SAVE_ICONS[modelAction];},@discourseComputed("model.action", "isWhispering", "model.editConflict")saveLabel(modelAction, isWhispering, editConflict) {- if (editConflict) return "composer.overwrite_edit";- else if (isWhispering) return "composer.create_whisper";+ if (editConflict) {+ return "composer.overwrite_edit";+ } else if (isWhispering) {+ return "composer.create_whisper";+ }return SAVE_LABELS[modelAction];},@@ -361,13 +366,21 @@ export default Controller.extend({openComposer(options, post, topic) {this.open(options).then(() => {let url;- if (post) url = post.url;- if (!post && topic) url = topic.url;+ if (post) {+ url = post.url;+ }+ if (!post && topic) {+ url = topic.url;+ }let topicTitle;- if (topic) topicTitle = topic.title;+ if (topic) {+ topicTitle = topic.title;+ }- if (!url || !topicTitle) return;+ if (!url || !topicTitle) {+ return;+ }url = `${location.protocol}//${location.host}${url}`;const link = `[${escapeExpression(topicTitle)}](${url})`;@@ -613,7 +626,9 @@ export default Controller.extend({disableSubmit: or("model.loading", "isUploading"),save(force) {- if (this.disableSubmit) return;+ if (this.disableSubmit) {+ return;+ }// Clear the warning state if we're not showing the checkbox anymoreif (!this.showWarning) {@@ -851,7 +866,9 @@ export default Controller.extend({composerModel.draftKey === opts.draftKey) {composerModel.set("composeState", Composer.OPEN);- if (!opts.action) return resolve();+ if (!opts.action) {+ return resolve();+ }}// If it's a different draft, cancel it and try opening again.diff --git a/app/assets/javascripts/discourse/app/controllers/create-account.js b/app/assets/javascripts/discourse/app/controllers/create-account.jsindex 5fe14eacc52..b0afe35163c 100644--- a/app/assets/javascripts/discourse/app/controllers/create-account.js+++ b/app/assets/javascripts/discourse/app/controllers/create-account.js@@ -70,7 +70,9 @@ export default Controller.extend(@discourseComputed("formSubmitted")submitDisabled() {- if (this.formSubmitted) return true;+ if (this.formSubmitted) {+ return true;+ }return false;},@@ -78,8 +80,12 @@ export default Controller.extend(@discourseComputed("userFields", "hasAtLeastOneLoginButton")modalBodyClasses(userFields, hasAtLeastOneLoginButton) {const classes = [];- if (userFields) classes.push("has-user-fields");- if (hasAtLeastOneLoginButton) classes.push("has-alt-auth");+ if (userFields) {+ classes.push("has-user-fields");+ }+ if (hasAtLeastOneLoginButton) {+ classes.push("has-alt-auth");+ }return classes.join(" ");},diff --git a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js b/app/assets/javascripts/discourse/app/controllers/discovery/topics.jsindex bbef581447e..cea98abd74f 100644--- a/app/assets/javascripts/discourse/app/controllers/discovery/topics.js+++ b/app/assets/javascripts/discourse/app/controllers/discovery/topics.js@@ -136,7 +136,9 @@ const controllerOpts = {@discourseComputed("allLoaded", "model.topics.length")footerMessage(allLoaded, topicsLength) {- if (!allLoaded) return;+ if (!allLoaded) {+ return;+ }const category = this.category;if (category) {diff --git a/app/assets/javascripts/discourse/app/controllers/edit-category.js b/app/assets/javascripts/discourse/app/controllers/edit-category.jsindex f654c7094b9..5be7ee4f3c0 100644--- a/app/assets/javascripts/discourse/app/controllers/edit-category.js+++ b/app/assets/javascripts/discourse/app/controllers/edit-category.js@@ -58,9 +58,15 @@ export default Controller.extend(ModalFunctionality, {@discourseComputed("saving", "model.name", "model.color", "deleting")disabled(saving, name, color, deleting) {- if (saving || deleting) return true;- if (!name) return true;- if (!color) return true;+ if (saving || deleting) {+ return true;+ }+ if (!name) {+ return true;+ }+ if (!color) {+ return true;+ }return false;},@@ -77,7 +83,9 @@ export default Controller.extend(ModalFunctionality, {@discourseComputed("saving", "model.id")saveLabel(saving, id) {- if (saving) return "saving";+ if (saving) {+ return "saving";+ }return id ? "category.save" : "category.create";},diff --git a/app/assets/javascripts/discourse/app/controllers/exception.js b/app/assets/javascripts/discourse/app/controllers/exception.jsindex d85a899be70..badf33afc86 100644--- a/app/assets/javascripts/discourse/app/controllers/exception.js+++ b/app/assets/javascripts/discourse/app/controllers/exception.js@@ -34,10 +34,14 @@ export default Controller.extend({@discourseComputedisNetwork() {// never made it on the wire- if (this.get("thrown.readyState") === 0) return true;+ if (this.get("thrown.readyState") === 0) {+ return true;+ }// timed out- if (this.get("thrown.jqTextStatus") === "timeout") return true;+ if (this.get("thrown.jqTextStatus") === "timeout") {+ return true;+ }return false;},diff --git a/app/assets/javascripts/discourse/app/controllers/feature-topic.js b/app/assets/javascripts/discourse/app/controllers/feature-topic.jsindex 173ba1ecd71..8bf3bb9638e 100644--- a/app/assets/javascripts/discourse/app/controllers/feature-topic.js+++ b/app/assets/javascripts/discourse/app/controllers/feature-topic.js@@ -37,8 +37,12 @@ export default Controller.extend(ModalFunctionality, {)unPinMessage(categoryLink, pinnedGlobally, pinnedUntil) {let name = "topic.feature_topic.unpin";- if (pinnedGlobally) name += "_globally";- if (moment(pinnedUntil) > moment()) name += "_until";+ if (pinnedGlobally) {+ name += "_globally";+ }+ if (moment(pinnedUntil) > moment()) {+ name += "_until";+ }const until = moment(pinnedUntil).format("LL");return I18n.t(name, { categoryLink, until });diff --git a/app/assets/javascripts/discourse/app/controllers/flag.js b/app/assets/javascripts/discourse/app/controllers/flag.jsindex a2e7d872934..b2b81d60614 100644--- a/app/assets/javascripts/discourse/app/controllers/flag.js+++ b/app/assets/javascripts/discourse/app/controllers/flag.js@@ -88,7 +88,9 @@ export default Controller.extend(ModalFunctionality, {@discourseComputed("selected.is_custom_flag", "message.length")submitEnabled() {const selected = this.selected;- if (!selected) return false;+ if (!selected) {+ return false;+ }if (selected.get("is_custom_flag")) {const len = this.get("message.length") || 0;diff --git a/app/assets/javascripts/discourse/app/controllers/forgot-password.js b/app/assets/javascripts/discourse/app/controllers/forgot-password.jsindex 1a274da48b9..3da342f8f40 100644--- a/app/assets/javascripts/discourse/app/controllers/forgot-password.js+++ b/app/assets/javascripts/discourse/app/controllers/forgot-password.js@@ -39,7 +39,9 @@ export default Controller.extend(ModalFunctionality, {},resetPassword() {- if (this.submitDisabled) return false;+ if (this.submitDisabled) {+ return false;+ }this.set("disabled", true);this.clearFlash();diff --git a/app/assets/javascripts/discourse/app/controllers/full-page-search.js b/app/assets/javascripts/discourse/app/controllers/full-page-search.jsindex 89c158172a5..032b438c8e5 100644--- a/app/assets/javascripts/discourse/app/controllers/full-page-search.js+++ b/app/assets/javascripts/discourse/app/controllers/full-page-search.js@@ -312,7 +312,9 @@ export default Controller.extend({search() {this.set("page", 1);this._search();- if (this.site.mobileView) this.set("expanded", false);+ if (this.site.mobileView) {+ this.set("expanded", false);+ }},toggleAdvancedSearch() {diff --git a/app/assets/javascripts/discourse/app/controllers/group-manage-logs.js b/app/assets/javascripts/discourse/app/controllers/group-manage-logs.jsindex 9c881c69e34..48cd8e2d6b2 100644--- a/app/assets/javascripts/discourse/app/controllers/group-manage-logs.js+++ b/app/assets/javascripts/discourse/app/controllers/group-manage-logs.js@@ -56,7 +56,9 @@ export default Controller.extend({@actionloadMore() {- if (this.get("model.all_loaded")) return;+ if (this.get("model.all_loaded")) {+ return;+ }this.set("loading", true);diff --git a/app/assets/javascripts/discourse/app/controllers/login.js b/app/assets/javascripts/discourse/app/controllers/login.jsindex d3d5fa0d3c9..94468d4bae5 100644--- a/app/assets/javascripts/discourse/app/controllers/login.js+++ b/app/assets/javascripts/discourse/app/controllers/login.js@@ -70,8 +70,12 @@ export default Controller.extend(ModalFunctionality, {@discourseComputed("awaitingApproval", "hasAtLeastOneLoginButton")modalBodyClasses(awaitingApproval, hasAtLeastOneLoginButton) {const classes = ["login-modal"];- if (awaitingApproval) classes.push("awaiting-approval");- if (hasAtLeastOneLoginButton) classes.push("has-alt-auth");+ if (awaitingApproval) {+ classes.push("awaiting-approval");+ }+ if (hasAtLeastOneLoginButton) {+ classes.push("has-alt-auth");+ }return classes.join(" ");},@@ -183,7 +187,9 @@ export default Controller.extend(ModalFunctionality, {"hidden-login-form");const applyHiddenFormInputValue = (value, key) => {- if (!hiddenLoginForm) return;+ if (!hiddenLoginForm) {+ return;+ }hiddenLoginForm.querySelector(`input[name=${key}]`).value = value;};@@ -332,7 +338,9 @@ export default Controller.extend(ModalFunctionality, {showModal("login");next(() => {- if (callback) callback();+ if (callback) {+ callback();+ }this.flash(errorMsg, className || "success");});};diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/account.js b/app/assets/javascripts/discourse/app/controllers/preferences/account.jsindex 7a2d57375fb..f033cdc1f7c 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/account.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/account.js@@ -296,7 +296,9 @@ export default Controller.extend(CanCheckEmails, {}).then(() => {- if (!token) logout(); // All sessions revoked+ if (!token) {+ logout();+ } // All sessions revoked}).catch(popupAjaxError);},diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/email.js b/app/assets/javascripts/discourse/app/controllers/preferences/email.jsindex 53a2cf6c7d6..f18ed92c997 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/email.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/email.js@@ -35,8 +35,12 @@ export default Controller.extend({@discourseComputed("saving", "new")saveButtonText(saving, isNew) {- if (saving) return I18n.t("saving");- if (isNew) return I18n.t("user.add_email.add");+ if (saving) {+ return I18n.t("saving");+ }+ if (isNew) {+ return I18n.t("user.add_email.add");+ }return I18n.t("user.change");},diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js b/app/assets/javascripts/discourse/app/controllers/preferences/interface.jsindex 54137cb6df0..ba3b14f2cbc 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js@@ -381,9 +381,13 @@ export default Controller.extend({});const darkStylesheet = document.querySelector("link#cs-preview-dark"),lightStylesheet = document.querySelector("link#cs-preview-light");- if (darkStylesheet) darkStylesheet.remove();+ if (darkStylesheet) {+ darkStylesheet.remove();+ }- if (lightStylesheet) lightStylesheet.remove();+ if (lightStylesheet) {+ lightStylesheet.remove();+ }},},});diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.js b/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.jsindex ca565e79dfc..c1746d4ed9a 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/second-factor.js@@ -93,7 +93,9 @@ export default Controller.extend(CanCheckEmails, {actions: {confirmPassword() {- if (!this.password) return;+ if (!this.password) {+ return;+ }this.markDirty();this.loadSecondFactors();this.set("password", null);diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/username.js b/app/assets/javascripts/discourse/app/controllers/preferences/username.jsindex ba78a7a7bec..707b08e745e 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/username.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/username.js@@ -38,8 +38,12 @@ export default Controller.extend({this.set("taken", false);this.set("errorMessage", null);- if (isEmpty(this.newUsername)) return;- if (this.unchanged) return;+ if (isEmpty(this.newUsername)) {+ return;+ }+ if (this.unchanged) {+ return;+ }User.checkUsername(newUsername, undefined, this.get("model.id")).then((result) => {@@ -55,7 +59,9 @@ export default Controller.extend({@discourseComputed("saving")saveButtonText(saving) {- if (saving) return I18n.t("saving");+ if (saving) {+ return I18n.t("saving");+ }return I18n.t("user.change");},diff --git a/app/assets/javascripts/discourse/app/controllers/tags-show.js b/app/assets/javascripts/discourse/app/controllers/tags-show.jsindex aa7e3ee56c6..86d8258da91 100644--- a/app/assets/javascripts/discourse/app/controllers/tags-show.js+++ b/app/assets/javascripts/discourse/app/controllers/tags-show.js@@ -166,7 +166,9 @@ export default Controller.extend(BulkTopicSelection, FilterModeMixin, {}bootbox.confirm(confirmText, (result) => {- if (!result) return;+ if (!result) {+ return;+ }this.tag.destroyRecord()diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.jsindex e74cc34ba03..03f90ce7cf3 100644--- a/app/assets/javascripts/discourse/app/controllers/topic.js+++ b/app/assets/javascripts/discourse/app/controllers/topic.js@@ -242,7 +242,9 @@ export default Controller.extend(bufferedProperty("model"), {},_loadPostIds(post) {- if (this.loadingPostIds) return;+ if (this.loadingPostIds) {+ return;+ }const postStream = this.get("model.postStream");const url = `/t/${this.get("model.id")}/post_ids.json`;@@ -805,7 +807,9 @@ export default Controller.extend(bufferedProperty("model"), {(result) => {if (result) {// If all posts are selected, it's the same thing as deleting the topic- if (this.selectedAllPosts) return this.deleteTopic();+ if (this.selectedAllPosts) {+ return this.deleteTopic();+ }Post.deleteMany(this.selectedPostIds);this.get("model.postStream.posts").forEach(@@ -1317,7 +1321,9 @@ export default Controller.extend(bufferedProperty("model"), {topic.reload().then(() => {this.send("postChangedRoute", topic.get("post_number") || 1);this.appEvents.trigger("header:update-topic", topic);- if (data.refresh_stream) postStream.refresh();+ if (data.refresh_stream) {+ postStream.refresh();+ }});return;@@ -1413,14 +1419,18 @@ export default Controller.extend(bufferedProperty("model"), {_scrollToPost: discourseDebounce(function (postNumber) {const $post = $(`.topic-post article#post_${postNumber}`);- if ($post.length === 0 || isElementInViewport($post)) return;+ if ($post.length === 0 || isElementInViewport($post)) {+ return;+ }$("html, body").animate({ scrollTop: $post.offset().top }, 1000);}, 500),unsubscribe() {// never unsubscribe when navigating from topic to topic- if (!this.get("model.id")) return;+ if (!this.get("model.id")) {+ return;+ }this.messageBus.unsubscribe("/topic/*");},diff --git a/app/assets/javascripts/discourse/app/controllers/user-topics-list.js b/app/assets/javascripts/discourse/app/controllers/user-topics-list.jsindex b92738b0522..1480d4633ed 100644--- a/app/assets/javascripts/discourse/app/controllers/user-topics-list.js+++ b/app/assets/javascripts/discourse/app/controllers/user-topics-list.js@@ -44,7 +44,9 @@ export default Controller.extend({unsubscribe() {const channel = this.channel;- if (channel) this.messageBus.unsubscribe(channel);+ if (channel) {+ this.messageBus.unsubscribe(channel);+ }this._resetTracking();this.set("channel", null);},diff --git a/app/assets/javascripts/discourse/app/helpers/category-link.js b/app/assets/javascripts/discourse/app/helpers/category-link.jsindex 906c40d8b29..63e8bc695df 100644--- a/app/assets/javascripts/discourse/app/helpers/category-link.js+++ b/app/assets/javascripts/discourse/app/helpers/category-link.js@@ -47,8 +47,9 @@ export function categoryBadgeHTML(category, opts) {(!opts.allowUncategorized &&get(category, "id") === Site.currentProp("uncategorized_category_id") &&siteSettings.suppress_uncategorized_badge)- )+ ) {return "";+ }const depth = (opts.depth || 1) + 1;if (opts.recursive && depth <= siteSettings.max_category_nesting) {diff --git a/app/assets/javascripts/discourse/app/helpers/cold-age-class.js b/app/assets/javascripts/discourse/app/helpers/cold-age-class.jsindex 2383774eae9..06f269e3b62 100644--- a/app/assets/javascripts/discourse/app/helpers/cold-age-class.js+++ b/app/assets/javascripts/discourse/app/helpers/cold-age-class.js@@ -19,12 +19,15 @@ registerUnbound("cold-age-class", function (dt, params) {epochDays = daysSinceEpoch(new Date(dt));let siteSettings = helperContext().siteSettings;- if (nowDays - epochDays > siteSettings.cold_age_days_high)+ if (nowDays - epochDays > siteSettings.cold_age_days_high) {return className + " coldmap-high";- if (nowDays - epochDays > siteSettings.cold_age_days_medium)+ }+ if (nowDays - epochDays > siteSettings.cold_age_days_medium) {return className + " coldmap-med";- if (nowDays - epochDays > siteSettings.cold_age_days_low)+ }+ if (nowDays - epochDays > siteSettings.cold_age_days_low) {return className + " coldmap-low";+ }return className;});diff --git a/app/assets/javascripts/discourse/app/initializers/badging.js b/app/assets/javascripts/discourse/app/initializers/badging.jsindex 835bc6ca8e8..f5a73b64366 100644--- a/app/assets/javascripts/discourse/app/initializers/badging.js+++ b/app/assets/javascripts/discourse/app/initializers/badging.js@@ -4,10 +4,14 @@ export default {after: "message-bus",initialize(container) {- if (!navigator.setAppBadge) return; // must have the Badging API+ if (!navigator.setAppBadge) {+ return;+ } // must have the Badging APIconst user = container.lookup("current-user:main");- if (!user) return; // must be logged in+ if (!user) {+ return;+ } // must be logged inthis.notifications =user.unread_notifications + user.unread_high_priority_notifications;diff --git a/app/assets/javascripts/discourse/app/initializers/localization.js b/app/assets/javascripts/discourse/app/initializers/localization.jsindex 20bf681dfd7..266aaf70665 100644--- a/app/assets/javascripts/discourse/app/initializers/localization.js+++ b/app/assets/javascripts/discourse/app/initializers/localization.js@@ -7,7 +7,9 @@ export default {isVerboseLocalizationEnabled(container) {const siteSettings = container.lookup("site-settings:main");- if (siteSettings.verbose_localization) return true;+ if (siteSettings.verbose_localization) {+ return true;+ }try {return sessionStorage && sessionStorage.getItem("verbose_localization");@@ -33,7 +35,9 @@ export default {let i = 0;for (; i < segs.length - 1; i++) {- if (!(segs[i] in node)) node[segs[i]] = {};+ if (!(segs[i] in node)) {+ node[segs[i]] = {};+ }node = node[segs[i]];}diff --git a/app/assets/javascripts/discourse/app/initializers/post-decorations.js b/app/assets/javascripts/discourse/app/initializers/post-decorations.jsindex 83bd7a13271..bdc13546367 100644--- a/app/assets/javascripts/discourse/app/initializers/post-decorations.js+++ b/app/assets/javascripts/discourse/app/initializers/post-decorations.js@@ -57,8 +57,9 @@ export default {api.decorateCookedElement((elem) => {elem.querySelectorAll("video").forEach((video) => {- if (video.poster && video.poster !== "" && !video.autoplay)+ if (video.poster && video.poster !== "" && !video.autoplay) {return;+ }const source = video.querySelector("source");if (source) {diff --git a/app/assets/javascripts/discourse/app/initializers/signup-cta.js b/app/assets/javascripts/discourse/app/initializers/signup-cta.jsindex d08743bc006..48df8e19d04 100644--- a/app/assets/javascripts/discourse/app/initializers/signup-cta.js+++ b/app/assets/javascripts/discourse/app/initializers/signup-cta.js@@ -18,12 +18,24 @@ export default {screenTrack.keyValueStore = keyValueStore;// Preconditions- if (user) return; // must not be logged in- if (keyValueStore.get("anon-cta-never")) return; // "never show again"- if (!siteSettings.allow_new_registrations) return;- if (siteSettings.invite_only) return;- if (siteSettings.login_required) return;- if (!siteSettings.enable_signup_cta) return;+ if (user) {+ return;+ } // must not be logged in+ if (keyValueStore.get("anon-cta-never")) {+ return;+ } // "never show again"+ if (!siteSettings.allow_new_registrations) {+ return;+ }+ if (siteSettings.invite_only) {+ return;+ }+ if (siteSettings.login_required) {+ return;+ }+ if (!siteSettings.enable_signup_cta) {+ return;+ }function checkSignupCtaRequirements() {if (session.get("showSignupCta")) {diff --git a/app/assets/javascripts/discourse/app/lib/after-transition.js b/app/assets/javascripts/discourse/app/lib/after-transition.jsindex fbb78b82d35..16c57b53cff 100644--- a/app/assets/javascripts/discourse/app/lib/after-transition.js+++ b/app/assets/javascripts/discourse/app/lib/after-transition.js@@ -26,7 +26,9 @@ var transitionEnd = (function () {export default function (element, callback) {return $(element).on(transitionEnd, (event) => {- if (event.target !== event.currentTarget) return;+ if (event.target !== event.currentTarget) {+ return;+ }return callback(event);});}diff --git a/app/assets/javascripts/discourse/app/lib/ajax.js b/app/assets/javascripts/discourse/app/lib/ajax.jsindex 4f0ec22b4de..79fba4949c6 100644--- a/app/assets/javascripts/discourse/app/lib/ajax.js+++ b/app/assets/javascripts/discourse/app/lib/ajax.js@@ -129,7 +129,9 @@ export function ajax() {}// If it's a parsererror, don't reject- if (xhr.status === 200) return args.success(xhr);+ if (xhr.status === 200) {+ return args.success(xhr);+ }// Fill in some extra infoxhr.jqTextStatus = textStatus;@@ -149,9 +151,12 @@ export function ajax() {// We default to JSON on GET. If we don't, sometimes if the server doesn't return the proper header// it will not be parsed as an object.- if (!args.type) args.type = "GET";- if (!args.dataType && args.type.toUpperCase() === "GET")+ if (!args.type) {+ args.type = "GET";+ }+ if (!args.dataType && args.type.toUpperCase() === "GET") {args.dataType = "json";+ }if (args.dataType === "script") {args.headers["Discourse-Script"] = true;diff --git a/app/assets/javascripts/discourse/app/lib/autocomplete.js b/app/assets/javascripts/discourse/app/lib/autocomplete.jsindex 8a360248bfc..b9b32f6ff5d 100644--- a/app/assets/javascripts/discourse/app/lib/autocomplete.js+++ b/app/assets/javascripts/discourse/app/lib/autocomplete.js@@ -45,7 +45,9 @@ let inputTimeout;export default function (options) {const autocompletePlugin = this;- if (this.length === 0) return;+ if (this.length === 0) {+ return;+ }if (options === "destroy" || options.updateData) {cancel(inputTimeout);@@ -58,7 +60,9 @@ export default function (options) {$(window).off("click.autocomplete");- if (options === "destroy") return;+ if (options === "destroy") {+ return;+ }}if (options && options.cancel && this.data("closeAutocomplete")) {@@ -263,7 +267,9 @@ export default function (options) {if (div) {div.hide().remove();}- if (autocompleteOptions.length === 0) return;+ if (autocompleteOptions.length === 0) {+ return;+ }div = $(options.template({ options: autocompleteOptions }));@@ -295,7 +301,9 @@ export default function (options) {});hOffset = 10;- if (options.treatAsTextarea) vOffset = -32;+ if (options.treatAsTextarea) {+ vOffset = -32;+ }}div.css({@@ -366,7 +374,9 @@ export default function (options) {}function updateAutoComplete(r) {- if (completeStart === null || r === SKIP) return;+ if (completeStart === null || r === SKIP) {+ return;+ }if (r && r.then && typeof r.then === "function") {if (div) {@@ -419,7 +429,9 @@ export default function (options) {});function performAutocomplete(e) {- if ([keys.esc, keys.enter].indexOf(e.which) !== -1) return true;+ if ([keys.esc, keys.enter].indexOf(e.which) !== -1) {+ return true;+ }let cp = caretPosition(me[0]);const key = me[0].value[cp - 1];@@ -483,7 +495,9 @@ export default function (options) {if (!options.key) {completeStart = 0;}- if (e.which === keys.shift) return;+ if (e.which === keys.shift) {+ return;+ }if (completeStart === null && e.which === keys.backSpace && options.key) {c = caretPosition(me[0]);c -= 1;@@ -537,7 +551,9 @@ export default function (options) {switch (e.which) {case keys.enter:case keys.tab:- if (!autocompleteOptions) return true;+ if (!autocompleteOptions) {+ return true;+ }if (selectedOption >= 0 &&(userToComplete = autocompleteOptions[selectedOption])diff --git a/app/assets/javascripts/discourse/app/lib/autosize.js b/app/assets/javascripts/discourse/app/lib/autosize.jsindex 52f6f5a385a..9e5f5738020 100644--- a/app/assets/javascripts/discourse/app/lib/autosize.js+++ b/app/assets/javascripts/discourse/app/lib/autosize.js@@ -18,7 +18,9 @@ const set =})();function assign(ta, { setOverflowX = true, setOverflowY = true } = {}) {- if (!ta || !ta.nodeName || ta.nodeName !== "TEXTAREA" || set.has(ta)) return;+ if (!ta || !ta.nodeName || ta.nodeName !== "TEXTAREA" || set.has(ta)) {+ return;+ }let heightOffset = null;let overflowY = null;@@ -165,14 +167,18 @@ function assign(ta, { setOverflowX = true, setOverflowY = true } = {}) {}function exportDestroy(ta) {- if (!(ta && ta.nodeName && ta.nodeName === "TEXTAREA")) return;+ if (!(ta && ta.nodeName && ta.nodeName === "TEXTAREA")) {+ return;+ }const evt = document.createEvent("Event");evt.initEvent("autosize:destroy", true, false);ta.dispatchEvent(evt);}function exportUpdate(ta) {- if (!(ta && ta.nodeName && ta.nodeName === "TEXTAREA")) return;+ if (!(ta && ta.nodeName && ta.nodeName === "TEXTAREA")) {+ return;+ }const evt = document.createEvent("Event");evt.initEvent("autosize:update", true, false);ta.dispatchEvent(evt);diff --git a/app/assets/javascripts/discourse/app/lib/category-hashtags.js b/app/assets/javascripts/discourse/app/lib/category-hashtags.jsindex 7f015c7d49b..2aa56c3bbc2 100644--- a/app/assets/javascripts/discourse/app/lib/category-hashtags.js+++ b/app/assets/javascripts/discourse/app/lib/category-hashtags.js@@ -23,7 +23,9 @@ export function categoryHashtagTriggerRule(textarea, opts) {line = line.slice(0, line.length - 1);// Don't trigger autocomplete when backspacing into a `#category |` => `#category|`- if (/^#{1}\w+/.test(line)) return false;+ if (/^#{1}\w+/.test(line)) {+ return false;+ }}// Don't trigger autocomplete when ATX-style headers are useddiff --git a/app/assets/javascripts/discourse/app/lib/category-tag-search.js b/app/assets/javascripts/discourse/app/lib/category-tag-search.jsindex f780c537d07..460e4770cb1 100644--- a/app/assets/javascripts/discourse/app/lib/category-tag-search.js+++ b/app/assets/javascripts/discourse/app/lib/category-tag-search.js@@ -73,9 +73,13 @@ export function search(term, siteSettings) {oldSearch = null;}- if (new Date() - cacheTime > 30000) cache = {};+ if (new Date() - cacheTime > 30000) {+ cache = {};+ }const cached = cache[term];- if (cached) return cached;+ if (cached) {+ return cached;+ }const limit = 5;var categories = Category.search(term, { limit });diff --git a/app/assets/javascripts/discourse/app/lib/discourse-location.js b/app/assets/javascripts/discourse/app/lib/discourse-location.jsindex 4fbb387811f..0dff2254c3f 100644--- a/app/assets/javascripts/discourse/app/lib/discourse-location.js+++ b/app/assets/javascripts/discourse/app/lib/discourse-location.js@@ -182,7 +182,9 @@ const DiscourseLocation = EmberObject.extend({// Ignore initial page load popstate event in Chromeif (!popstateFired) {popstateFired = true;- if (url === this._previousURL) return;+ if (url === this._previousURL) {+ return;+ }}popstateCallbacks.forEach((cb) => cb(url));diff --git a/app/assets/javascripts/discourse/app/lib/eyeline.js b/app/assets/javascripts/discourse/app/lib/eyeline.jsindex 239a72e068e..9190bf05dcf 100644--- a/app/assets/javascripts/discourse/app/lib/eyeline.js+++ b/app/assets/javascripts/discourse/app/lib/eyeline.js@@ -62,19 +62,29 @@ Eyeline.prototype.update = function () {let markSeen = false;// Make sure the element is visible- if (!$elem.is(":visible")) return true;+ if (!$elem.is(":visible")) {+ return true;+ }// It's seen if...// ...the element is vertically within the top and botom- if (elemTop <= docViewBottom && elemTop >= docViewTop) markSeen = true;+ if (elemTop <= docViewBottom && elemTop >= docViewTop) {+ markSeen = true;+ }// ...the element top is above the top and the bottom is below the bottom (large elements)- if (elemTop <= docViewTop && elemBottom >= docViewBottom) markSeen = true;+ if (elemTop <= docViewTop && elemBottom >= docViewBottom) {+ markSeen = true;+ }// ...we're at the bottom and the bottom of the element is visible (large bottom elements)- if (atBottom && elemBottom >= docViewTop) markSeen = true;+ if (atBottom && elemBottom >= docViewTop) {+ markSeen = true;+ }- if (!markSeen) return true;+ if (!markSeen) {+ return true;+ }// If you hit the bottom we mark all the elements as seen. Otherwise, just the first oneif (!atBottom) {diff --git a/app/assets/javascripts/discourse/app/lib/formatter.js b/app/assets/javascripts/discourse/app/lib/formatter.jsindex 1fbe19c59d4..6415fa08a55 100644--- a/app/assets/javascripts/discourse/app/lib/formatter.js+++ b/app/assets/javascripts/discourse/app/lib/formatter.js@@ -29,13 +29,17 @@ export function toTitleCase(str) {}export function longDate(dt) {- if (!dt) return;+ if (!dt) {+ return;+ }return moment(dt).format(I18n.t("dates.long_with_year"));}// suppress year, if current yearexport function longDateNoYear(dt) {- if (!dt) return;+ if (!dt) {+ return;+ }if (new Date().getFullYear() !== dt.getFullYear()) {return moment(dt).format(I18n.t("dates.long_date_with_year"));@@ -58,8 +62,12 @@ export function updateRelativeAge(elems) {}export function autoUpdatingRelativeAge(date, options) {- if (!date) return "";- if (+date === +new Date(0)) return "";+ if (!date) {+ return "";+ }+ if (+date === +new Date(0)) {+ return "";+ }options = options || {};let format = options.format || "tiny";@@ -316,7 +324,9 @@ export function number(val) {let formattedNumber;val = Math.round(parseFloat(val));- if (isNaN(val)) val = 0;+ if (isNaN(val)) {+ val = 0;+ }if (val > 999999) {formattedNumber = I18n.toNumber(val / 1000000, { precision: 1 });diff --git a/app/assets/javascripts/discourse/app/lib/highlight-html.js b/app/assets/javascripts/discourse/app/lib/highlight-html.jsindex 4839dac9c66..3e7ffd87742 100644--- a/app/assets/javascripts/discourse/app/lib/highlight-html.js+++ b/app/assets/javascripts/discourse/app/lib/highlight-html.js@@ -47,7 +47,9 @@ export default function (node, words, opts = {}) {.filter(Boolean).map((word) => word.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));- if (!words.length) return node;+ if (!words.length) {+ return node;+ }const pattern = `(${words.join(" ")})`;let flag;diff --git a/app/assets/javascripts/discourse/app/lib/highlight-search.js b/app/assets/javascripts/discourse/app/lib/highlight-search.jsindex bf2ce000c15..cbba3540dd8 100644--- a/app/assets/javascripts/discourse/app/lib/highlight-search.js+++ b/app/assets/javascripts/discourse/app/lib/highlight-search.js@@ -13,7 +13,9 @@ export default function (elem, term, opts = {}) {.map((w) => w.replace(/^"(.*)"$/, "$1"));const highlightOpts = {};- if (!opts.defaultClassName) highlightOpts.className = CLASS_NAME;+ if (!opts.defaultClassName) {+ highlightOpts.className = CLASS_NAME;+ }highlightHTML(elem, words, highlightOpts);}}diff --git a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.jsindex 3bb535f5e9b..0eddd8bfe84 100644--- a/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js+++ b/app/assets/javascripts/discourse/app/lib/keyboard-shortcuts.js@@ -614,8 +614,12 @@ export default {// Try scrolling to post above or below.if ($selected.length !== 0) {- if (direction === -1 && index === 0) return;- if (direction === 1 && index === $articles.length - 1) return;+ if (direction === -1 && index === 0) {+ return;+ }+ if (direction === 1 && index === $articles.length - 1) {+ return;+ }}$article = $articles.eq(index + direction);diff --git a/app/assets/javascripts/discourse/app/lib/offset-calculator.js b/app/assets/javascripts/discourse/app/lib/offset-calculator.jsindex 2a1ed66c014..c8e43d63029 100644--- a/app/assets/javascripts/discourse/app/lib/offset-calculator.js+++ b/app/assets/javascripts/discourse/app/lib/offset-calculator.js@@ -13,7 +13,9 @@ export default function offsetCalculator() {const min = minimumOffset();// on mobile, just use the header- if ($("html").hasClass("mobile-view")) return min;+ if ($("html").hasClass("mobile-view")) {+ return min;+ }const $window = $(window);const windowHeight = $window.height();@@ -21,7 +23,9 @@ export default function offsetCalculator() {const topicBottomOffsetTop = $("#topic-bottom").offset().top;// the footer is bigger than the window, we can scroll down past the last post- if (documentHeight - windowHeight > topicBottomOffsetTop) return min;+ if (documentHeight - windowHeight > topicBottomOffsetTop) {+ return min;+ }const scrollTop = $window.scrollTop();const visibleBottomHeight = scrollTop + windowHeight - topicBottomOffsetTop;diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.js b/app/assets/javascripts/discourse/app/lib/plugin-api.jsindex e1812ff6e7e..56fa57a29ee 100644--- a/app/assets/javascripts/discourse/app/lib/plugin-api.js+++ b/app/assets/javascripts/discourse/app/lib/plugin-api.js@@ -302,7 +302,9 @@ class PluginApi {} else if (result.emoji) {iconBody = result.emoji.split("|").map((name) => {let widgetAttrs = { name };- if (result.emojiTitle) widgetAttrs.title = true;+ if (result.emojiTitle) {+ widgetAttrs.title = true;+ }return dec.attach("emoji", widgetAttrs);});}diff --git a/app/assets/javascripts/discourse/app/lib/preload-store.js b/app/assets/javascripts/discourse/app/lib/preload-store.jsindex 04fb837d824..9fe7ca37888 100644--- a/app/assets/javascripts/discourse/app/lib/preload-store.js+++ b/app/assets/javascripts/discourse/app/lib/preload-store.js@@ -45,7 +45,9 @@ export default {},remove(key) {- if (this.data[key]) delete this.data[key];+ if (this.data[key]) {+ delete this.data[key];+ }},reset() {diff --git a/app/assets/javascripts/discourse/app/lib/push-notifications.js b/app/assets/javascripts/discourse/app/lib/push-notifications.jsindex 59c14defbab..40d4f27a2c4 100644--- a/app/assets/javascripts/discourse/app/lib/push-notifications.js+++ b/app/assets/javascripts/discourse/app/lib/push-notifications.js@@ -21,8 +21,12 @@ function userAgentVersionChecker(agent, version, mobileView) {const uaMatch = navigator.userAgent.match(new RegExp(`${agent}\/(\\d+)\\.\\d`));- if (uaMatch && mobileView) return false;- if (!uaMatch || parseInt(uaMatch[1], 10) < version) return false;+ if (uaMatch && mobileView) {+ return false;+ }+ if (!uaMatch || parseInt(uaMatch[1], 10) < version) {+ return false;+ }return true;}@@ -77,8 +81,12 @@ export function isPushNotificationsEnabled(user, mobileView) {}export function register(user, mobileView, router, appEvents) {- if (!isPushNotificationsSupported(mobileView)) return;- if (Notification.permission === "denied" || !user) return;+ if (!isPushNotificationsSupported(mobileView)) {+ return;+ }+ if (Notification.permission === "denied" || !user) {+ return;+ }navigator.serviceWorker.ready.then((serviceWorkerRegistration) => {serviceWorkerRegistration.pushManager@@ -106,7 +114,9 @@ export function register(user, mobileView, router, appEvents) {}export function subscribe(callback, applicationServerKey, mobileView) {- if (!isPushNotificationsSupported(mobileView)) return;+ if (!isPushNotificationsSupported(mobileView)) {+ return;+ }navigator.serviceWorker.ready.then((serviceWorkerRegistration) => {serviceWorkerRegistration.pushManager@@ -116,7 +126,9 @@ export function subscribe(callback, applicationServerKey, mobileView) {}).then((subscription) => {sendSubscriptionToServer(subscription, true);- if (callback) callback();+ if (callback) {+ callback();+ }}).catch((e) => {// eslint-disable-next-line no-console@@ -126,7 +138,9 @@ export function subscribe(callback, applicationServerKey, mobileView) {}export function unsubscribe(user, callback, mobileView) {- if (!isPushNotificationsSupported(mobileView)) return;+ if (!isPushNotificationsSupported(mobileView)) {+ return;+ }keyValueStore.setItem(userSubscriptionKey(user), "");navigator.serviceWorker.ready.then((serviceWorkerRegistration) => {@@ -149,6 +163,8 @@ export function unsubscribe(user, callback, mobileView) {console.error(e);});- if (callback) callback();+ if (callback) {+ callback();+ }});}diff --git a/app/assets/javascripts/discourse/app/lib/quote.js b/app/assets/javascripts/discourse/app/lib/quote.jsindex 3a04577c765..d965833a6ee 100644--- a/app/assets/javascripts/discourse/app/lib/quote.js+++ b/app/assets/javascripts/discourse/app/lib/quote.js@@ -12,7 +12,9 @@ export function buildQuote(post, contents, opts = {}) {`topic:${opts.topic || post.topic_id}`,];- if (opts.full) params.push("full:true");+ if (opts.full) {+ params.push("full:true");+ }return `[quote="${params.join(", ")}"]\n${contents.trim()}\n[/quote]\n\n`;}diff --git a/app/assets/javascripts/discourse/app/lib/reports-loader.js b/app/assets/javascripts/discourse/app/lib/reports-loader.jsindex 53c6350201a..675f296ef9f 100644--- a/app/assets/javascripts/discourse/app/lib/reports-loader.js+++ b/app/assets/javascripts/discourse/app/lib/reports-loader.js@@ -37,8 +37,12 @@ export default {},_processQueue() {- if (_queue.length === 0) return;- if (_processing >= MAX_CONCURRENCY) return;+ if (_queue.length === 0) {+ return;+ }+ if (_processing >= MAX_CONCURRENCY) {+ return;+ }_processing++;diff --git a/app/assets/javascripts/discourse/app/lib/screen-track.js b/app/assets/javascripts/discourse/app/lib/screen-track.jsindex ec17c138f69..028d63e3a74 100644--- a/app/assets/javascripts/discourse/app/lib/screen-track.js+++ b/app/assets/javascripts/discourse/app/lib/screen-track.js@@ -168,8 +168,9 @@ export default class {if (error.status === 405 &&error.responseJSON.error_type === "read_only"- )+ ) {return;+ }}).finally(() => {this._inProgress = false;diff --git a/app/assets/javascripts/discourse/app/lib/search.js b/app/assets/javascripts/discourse/app/lib/search.jsindex 2bf4c36cc0d..fe5d7a6cf03 100644--- a/app/assets/javascripts/discourse/app/lib/search.js+++ b/app/assets/javascripts/discourse/app/lib/search.js@@ -133,14 +133,21 @@ export function translateResults(results, opts) {}export function searchForTerm(term, opts) {- if (!opts) opts = {};+ if (!opts) {+ opts = {};+ }// Only include the data we haveconst data = { term: term };- if (opts.typeFilter) data.type_filter = opts.typeFilter;- if (opts.searchForId) data.search_for_id = true;- if (opts.restrictToArchetype)+ if (opts.typeFilter) {+ data.type_filter = opts.typeFilter;+ }+ if (opts.searchForId) {+ data.search_for_id = true;+ }+ if (opts.restrictToArchetype) {data.restrict_to_archetype = opts.restrictToArchetype;+ }if (opts.searchContext) {data.search_context = {diff --git a/app/assets/javascripts/discourse/app/lib/to-markdown.js b/app/assets/javascripts/discourse/app/lib/to-markdown.jsindex 8c35f87ca07..78e16d59015 100644--- a/app/assets/javascripts/discourse/app/lib/to-markdown.js+++ b/app/assets/javascripts/discourse/app/lib/to-markdown.js@@ -284,7 +284,9 @@ export class Tag {const pAttr = (e.parent && e.parent.attributes) || {};let src = attr.src || pAttr.src;const base62SHA1 = attr["data-base62-sha1"];- if (base62SHA1) src = `upload://${base62SHA1}`;+ if (base62SHA1) {+ src = `upload://${base62SHA1}`;+ }const cssClass = attr.class || pAttr.class;if (cssClass && cssClass.includes("emoji")) {diff --git a/app/assets/javascripts/discourse/app/lib/uploads.js b/app/assets/javascripts/discourse/app/lib/uploads.jsindex b064635e4ac..92e2677e9e5 100644--- a/app/assets/javascripts/discourse/app/lib/uploads.js+++ b/app/assets/javascripts/discourse/app/lib/uploads.js@@ -48,13 +48,17 @@ export function validateUploadedFiles(files, opts) {}function validateUploadedFile(file, opts) {- if (opts.skipValidation) return true;+ if (opts.skipValidation) {+ return true;+ }opts = opts || {};let user = opts.user;let staff = user && user.staff;- if (!authorizesOneOrMoreExtensions(staff, opts.siteSettings)) return false;+ if (!authorizesOneOrMoreExtensions(staff, opts.siteSettings)) {+ return false;+ }const name = file && file.name;@@ -190,7 +194,9 @@ export function authorizesAllExtensions(staff, siteSettings) {}export function authorizesOneOrMoreExtensions(staff, siteSettings) {- if (authorizesAllExtensions(staff, siteSettings)) return true;+ if (authorizesAllExtensions(staff, siteSettings)) {+ return true;+ }return (siteSettings.authorized_extensions.split("|").filter((ext) => ext).length >@@ -199,7 +205,9 @@ export function authorizesOneOrMoreExtensions(staff, siteSettings) {}export function authorizesOneOrMoreImageExtensions(staff, siteSettings) {- if (authorizesAllExtensions(staff, siteSettings)) return true;+ if (authorizesAllExtensions(staff, siteSettings)) {+ return true;+ }return imagesExtensions(staff, siteSettings).length > 0;}diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.jsindex b44924bec23..b661ff18818 100644--- a/app/assets/javascripts/discourse/app/lib/utilities.js+++ b/app/assets/javascripts/discourse/app/lib/utilities.js@@ -187,7 +187,9 @@ export function caretPosition(el) {if (document.selection) {el.focus();r = document.selection.createRange();- if (!r) return 0;+ if (!r) {+ return 0;+ }re = el.createTextRange();rc = re.duplicate();@@ -293,7 +295,9 @@ export function isiPad() {}export function safariHacksDisabled() {- if (iOSWithVisualViewport()) return false;+ if (iOSWithVisualViewport()) {+ return false;+ }let pref = localStorage.getItem("safari-hacks-disabled");let result = false;diff --git a/app/assets/javascripts/discourse/app/mixins/mobile-scroll-direction.js b/app/assets/javascripts/discourse/app/mixins/mobile-scroll-direction.jsindex 28ad7c23984..556831fb33f 100644--- a/app/assets/javascripts/discourse/app/mixins/mobile-scroll-direction.js+++ b/app/assets/javascripts/discourse/app/mixins/mobile-scroll-direction.js@@ -12,11 +12,14 @@ export default Mixin.create({const delta = Math.floor(offset - this._lastScroll);// This is a tiny scroll, so we ignore it.- if (delta <= MOBILE_SCROLL_TOLERANCE && delta >= -MOBILE_SCROLL_TOLERANCE)+ if (delta <= MOBILE_SCROLL_TOLERANCE && delta >= -MOBILE_SCROLL_TOLERANCE) {return;+ }// don't calculate when resetting offset (i.e. going to /latest or to next topic in suggested list)- if (offset === 0) return;+ if (offset === 0) {+ return;+ }const prevDirection = this.mobileScrollDirection;const currDirection = delta > 0 ? "down" : null;diff --git a/app/assets/javascripts/discourse/app/models/action-summary.js b/app/assets/javascripts/discourse/app/models/action-summary.jsindex c5a14cdeb1a..7680d13110b 100644--- a/app/assets/javascripts/discourse/app/models/action-summary.js+++ b/app/assets/javascripts/discourse/app/models/action-summary.js@@ -32,7 +32,9 @@ export default RestModel.extend({// Perform this actionact(post, opts) {- if (!opts) opts = {};+ if (!opts) {+ opts = {};+ }// Mark it as actedthis.setProperties({diff --git a/app/assets/javascripts/discourse/app/models/badge.js b/app/assets/javascripts/discourse/app/models/badge.jsindex 29aec68d4d8..894f3fb09d0 100644--- a/app/assets/javascripts/discourse/app/models/badge.js+++ b/app/assets/javascripts/discourse/app/models/badge.js@@ -55,7 +55,9 @@ const Badge = RestModel.extend({},destroy() {- if (this.newBadge) return Promise.resolve();+ if (this.newBadge) {+ return Promise.resolve();+ }return ajax(`/admin/badges/${this.id}`, {type: "DELETE",diff --git a/app/assets/javascripts/discourse/app/models/bookmark.js b/app/assets/javascripts/discourse/app/models/bookmark.jsindex ab7f18ecb06..0c416b15ba0 100644--- a/app/assets/javascripts/discourse/app/models/bookmark.js+++ b/app/assets/javascripts/discourse/app/models/bookmark.js@@ -27,7 +27,9 @@ const Bookmark = RestModel.extend({},destroy() {- if (this.newBookmark) return Promise.resolve();+ if (this.newBookmark) {+ return Promise.resolve();+ }return ajax(this.url, {type: "DELETE",diff --git a/app/assets/javascripts/discourse/app/models/category.js b/app/assets/javascripts/discourse/app/models/category.jsindex 0cd60e3e522..5d1c8ce2f2f 100644--- a/app/assets/javascripts/discourse/app/models/category.js+++ b/app/assets/javascripts/discourse/app/models/category.js@@ -123,7 +123,9 @@ const Category = RestModel.extend({const notificationLevelString = Object.keys(NotificationLevels).find((key) => NotificationLevels[key] === notificationLevel);- if (notificationLevelString) return notificationLevelString.toLowerCase();+ if (notificationLevelString) {+ return notificationLevelString.toLowerCase();+ }},@discourseComputed("name")@@ -314,7 +316,9 @@ Category.reopenClass({},slugFor(category, separator = "/", depth = 3) {- if (!category) return "";+ if (!category) {+ return "";+ }const parentCategory = get(category, "parentCategory");let result = "";@@ -454,7 +458,9 @@ Category.reopenClass({category = Category.findSingleBySlug(slug);// If we have a parent category, we need to enforce it- if (category && category.get("parentCategory")) return;+ if (category && category.get("parentCategory")) {+ return;+ }}// In case the slug didn't work, try to find it by id instead.@@ -529,7 +535,9 @@ Category.reopenClass({(category.get("name").toLowerCase().indexOf(term) > 0 ||category.get("slug").toLowerCase().indexOf(slugTerm) > 0)) {- if (data.indexOf(category) === -1) data.push(category);+ if (data.indexOf(category) === -1) {+ data.push(category);+ }}}}diff --git a/app/assets/javascripts/discourse/app/models/composer.js b/app/assets/javascripts/discourse/app/models/composer.jsindex 066c23a0a7f..7a7054bece0 100644--- a/app/assets/javascripts/discourse/app/models/composer.js+++ b/app/assets/javascripts/discourse/app/models/composer.js@@ -392,15 +392,21 @@ const Composer = RestModel.extend({isStaffUser) {// can't submit while loading- if (loading) return true;+ if (loading) {+ return true;+ }// title is required when// - creating a new topic/private message// - editing the 1st post- if (canEditTitle && !this.titleLengthValid) return true;+ if (canEditTitle && !this.titleLengthValid) {+ return true;+ }// reply is always required- if (missingReplyCharacters > 0) return true;+ if (missingReplyCharacters > 0) {+ return true;+ }if (this.site.can_tag_topics &&@@ -445,8 +451,12 @@ const Composer = RestModel.extend({@discourseComputed("minimumTitleLength", "titleLength", "post.static_doc")titleLengthValid(minTitleLength, titleLength, staticDoc) {- if (this.user.admin && staticDoc && titleLength > 0) return true;- if (titleLength < minTitleLength) return false;+ if (this.user.admin && staticDoc && titleLength > 0) {+ return true;+ }+ if (titleLength < minTitleLength) {+ return false;+ }return titleLength <= this.siteSettings.max_topic_title_length;},@@ -672,7 +682,9 @@ const Composer = RestModel.extend({open(opts) {let promise = Promise.resolve();- if (!opts) opts = {};+ if (!opts) {+ opts = {};+ }this.set("loading", true);const replyBlank = isEmpty(this.reply);@@ -686,7 +698,9 @@ const Composer = RestModel.extend({this.set("reply", "");}- if (!opts.draftKey) throw new Error("draft key is required");+ if (!opts.draftKey) {+ throw new Error("draft key is required");+ }if (opts.draftSequence === null) {throw new Error("draft sequence is required");@@ -1045,7 +1059,9 @@ const Composer = RestModel.extend({const category = composer.site.categories.find((x) => x.id === (parseInt(createdPost.category, 10) || 1));- if (category) category.incrementProperty("topic_count");+ if (category) {+ category.incrementProperty("topic_count");+ }}composer.clearState();@@ -1094,14 +1110,20 @@ const Composer = RestModel.extend({},saveDraft() {- if (this.draftSaving) return Promise.resolve();+ if (this.draftSaving) {+ return Promise.resolve();+ }// Do not save when drafts are disabled- if (this.disableDrafts) return Promise.resolve();+ if (this.disableDrafts) {+ return Promise.resolve();+ }if (this.canEditTitle) {// Save title and/or post body- if (!this.title && !this.reply) return Promise.resolve();+ if (!this.title && !this.reply) {+ return Promise.resolve();+ }if (this.title &&@@ -1113,11 +1135,14 @@ const Composer = RestModel.extend({}} else {// Do not save when there is no reply- if (!this.reply) return Promise.resolve();+ if (!this.reply) {+ return Promise.resolve();+ }// Do not save when the reply's length is too small- if (this.replyLength < this.siteSettings.min_post_length)+ if (this.replyLength < this.siteSettings.min_post_length) {return Promise.resolve();+ }}this.setProperties({diff --git a/app/assets/javascripts/discourse/app/models/invite.js b/app/assets/javascripts/discourse/app/models/invite.jsindex 4b839c525df..aa72a55e8eb 100644--- a/app/assets/javascripts/discourse/app/models/invite.js+++ b/app/assets/javascripts/discourse/app/models/invite.js@@ -35,11 +35,17 @@ Invite.reopenClass({},findInvitedBy(user, filter, search, offset) {- if (!user) Promise.resolve();+ if (!user) {+ Promise.resolve();+ }const data = {};- if (!isNone(filter)) data.filter = filter;- if (!isNone(search)) data.search = search;+ if (!isNone(filter)) {+ data.filter = filter;+ }+ if (!isNone(search)) {+ data.search = search;+ }data.offset = offset || 0;let path;@@ -58,7 +64,9 @@ Invite.reopenClass({},findInvitedCount(user) {- if (!user) Promise.resolve();+ if (!user) {+ Promise.resolve();+ }return ajax(userPath(`${user.username_lower}/invited_count.json`)diff --git a/app/assets/javascripts/discourse/app/models/login-method.js b/app/assets/javascripts/discourse/app/models/login-method.jsindex c951d53aceb..3b1ca37b2a0 100644--- a/app/assets/javascripts/discourse/app/models/login-method.js+++ b/app/assets/javascripts/discourse/app/models/login-method.js@@ -77,7 +77,9 @@ LoginMethod.reopenClass({let methods;export function findAll() {- if (methods) return methods;+ if (methods) {+ return methods;+ }methods = [];diff --git a/app/assets/javascripts/discourse/app/models/nav-item.js b/app/assets/javascripts/discourse/app/models/nav-item.jsindex f7b5da8ca09..63dfbb58933 100644--- a/app/assets/javascripts/discourse/app/models/nav-item.js+++ b/app/assets/javascripts/discourse/app/models/nav-item.js@@ -164,8 +164,12 @@ NavItem.reopenClass({}}- if (!Category.list() && filterType === "categories") return null;- if (!Site.currentProp("top_menu_items").includes(filterType)) return null;+ if (!Category.list() && filterType === "categories") {+ return null;+ }+ if (!Site.currentProp("top_menu_items").includes(filterType)) {+ return null;+ }var args = { name: filterType, hasIcon: filterType === "unread" };if (opts.category) {@@ -228,7 +232,9 @@ NavItem.reopenClass({ExtraNavItem.create(deepMerge({}, context, descriptor))).filter((item) => {- if (!item.customFilter) return true;+ if (!item.customFilter) {+ return true;+ }return item.customFilter(category, args);});diff --git a/app/assets/javascripts/discourse/app/models/post-stream.js b/app/assets/javascripts/discourse/app/models/post-stream.jsindex 041350de1af..340b1b2c6f8 100644--- a/app/assets/javascripts/discourse/app/models/post-stream.js+++ b/app/assets/javascripts/discourse/app/models/post-stream.js@@ -384,7 +384,9 @@ export default RestModel.extend({});} else {const postIds = this.nextWindow;- if (isEmpty(postIds)) return Promise.resolve();+ if (isEmpty(postIds)) {+ return Promise.resolve();+ }this.set("loadingBelow", true);postsWithPlaceholders.appending(postIds);@@ -425,7 +427,9 @@ export default RestModel.extend({});} else {const postIds = this.previousWindow;- if (isEmpty(postIds)) return Promise.resolve();+ if (isEmpty(postIds)) {+ return Promise.resolve();+ }this.set("loadingAbove", true);return this.findPostsByIds(postIds.reverse())@@ -844,7 +848,9 @@ export default RestModel.extend({}const val = timelineLookup[high] || timelineLookup[low];- if (val) return val[1];+ if (val) {+ return val[1];+ }},// Find a postId for a postNumber, respecting gapsdiff --git a/app/assets/javascripts/discourse/app/models/post.js b/app/assets/javascripts/discourse/app/models/post.jsindex c29bc873ed8..512cf9ea8ca 100644--- a/app/assets/javascripts/discourse/app/models/post.js+++ b/app/assets/javascripts/discourse/app/models/post.js@@ -85,7 +85,9 @@ const Post = RestModel.extend({@discourseComputed("[email protected]")internalLinks() {- if (isEmpty(this.link_counts)) return null;+ if (isEmpty(this.link_counts)) {+ return null;+ }return this.link_counts.filterBy("internal").filterBy("title");},diff --git a/app/assets/javascripts/discourse/app/models/site.js b/app/assets/javascripts/discourse/app/models/site.jsindex 1c43350a6a4..24e483db423 100644--- a/app/assets/javascripts/discourse/app/models/site.js+++ b/app/assets/javascripts/discourse/app/models/site.js@@ -32,7 +32,9 @@ const Site = RestModel.extend({@discourseComputed("post_action_types.[]")flagTypes() {const postActionTypes = this.post_action_types;- if (!postActionTypes) return [];+ if (!postActionTypes) {+ return [];+ }return postActionTypes.filterBy("is_flag", true);},diff --git a/app/assets/javascripts/discourse/app/models/tag-group.js b/app/assets/javascripts/discourse/app/models/tag-group.jsindex a6cf72629a9..d34ddcf7d20 100644--- a/app/assets/javascripts/discourse/app/models/tag-group.js+++ b/app/assets/javascripts/discourse/app/models/tag-group.js@@ -5,7 +5,9 @@ import PermissionType from "discourse/models/permission-type";export default RestModel.extend({@discourseComputed("permissions")permissionName(permissions) {- if (!permissions) return "public";+ if (!permissions) {+ return "public";+ }if (permissions["everyone"] === PermissionType.FULL) {return "public";diff --git a/app/assets/javascripts/discourse/app/models/topic-list.js b/app/assets/javascripts/discourse/app/models/topic-list.jsindex a565df79115..57ee578f09f 100644--- a/app/assets/javascripts/discourse/app/models/topic-list.js+++ b/app/assets/javascripts/discourse/app/models/topic-list.js@@ -138,14 +138,18 @@ const TopicList = RestModel.extend({i++;});- if (storeInSession) Session.currentProp("topicList", this);+ if (storeInSession) {+ Session.currentProp("topicList", this);+ }});},});TopicList.reopenClass({topicsFrom(store, result, opts) {- if (!result) return;+ if (!result) {+ return;+ }opts = opts || {};let listKey = opts.listKey || "topics";diff --git a/app/assets/javascripts/discourse/app/models/topic-timer.js b/app/assets/javascripts/discourse/app/models/topic-timer.jsindex d6e1638ea4e..e6d108a6084 100644--- a/app/assets/javascripts/discourse/app/models/topic-timer.js+++ b/app/assets/javascripts/discourse/app/models/topic-timer.js@@ -17,9 +17,15 @@ TopicTimer.reopenClass({status_type: statusType,};- if (basedOnLastPost) data.based_on_last_post = basedOnLastPost;- if (categoryId) data.category_id = categoryId;- if (duration) data.duration = duration;+ if (basedOnLastPost) {+ data.based_on_last_post = basedOnLastPost;+ }+ if (categoryId) {+ data.category_id = categoryId;+ }+ if (duration) {+ data.duration = duration;+ }return ajax({url: `/t/${topicId}/timer`,diff --git a/app/assets/javascripts/discourse/app/models/topic.js b/app/assets/javascripts/discourse/app/models/topic.jsindex 95f09a67762..39b8b264f01 100644--- a/app/assets/javascripts/discourse/app/models/topic.js+++ b/app/assets/javascripts/discourse/app/models/topic.js@@ -778,7 +778,9 @@ Topic.reopenClass({type: "POST",data: opts,}).then((result) => {- if (result.success) return result;+ if (result.success) {+ return result;+ }promise.reject(new Error("error changing ownership of posts"));});return promise;@@ -789,7 +791,9 @@ Topic.reopenClass({type: "PUT",data: { timestamp },}).then((result) => {- if (result.success) return result;+ if (result.success) {+ return result;+ }promise.reject(new Error("error updating timestamp of topic"));});return promise;diff --git a/app/assets/javascripts/discourse/app/models/user-draft.js b/app/assets/javascripts/discourse/app/models/user-draft.jsindex ea9254d4f2f..0bf9a1116cd 100644--- a/app/assets/javascripts/discourse/app/models/user-draft.js+++ b/app/assets/javascripts/discourse/app/models/user-draft.js@@ -22,7 +22,9 @@ export default RestModel.extend({@discourseComputed("topic_id")postUrl(topicId) {- if (!topicId) return;+ if (!topicId) {+ return;+ }return postUrl(this.slug, this.topic_id, this.post_number);},diff --git a/app/assets/javascripts/discourse/app/models/user.js b/app/assets/javascripts/discourse/app/models/user.jsindex 1e4beddfe10..98baf09ec05 100644--- a/app/assets/javascripts/discourse/app/models/user.js+++ b/app/assets/javascripts/discourse/app/models/user.js@@ -519,9 +519,14 @@ const User = RestModel.extend({if (result && result.user_action) {const ua = result.user_action;- if ((this.get("stream.filter") || ua.action_type) !== ua.action_type)+ if (+ (this.get("stream.filter") || ua.action_type) !== ua.action_type+ ) {return;- if (!this.get("stream.filter") && !this.inAllStream(ua)) return;+ }+ if (!this.get("stream.filter") && !this.inAllStream(ua)) {+ return;+ }ua.title = emojiUnescape(escapeExpression(ua.title));const action = UserAction.collapseStream([UserAction.create(ua)]);@@ -564,7 +569,9 @@ const User = RestModel.extend({// The user's stat count, excluding PMs.@discourseComputed("[email protected]")statsCountNonPM() {- if (isEmpty(this.statsExcludingPms)) return 0;+ if (isEmpty(this.statsExcludingPms)) {+ return 0;+ }let count = 0;this.statsExcludingPms.forEach((val) => {if (this.inAllStream(val)) {@@ -577,7 +584,9 @@ const User = RestModel.extend({// The user's stats, excluding PMs.@discourseComputed("[email protected]")statsExcludingPms() {- if (isEmpty(this.stats)) return [];+ if (isEmpty(this.stats)) {+ return [];+ }return this.stats.rejectBy("isPM");},@@ -591,7 +600,9 @@ const User = RestModel.extend({}const useCardRoute = options && options.forCard;- if (options) delete options.forCard;+ if (options) {+ delete options.forCard;+ }const path = useCardRoute? `${user.get("username")}/card.json`@@ -602,7 +613,9 @@ const User = RestModel.extend({if (!isEmpty(json.user.stats)) {json.user.stats = User.groupStats(json.user.stats.map((s) => {- if (s.count) s.count = parseInt(s.count, 10);+ if (s.count) {+ s.count = parseInt(s.count, 10);+ }return UserActionStat.create(s);}));diff --git a/app/assets/javascripts/discourse/app/routes/about.js b/app/assets/javascripts/discourse/app/routes/about.jsindex abfd99dbba0..4a9897ce70d 100644--- a/app/assets/javascripts/discourse/app/routes/about.js+++ b/app/assets/javascripts/discourse/app/routes/about.js@@ -9,10 +9,14 @@ export default DiscourseRoute.extend({let activeModerators = [];const yearAgo = moment().locale("en").utc().subtract(1, "year");result.about.admins.forEach((r) => {- if (moment(r.last_seen_at) > yearAgo) activeAdmins.push(r);+ if (moment(r.last_seen_at) > yearAgo) {+ activeAdmins.push(r);+ }});result.about.moderators.forEach((r) => {- if (moment(r.last_seen_at) > yearAgo) activeModerators.push(r);+ if (moment(r.last_seen_at) > yearAgo) {+ activeModerators.push(r);+ }});result.about.admins = activeAdmins;result.about.moderators = activeModerators;diff --git a/app/assets/javascripts/discourse/app/routes/build-group-messages-route.js b/app/assets/javascripts/discourse/app/routes/build-group-messages-route.jsindex 2fccbef350d..4de94e625b3 100644--- a/app/assets/javascripts/discourse/app/routes/build-group-messages-route.js+++ b/app/assets/javascripts/discourse/app/routes/build-group-messages-route.js@@ -11,7 +11,9 @@ export default (type) => {const groupName = this.modelFor("group").get("name");const username = this.currentUser.get("username_lower");let filter = `topics/private-messages-group/${username}/${groupName}`;- if (this._isArchive()) filter = `${filter}/archive`;+ if (this._isArchive()) {+ filter = `${filter}/archive`;+ }return this.store.findFiltered("topicList", { filter });},@@ -20,7 +22,9 @@ export default (type) => {const groupName = this.modelFor("group").get("name");let channel = `/private-messages/group/${groupName}`;- if (this._isArchive()) channel = `${channel}/archive`;+ if (this._isArchive()) {+ channel = `${channel}/archive`;+ }this.controllerFor("user-topics-list").subscribe(channel);this.controllerFor("user-topics-list").setProperties({diff --git a/app/assets/javascripts/discourse/app/routes/user-private-messages-group.js b/app/assets/javascripts/discourse/app/routes/user-private-messages-group.jsindex 871b12fcf4b..022d12de160 100644--- a/app/assets/javascripts/discourse/app/routes/user-private-messages-group.js+++ b/app/assets/javascripts/discourse/app/routes/user-private-messages-group.js@@ -7,8 +7,9 @@ export default createPMRoute("groups", "private-messages-groups").extend({titleToken() {const groupName = this.groupName;- if (groupName)+ if (groupName) {return [groupName.capitalize(), I18n.t("user.private_messages")];+ }},model(params) {diff --git a/app/assets/javascripts/discourse/app/routes/user.js b/app/assets/javascripts/discourse/app/routes/user.jsindex f8eccf679b9..c95ead49695 100644--- a/app/assets/javascripts/discourse/app/routes/user.js+++ b/app/assets/javascripts/discourse/app/routes/user.js@@ -58,7 +58,9 @@ export default DiscourseRoute.extend({},serialize(model) {- if (!model) return {};+ if (!model) {+ return {};+ }return { username: (model.username || "").toLowerCase() };},diff --git a/app/assets/javascripts/discourse/app/services/app-events.js b/app/assets/javascripts/discourse/app/services/app-events.jsindex 899be52afd7..9e738afecb8 100644--- a/app/assets/javascripts/discourse/app/services/app-events.js+++ b/app/assets/javascripts/discourse/app/services/app-events.js@@ -57,7 +57,9 @@ export default Service.extend(Evented, {this._super(...arguments);_events[name] = _events[name].filter((e) => e.fn !== fn);- if (_events[name].length === 0) delete _events[name];+ if (_events[name].length === 0) {+ delete _events[name];+ }}}diff --git a/app/assets/javascripts/discourse/app/services/logs-notice.js b/app/assets/javascripts/discourse/app/services/logs-notice.jsindex 66dafa73bfe..a3334aadc87 100644--- a/app/assets/javascripts/discourse/app/services/logs-notice.js+++ b/app/assets/javascripts/discourse/app/services/logs-notice.js@@ -16,10 +16,14 @@ const LogsNotice = EmberObject.extend({@on("init")_setup() {- if (!this.isActivated) return;+ if (!this.isActivated) {+ return;+ }const text = this.keyValueStore.getItem(LOGS_NOTICE_KEY);- if (text) this.set("text", text);+ if (text) {+ this.set("text", text);+ }this.messageBus.subscribe("/logs_error_rate_exceeded", (data) => {const duration = data.duration;diff --git a/app/assets/javascripts/discourse/app/widgets/component-connector.js b/app/assets/javascripts/discourse/app/widgets/component-connector.jsindex 25f0898e47f..db52456adc4 100644--- a/app/assets/javascripts/discourse/app/widgets/component-connector.js+++ b/app/assets/javascripts/discourse/app/widgets/component-connector.js@@ -31,7 +31,9 @@ export default class ComponentConnector {}});- if (shouldInit) return this.init();+ if (shouldInit) {+ return this.init();+ }return null;}diff --git a/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js b/app/assets/javascripts/discourse/app/widgets/hamburger-menu.jsindex f6b7e09d8fe..b9fdc94034e 100644--- a/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js+++ b/app/assets/javascripts/discourse/app/widgets/hamburger-menu.js@@ -342,7 +342,9 @@ export default createWidget("hamburger-menu", {refreshReviewableCount(state) {const { currentUser } = this;- if (state.loading || !currentUser) return;+ if (state.loading || !currentUser) {+ return;+ }state.loading = true;diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.jsindex 7d0f6dba23f..11a8a038492 100644--- a/app/assets/javascripts/discourse/app/widgets/header.js+++ b/app/assets/javascripts/discourse/app/widgets/header.js@@ -492,7 +492,9 @@ export default createWidget("header", {},toggleBodyScrolling(bool) {- if (!this.site.mobileView) return;+ if (!this.site.mobileView) {+ return;+ }if (bool) {document.body.addEventListener("touchmove", this.preventDefault, {passive: false,diff --git a/app/assets/javascripts/discourse/app/widgets/post-menu.js b/app/assets/javascripts/discourse/app/widgets/post-menu.jsindex 6a23430cdad..17002ce8939 100644--- a/app/assets/javascripts/discourse/app/widgets/post-menu.js+++ b/app/assets/javascripts/discourse/app/widgets/post-menu.js@@ -42,8 +42,12 @@ export function addButton(name, builder) {}export function removeButton(name) {- if (_extraButtons[name]) delete _extraButtons[name];- if (_builders[name]) delete _builders[name];+ if (_extraButtons[name]) {+ delete _extraButtons[name];+ }+ if (_builders[name]) {+ delete _builders[name];+ }}function registerButton(name, builder) {diff --git a/app/assets/javascripts/discourse/app/widgets/search-menu.js b/app/assets/javascripts/discourse/app/widgets/search-menu.jsindex dd78bb48307..1b3585c72f1 100644--- a/app/assets/javascripts/discourse/app/widgets/search-menu.js+++ b/app/assets/javascripts/discourse/app/widgets/search-menu.js@@ -115,10 +115,14 @@ export default createWidget("search-menu", {}}- if (query) params.push(query);+ if (query) {+ params.push(query);+ }}- if (opts && opts.expanded) params.push("expanded=true");+ if (opts && opts.expanded) {+ params.push("expanded=true");+ }if (params.length > 0) {url = `${url}?${params.join("&")}`;diff --git a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js b/app/assets/javascripts/discourse/app/widgets/topic-timeline.jsindex a5992dd06fc..29361983576 100644--- a/app/assets/javascripts/discourse/app/widgets/topic-timeline.js+++ b/app/assets/javascripts/discourse/app/widgets/topic-timeline.js@@ -175,7 +175,9 @@ createWidget("timeline-scrollarea", {.get("posts").findBy("id", postStream.get("stream")[current]);- if (post) date = new Date(post.get("created_at"));+ if (post) {+ date = new Date(post.get("created_at"));+ }} else if (daysAgo !== null) {date = new Date();date.setDate(date.getDate() - daysAgo || 0);diff --git a/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js b/app/assets/javascripts/discourse/app/widgets/widget-dropdown.jsindex 0be46416706..47b7f875d57 100644--- a/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js+++ b/app/assets/javascripts/discourse/app/widgets/widget-dropdown.js@@ -251,13 +251,17 @@ export const WidgetDropdownClass = {`#${this.attrs.id} .widget-dropdown-header`);- if (!dropdownHeader) return;+ if (!dropdownHeader) {+ return;+ }const dropdownBody = document.querySelector(`#${this.attrs.id} .widget-dropdown-body`);- if (!dropdownBody) return;+ if (!dropdownBody) {+ return;+ }this._popper = createPopper(dropdownHeader, dropdownBody, {strategy: "fixed",diff --git a/app/assets/javascripts/docs/yuidoc.json b/app/assets/javascripts/docs/yuidoc.jsonindex 292146820b8..8d52bf9673a 100644--- a/app/assets/javascripts/docs/yuidoc.json+++ b/app/assets/javascripts/docs/yuidoc.json@@ -4,6 +4,6 @@"url": "http://www.discourse.org/","options": {"exclude": "development,production,defer",- "outdir": "./build"+ "outdir": "./build"}-}\ No newline at end of file+}diff --git a/app/assets/javascripts/pretty-text/addon/emoji.js b/app/assets/javascripts/pretty-text/addon/emoji.jsindex b25390468b9..4f588a2f4f5 100644--- a/app/assets/javascripts/pretty-text/addon/emoji.js+++ b/app/assets/javascripts/pretty-text/addon/emoji.js@@ -72,7 +72,9 @@ Object.keys(aliases).forEach((name) => {});function isReplacableInlineEmoji(string, index, inlineEmoji) {- if (inlineEmoji) return true;+ if (inlineEmoji) {+ return true;+ }// index depends on regex; when `inlineEmoji` is false, the regex starts// with a `\B` character, so there's no need to subtract from the index@@ -155,9 +157,12 @@ export function performEmojiEscape(string, opts) {export function isCustomEmoji(code, opts) {code = code.toLowerCase();- if (extendedEmoji.hasOwnProperty(code)) return true;- if (opts && opts.customEmoji && opts.customEmoji.hasOwnProperty(code))+ if (extendedEmoji.hasOwnProperty(code)) {+ return true;+ }+ if (opts && opts.customEmoji && opts.customEmoji.hasOwnProperty(code)) {return true;+ }return false;}@@ -227,7 +232,9 @@ export function emojiSearch(term, options) {// if term matches from beginningfor (let i = 0; i < toSearch.length; i++) {const item = toSearch[i];- if (item.indexOf(term) === 0) addResult(item);+ if (item.indexOf(term) === 0) {+ addResult(item);+ }}if (searchAliases[term]) {@@ -236,7 +243,9 @@ export function emojiSearch(term, options) {for (let i = 0; i < toSearch.length; i++) {const item = toSearch[i];- if (item.indexOf(term) > 0) addResult(item);+ if (item.indexOf(term) > 0) {+ addResult(item);+ }}if (maxResults === -1) {diff --git a/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js b/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.jsindex 94e471f34ae..5f0bf233762 100644--- a/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js+++ b/app/assets/javascripts/pretty-text/addon/engines/discourse-markdown-it.js@@ -214,8 +214,13 @@ function renderImageOrPlayableMedia(tokens, idx, options, env, slf) {token.attrs.push(["height", height]);}- if (options.discourse.previewing && match[6] !== "x" && match[4] !== "x")+ if (+ options.discourse.previewing &&+ match[6] !== "x" &&+ match[4] !== "x"+ ) {token.attrs.push(["class", "resizable"]);+ }} else if ((data = extractDataAttribute(split[i]))) {token.attrs.push(data);} else {diff --git a/app/assets/javascripts/pretty-text/addon/oneboxer.js b/app/assets/javascripts/pretty-text/addon/oneboxer.jsindex 0ef741eab01..00d6867d248 100644--- a/app/assets/javascripts/pretty-text/addon/oneboxer.js+++ b/app/assets/javascripts/pretty-text/addon/oneboxer.js@@ -112,8 +112,12 @@ export function load({const $elem = $(elem);// If the onebox has loaded or is loading, return- if ($elem.data("onebox-loaded")) return;- if ($elem.hasClass(LOADING_ONEBOX_CSS_CLASS)) return;+ if ($elem.data("onebox-loaded")) {+ return;+ }+ if ($elem.hasClass(LOADING_ONEBOX_CSS_CLASS)) {+ return;+ }const url = elem.href;@@ -121,11 +125,15 @@ export function load({if (!refresh) {// If we have it in our cache, return it.const cached = localCache[normalize(url)];- if (cached) return cached.prop("outerHTML");+ if (cached) {+ return cached.prop("outerHTML");+ }// If the request failed, don't do anythingconst failed = failedCache[normalize(url)];- if (failed) return;+ if (failed) {+ return;+ }}// Add the loading CSS classdiff --git a/app/assets/javascripts/pretty-text/addon/sanitizer.js b/app/assets/javascripts/pretty-text/addon/sanitizer.jsindex aaf80055b5c..035199fe44f 100644--- a/app/assets/javascripts/pretty-text/addon/sanitizer.js+++ b/app/assets/javascripts/pretty-text/addon/sanitizer.js@@ -72,7 +72,9 @@ export function hrefAllowed(href, extraHrefMatchers) {}export function sanitize(text, whiteLister) {- if (!text) return "";+ if (!text) {+ return "";+ }// Allow things like <3 and <_<text = text.replace(/<([^A-Za-z\/\!]|$)/g, "<$1");diff --git a/app/assets/javascripts/pretty-text/addon/white-lister.js b/app/assets/javascripts/pretty-text/addon/white-lister.jsindex b042c915c41..59bb3e205bc 100644--- a/app/assets/javascripts/pretty-text/addon/white-lister.js+++ b/app/assets/javascripts/pretty-text/addon/white-lister.js@@ -42,7 +42,9 @@ export default class WhiteLister {const custom = [];this._rawFeatures.forEach(([name, info]) => {- if (!this._enabled[name]) return;+ if (!this._enabled[name]) {+ return;+ }if (info.custom) {custom.push(info.custom);diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/mentions.js b/app/assets/javascripts/pretty-text/engines/discourse-markdown/mentions.jsindex 49d6b73607d..3c5c7d1e92b 100644--- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/mentions.js+++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/mentions.js@@ -44,7 +44,9 @@ function mentionRegex(unicodeUsernames) {"u");} catch (e) {- if (!(e instanceof SyntaxError)) throw e;+ if (!(e instanceof SyntaxError)) {+ throw e;+ }// Fallback for older browsers and MiniRacer.// Created with [email protected] by executing the following in nodejs:diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js b/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.jsindex 0fa31d16b74..49dc478383a 100644--- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js+++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/resize-controls.js@@ -16,7 +16,9 @@ function appendMetaData(index, token) {sizePart && sizePart.split(",").pop().trim().replace("%", "");const overwriteScale = !SCALES.find((scale) => scale === selectedScale);- if (overwriteScale) selectedScale = "100";+ if (overwriteScale) {+ selectedScale = "100";+ }token.attrs.push(["index-image", index]);token.attrs.push(["scale", selectedScale]);@@ -34,7 +36,9 @@ function rule(state) {currentIndex++;}- if (!blockToken.children) continue;+ if (!blockToken.children) {+ continue;+ }for (let j = 0; j < blockToken.children.length; j++) {let token = blockToken.children[j];diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/text-post-process.js b/app/assets/javascripts/pretty-text/engines/discourse-markdown/text-post-process.jsindex 6ec12895fd8..5e2b446e83f 100644--- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/text-post-process.js+++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/text-post-process.js@@ -89,7 +89,9 @@ function textPostProcess(content, state, ruler) {while ((match = matcher.exec(content))) {// something is wrong- if (match.index < pos) break;+ if (match.index < pos) {+ break;+ }// check boundaryif (match.index > 0) {diff --git a/app/assets/javascripts/pretty-text/engines/discourse-markdown/upload-protocol.js b/app/assets/javascripts/pretty-text/engines/discourse-markdown/upload-protocol.jsindex 145a6b65352..0b5d5bf6cb5 100644--- a/app/assets/javascripts/pretty-text/engines/discourse-markdown/upload-protocol.js+++ b/app/assets/javascripts/pretty-text/engines/discourse-markdown/upload-protocol.js@@ -20,12 +20,16 @@ function rule(state) {addImage(uploads, blockToken);}- if (!blockToken.children) continue;+ if (!blockToken.children) {+ continue;+ }for (let j = 0; j < blockToken.children.length; j++) {let token = blockToken.children[j];- if (token.tag === "img" || token.tag === "a") addImage(uploads, token);+ if (token.tag === "img" || token.tag === "a") {+ addImage(uploads, token);+ }}}@@ -86,7 +90,9 @@ function rule(state) {export function setup(helper) {const opts = helper.getOptions();- if (opts.previewing) helper.whiteList(["img.resizable"]);+ if (opts.previewing) {+ helper.whiteList(["img.resizable"]);+ }helper.whiteList(["img[data-orig-src]",diff --git a/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js b/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.jsindex 69e795c8ba0..7daa6c0e4b3 100644--- a/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js+++ b/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js@@ -28,7 +28,9 @@ export default ComboBoxSelectBoxHeaderComponent.extend({categoryStyle(category, categoryBackgroundColor, categoryTextColor) {const categoryStyle = this.siteSettings.category_style;- if (categoryStyle === "bullet") return;+ if (categoryStyle === "bullet") {+ return;+ }if (category) {if (categoryBackgroundColor || categoryTextColor) {diff --git a/app/assets/javascripts/select-kit/addon/components/category-selector.js b/app/assets/javascripts/select-kit/addon/components/category-selector.jsindex b5b0d567867..2c2245aa3f1 100644--- a/app/assets/javascripts/select-kit/addon/components/category-selector.js+++ b/app/assets/javascripts/select-kit/addon/components/category-selector.js@@ -21,8 +21,12 @@ export default MultiSelectComponent.extend({init() {this._super(...arguments);- if (!this.categories) this.set("categories", []);- if (!this.blockedCategories) this.set("blockedCategories", []);+ if (!this.categories) {+ this.set("categories", []);+ }+ if (!this.blockedCategories) {+ this.set("blockedCategories", []);+ }},content: computed("categories.[]", "blockedCategories.[]", function () {diff --git a/app/assets/javascripts/select-kit/addon/components/composer-actions.js b/app/assets/javascripts/select-kit/addon/components/composer-actions.jsindex 172bd08ae9c..c453c469181 100644--- a/app/assets/javascripts/select-kit/addon/components/composer-actions.js+++ b/app/assets/javascripts/select-kit/addon/components/composer-actions.js@@ -297,7 +297,9 @@ export default DropdownSelectBoxComponent.extend({bootbox.confirm(I18n.t("composer.composer_actions.reply_as_new_topic.confirm"),(result) => {- if (result) this._replyAsNewTopicSelect(options);+ if (result) {+ this._replyAsNewTopicSelect(options);+ }});} else {diff --git a/app/assets/javascripts/select-kit/addon/components/icon-picker.js b/app/assets/javascripts/select-kit/addon/components/icon-picker.jsindex 0556413e3e9..eb053b03963 100644--- a/app/assets/javascripts/select-kit/addon/components/icon-picker.js+++ b/app/assets/javascripts/select-kit/addon/components/icon-picker.js@@ -55,10 +55,11 @@ export default MultiSelectComponent.extend({holder = "ajax-icon-holder";if (typeof icon === "object") {- if ($(`${spriteEl} .${holder}`).length === 0)+ if ($(`${spriteEl} .${holder}`).length === 0) {$(spriteEl).append(`<div class="${holder}" style='display: none;'></div>`);+ }if (!$(`${spriteEl} symbol#${strippedIconName}`).length) {$(`${spriteEl} .${holder}`).append(diff --git a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js b/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.jsindex 082d1282aef..8ed8cff649f 100644--- a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js+++ b/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js@@ -136,7 +136,9 @@ export default ComboBox.extend(TagsMixin, {data.selected_tags = this.value.slice(0, 100);}- if (!this.selectKit.options.everyTag) data.filterForInput = true;+ if (!this.selectKit.options.everyTag) {+ data.filterForInput = true;+ }return this.searchTags("/tags/filter/search", data, this._transformJson);},diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.jsindex bad95867451..267e83f2731 100644--- a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js+++ b/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js@@ -10,7 +10,9 @@ export default SelectKitFilterComponent.extend({@discourseComputed("placeholder", "selectKit.hasSelection")computedPlaceholder(placeholder, hasSelection) {- if (hasSelection) return "";+ if (hasSelection) {+ return "";+ }return isEmpty(placeholder) ? "" : I18n.t(placeholder);},});diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit.js b/app/assets/javascripts/select-kit/addon/components/select-kit.jsindex 650fe22a929..8931ad6259d 100644--- a/app/assets/javascripts/select-kit/addon/components/select-kit.js+++ b/app/assets/javascripts/select-kit/addon/components/select-kit.js@@ -466,7 +466,9 @@ export default Component.extend(}let none = this.selectKit.options.none;- if (isNone(none) && !this.selectKit.options.allowAny) return null;+ if (isNone(none) && !this.selectKit.options.allowAny) {+ return null;+ }if (isNone(none) &&diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js b/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.jsindex 6e70f6574e4..83a48f961d9 100644--- a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js+++ b/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js@@ -8,10 +8,15 @@ export default Component.extend(UtilsMixin, {eventType: "click",click(event) {- if (typeof document === "undefined") return;- if (this.isDestroyed || !this.selectKit || this.selectKit.isDisabled)+ if (typeof document === "undefined") {return;- if (this.eventType !== "click" || event.button !== 0) return;+ }+ if (this.isDestroyed || !this.selectKit || this.selectKit.isDisabled) {+ return;+ }+ if (this.eventType !== "click" || event.button !== 0) {+ return;+ }this.selectKit.toggle(event);event.preventDefault();},diff --git a/app/assets/javascripts/select-kit/addon/components/selected-color.js b/app/assets/javascripts/select-kit/addon/components/selected-color.jsindex 065ab7e05b8..76232ce625c 100644--- a/app/assets/javascripts/select-kit/addon/components/selected-color.js+++ b/app/assets/javascripts/select-kit/addon/components/selected-color.js@@ -12,7 +12,9 @@ export default SelectedNameComponent.extend({const color = escapeExpression(this.name),el = document.querySelector(`[data-value="${color}"]`);- if (el) el.style.borderBottomColor = `#${color}`;+ if (el) {+ el.style.borderBottomColor = `#${color}`;+ }});},});diff --git a/app/assets/javascripts/select-kit/addon/components/tag-chooser.js b/app/assets/javascripts/select-kit/addon/components/tag-chooser.jsindex b6a0c4cea38..0fcc339c116 100644--- a/app/assets/javascripts/select-kit/addon/components/tag-chooser.js+++ b/app/assets/javascripts/select-kit/addon/components/tag-chooser.js@@ -91,9 +91,15 @@ export default MultiSelectComponent.extend(TagsMixin, {.slice(0, 100);}- if (!this.everyTag) data.filterForInput = true;- if (this.excludeSynonyms) data.excludeSynonyms = true;- if (this.excludeHasSynonyms) data.excludeHasSynonyms = true;+ if (!this.everyTag) {+ data.filterForInput = true;+ }+ if (this.excludeSynonyms) {+ data.excludeSynonyms = true;+ }+ if (this.excludeHasSynonyms) {+ data.excludeHasSynonyms = true;+ }return this.searchTags("/tags/filter/search", data, this._transformJson);},diff --git a/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.js.es6 b/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.js.es6index 09a180bc9a1..0a895646726 100644--- a/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.js.es6+++ b/plugins/discourse-narrative-bot/assets/javascripts/initializers/new-user-narrative.js.es6@@ -57,7 +57,8 @@ export default {initialize(container) {const siteSettings = container.lookup("site-settings:main");- if (siteSettings.discourse_narrative_bot_enabled)+ if (siteSettings.discourse_narrative_bot_enabled) {withPluginApi("0.8.7", initialize);+ }},};diff --git a/plugins/lazy-yt/assets/javascripts/lazyYT.js b/plugins/lazy-yt/assets/javascripts/lazyYT.jsindex c211db581dc..d131a7924ab 100644--- a/plugins/lazy-yt/assets/javascripts/lazyYT.js+++ b/plugins/lazy-yt/assets/javascripts/lazyYT.js@@ -53,8 +53,9 @@// Play button from YouTube (exactly as it is in YouTube)innerHtml.push('<div class="ytp-large-play-button"');- if (width <= 640)+ if (width <= 640) {innerHtml.push(' style="transform: scale(0.563888888888889);"');+ }innerHtml.push(">");innerHtml.push("<svg>");innerHtml.push(diff --git a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6 b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6index 54965041da6..e5aa341108e 100644--- a/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6+++ b/plugins/poll/assets/javascripts/controllers/poll-ui-builder.js.es6@@ -126,12 +126,16 @@ export default Controller.extend({@discourseComputed("pollOptions")pollOptionsCount(pollOptions) {- if (pollOptions.length === 0) return 0;+ if (pollOptions.length === 0) {+ return 0;+ }let length = 0;pollOptions.split("\n").forEach((option) => {- if (option.length !== 0) length += 1;+ if (option.length !== 0) {+ length += 1;+ }});return length;@@ -141,7 +145,9 @@ export default Controller.extend({_setPollMax() {const isMultiple = this.isMultiple;const isNumber = this.isNumber;- if (!isMultiple && !isNumber) return;+ if (!isMultiple && !isNumber) {+ return;+ }if (isMultiple) {this.set("pollMax", this.pollOptionsCount);@@ -152,7 +158,9 @@ export default Controller.extend({@discourseComputed("isRegular", "isMultiple", "isNumber", "pollOptionsCount")pollMinOptions(isRegular, isMultiple, isNumber, count) {- if (isRegular) return;+ if (isRegular) {+ return;+ }if (isMultiple) {return this._comboboxOptions(1, count + 1);@@ -173,7 +181,9 @@ export default Controller.extend({"pollStep")pollMaxOptions(isRegular, isMultiple, isNumber, count, pollMin, pollStep) {- if (isRegular) return;+ if (isRegular) {+ return;+ }const pollMinInt = parseInt(pollMin, 10) || 1;if (isMultiple) {@@ -192,7 +202,9 @@ export default Controller.extend({@discourseComputed("isNumber", "pollMax")pollStepOptions(isNumber, pollMax) {- if (!isNumber) return;+ if (!isNumber) {+ return;+ }return this._comboboxOptions(1, (parseInt(pollMax, 10) || 1) + 1);},@@ -244,14 +256,27 @@ export default Controller.extend({step = 1;}- if (pollType) pollHeader += ` type=${pollType}`;- if (pollResult) pollHeader += ` results=${pollResult}`;- if (pollMin && showMinMax) pollHeader += ` min=${pollMin}`;- if (pollMax) pollHeader += ` max=${pollMax}`;- if (isNumber) pollHeader += ` step=${step}`;- if (publicPoll) pollHeader += ` public=true`;- if (chartType && pollType !== "number")+ if (pollType) {+ pollHeader += ` type=${pollType}`;+ }+ if (pollResult) {+ pollHeader += ` results=${pollResult}`;+ }+ if (pollMin && showMinMax) {+ pollHeader += ` min=${pollMin}`;+ }+ if (pollMax) {+ pollHeader += ` max=${pollMax}`;+ }+ if (isNumber) {+ pollHeader += ` step=${step}`;+ }+ if (publicPoll) {+ pollHeader += ` public=true`;+ }+ if (chartType && pollType !== "number") {pollHeader += ` chartType=${chartType}`;+ }if (pollGroups && pollGroups.length > 0) {pollHeader += ` groups=${pollGroups}`;}@@ -260,7 +285,9 @@ export default Controller.extend({date + " " + time,"YYYY-MM-DD HH:mm").toISOString();- if (closeDate) pollHeader += ` close=${closeDate}`;+ if (closeDate) {+ pollHeader += ` close=${closeDate}`;+ }}pollHeader += "]";@@ -268,7 +295,9 @@ export default Controller.extend({if (pollOptions.length > 0 && !isNumber) {pollOptions.split("\n").forEach((option) => {- if (option.length !== 0) output += `* ${option}\n`;+ if (option.length !== 0) {+ output += `* ${option}\n`;+ }});}diff --git a/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6 b/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6index 10a0adf476f..1cd88d0ad6f 100644--- a/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6+++ b/plugins/poll/assets/javascripts/lib/discourse-markdown/poll.js.es6@@ -378,12 +378,15 @@ function md51(s) {}s = s.substring(i - 64);var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];- for (i = 0; i < s.length; i++)+ for (i = 0; i < s.length; i++) {tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);+ }tail[i >> 2] |= 0x80 << (i % 4 << 3);if (i > 55) {md5cycle(state, tail);- for (i = 0; i < 16; i++) tail[i] = 0;+ for (i = 0; i < 16; i++) {+ tail[i] = 0;+ }}tail[14] = n * 8;md5cycle(state, tail);@@ -409,13 +412,16 @@ var hex_chr = "0123456789abcdef".split("");function rhex(n) {var s = "",j = 0;- for (; j < 4; j++)+ for (; j < 4; j++) {s += hex_chr[(n >> (j * 8 + 4)) & 0x0f] + hex_chr[(n >> (j * 8)) & 0x0f];+ }return s;}function hex(x) {- for (var i = 0; i < x.length; i++) x[i] = rhex(x[i]);+ for (var i = 0; i < x.length; i++) {+ x[i] = rhex(x[i]);+ }return x.join("");}diff --git a/plugins/poll/assets/javascripts/lib/even-round.js.es6 b/plugins/poll/assets/javascripts/lib/even-round.js.es6index 0558b3943a6..93c1226b7a7 100644--- a/plugins/poll/assets/javascripts/lib/even-round.js.es6+++ b/plugins/poll/assets/javascripts/lib/even-round.js.es6@@ -21,7 +21,9 @@ export default function (percentages) {++percentages[index];decimals[index] = 0;// quit early when there is a rounding issue- if (sumsUpTo100(percentages)) break;+ if (sumsUpTo100(percentages)) {+ break;+ }}return percentages.map((p) => Math.floor(p));diff --git a/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6 b/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6index 5fae26fa3e4..cc5c2bea5a0 100644--- a/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6+++ b/plugins/poll/assets/javascripts/widgets/discourse-poll.js.es6@@ -102,7 +102,9 @@ createWidget("discourse-poll-load-more", {click() {const { state } = this;- if (state.loading) return;+ if (state.loading) {+ return;+ }state.loading = true;return this.sendWidgetAction("loadMore").finally(@@ -126,7 +128,9 @@ createWidget("discourse-poll-voters", {fetchVoters() {const { attrs, state } = this;- if (state.loaded === "loading") return;+ if (state.loaded === "loading") {+ return;+ }state.loaded = "loading";return _fetchVoters({@@ -691,7 +695,9 @@ export default createWidget("discourse-poll", {buildAttributes(attrs) {let cssClasses = "poll";- if (attrs.poll.chart_type === PIE_CHART_TYPE) cssClasses += " pie";+ if (attrs.poll.chart_type === PIE_CHART_TYPE) {+ cssClasses += " pie";+ }return {class: cssClasses,"data-poll-name": attrs.poll.get("name"),@@ -900,9 +906,15 @@ export default createWidget("discourse-poll", {toggleOption(option) {const { attrs } = this;- if (this.isClosed()) return;- if (!this.currentUser) return this.showLogin();- if (!checkUserGroups(this.currentUser, this.attrs.poll)) return;+ if (this.isClosed()) {+ return;+ }+ if (!this.currentUser) {+ return this.showLogin();+ }+ if (!checkUserGroups(this.currentUser, this.attrs.poll)) {+ return;+ }const { vote } = attrs;if (!this.isMultiple()) {@@ -916,8 +928,12 @@ export default createWidget("discourse-poll", {},castVotes() {- if (!this.canCastVotes()) return;- if (!this.currentUser) return this.showLogin();+ if (!this.canCastVotes()) {+ return;+ }+ if (!this.currentUser) {+ return this.showLogin();+ }const { attrs, state } = this;diff --git a/plugins/poll/config/locales/client.hy.yml b/plugins/poll/config/locales/client.hy.ymlindex 92f17d05400..53020c2dc54 100644--- a/plugins/poll/config/locales/client.hy.yml+++ b/plugins/poll/config/locales/client.hy.yml@@ -49,7 +49,7 @@ hy:title: Ստեղծել Հարցումinsert: Ներմուծել Հարցումhelp:- invalid_values: 'Նվազագույն արժեքը պետք է լինի առավելագույն արժեքից փոքր:'+ invalid_values: "Նվազագույն արժեքը պետք է լինի առավելագույն արժեքից փոքր:"min_step_value: Քայլի նվազագույն արժեքն է 1poll_type:label: Տիպըdiff --git a/plugins/poll/config/locales/server.fi.yml b/plugins/poll/config/locales/server.fi.ymlindex 522ed8214e2..7e2cfac9f00 100644--- a/plugins/poll/config/locales/server.fi.yml+++ b/plugins/poll/config/locales/server.fi.yml@@ -14,7 +14,7 @@ fi:poll_export_data_explorer_query_id: "ID, jonka määräät äänestystulosten viemiseen liittyville tietoselauskyselyille (0 poistaa käytöstä)."poll:poll: "äänestys"- invalid_argument: "Arvo \"%{value}\" ei kelpaa argumentiksi \"%{argument}\"."+ invalid_argument: 'Arvo "%{value}" ei kelpaa argumentiksi "%{argument}".'multiple_polls_without_name: "Viesti sisältää useamman nimettömän äänestyskyselyn. Nimeä ne '<code>name</code>'-määreellä."multiple_polls_with_same_name: "Useamman kyselyn nimi on <strong>%{name}</strong>. Anna kaikille eri nimet '<code>name</code>'-määreellä."default_poll_must_have_at_least_1_option: "Äänestyksessä tulee olla ainakin 1 vaihtoehto."diff --git a/plugins/poll/config/locales/server.ru.yml b/plugins/poll/config/locales/server.ru.ymlindex 055998aca51..eaffce38453 100644--- a/plugins/poll/config/locales/server.ru.yml+++ b/plugins/poll/config/locales/server.ru.yml@@ -25,10 +25,10 @@ ru:many: "В опросе может быть не более %{count} вариантов ответов."other: "В опросе может быть не более %{count} вариантов ответов."named_poll_must_have_less_options:- one: "В опросе под названием \"<strong>%{name}</strong>\" должно быть не более %{count} варианта ответа."- few: "В опросе под названием \"<strong>%{name}</strong>\" должно быть не более %{count} вариантов ответов."- many: "В опросе под названием \"<strong>%{name}</strong>\" должно быть не более %{count} вариантов ответов."- other: "В опросе под названием \"<strong>%{name}</strong>\" должно быть не более %{count} вариантов ответов."+ one: 'В опросе под названием "<strong>%{name}</strong>" должно быть не более %{count} варианта ответа.'+ few: 'В опросе под названием "<strong>%{name}</strong>" должно быть не более %{count} вариантов ответов.'+ many: 'В опросе под названием "<strong>%{name}</strong>" должно быть не более %{count} вариантов ответов.'+ other: 'В опросе под названием "<strong>%{name}</strong>" должно быть не более %{count} вариантов ответов.'default_poll_must_have_different_options: "В опросе не должно быть одинаковых вариантов ответа."named_poll_must_have_different_options: "В опросе <strong>%{name}</strong> не должно быть одинаковых вариантов ответа."default_poll_must_not_have_any_empty_options: "Настройки опроса не могут быть пустыми."diff --git a/plugins/poll/config/locales/server.te.yml b/plugins/poll/config/locales/server.te.ymlindex ac5d945ae8c..03967bdbb07 100644--- a/plugins/poll/config/locales/server.te.yml+++ b/plugins/poll/config/locales/server.te.yml@@ -4,4 +4,4 @@# To work with us on translations, join this project:# https://translate.discourse.org/-te:+te:diff --git a/plugins/poll/config/settings.yml b/plugins/poll/config/settings.ymlindex 1a02cde22e4..72ec297a5ad 100644--- a/plugins/poll/config/settings.yml+++ b/plugins/poll/config/settings.yml@@ -13,7 +13,7 @@ plugins:poll_minimum_trust_level_to_create:default: 1client: true- enum: 'TrustLevelSetting'+ enum: "TrustLevelSetting"poll_groupable_user_fields:default: ""type: listdiff --git a/test/javascripts/helpers/create-pretender.js b/test/javascripts/helpers/create-pretender.jsindex 4311954c5d0..5632aa3d2b0 100644--- a/test/javascripts/helpers/create-pretender.js+++ b/test/javascripts/helpers/create-pretender.js@@ -325,13 +325,14 @@ export function applyDefaultHandlers(pretender) {pretender.get("/draft.json", (request) => {if (request.queryParams.draft_key === "new_topic") {return response(fixturesByUrl["/draft.json"]);- } else if (request.queryParams.draft_key.startsWith("topic_"))+ } else if (request.queryParams.draft_key.startsWith("topic_")) {return response(fixturesByUrl[request.url] || {draft: null,draft_sequence: 0,});+ }return response({});});diff --git a/test/javascripts/helpers/qunit-helpers.js b/test/javascripts/helpers/qunit-helpers.jsindex 95500cf7665..668ef6db30a 100644--- a/test/javascripts/helpers/qunit-helpers.js+++ b/test/javascripts/helpers/qunit-helpers.js@@ -91,11 +91,16 @@ function AcceptanceModal(option, _relatedTarget) {typeof option === "object" && option);- if (!data) $this.data("bs.modal", (data = new Modal(this, options)));+ if (!data) {+ $this.data("bs.modal", (data = new Modal(this, options)));+ }data.$body = $("#ember-testing");- if (typeof option === "string") data[option](_relatedTarget);- else if (options.show) data.show(_relatedTarget);+ if (typeof option === "string") {+ data[option](_relatedTarget);+ } else if (options.show) {+ data.show(_relatedTarget);+ }});}@@ -106,7 +111,9 @@ let _pretenderCallbacks = {};export function applyPretender(name, server, helper) {const cb = _pretenderCallbacks[name];- if (cb) cb(server, helper);+ if (cb) {+ cb(server, helper);+ }}export function controllerModule(name, args = {}) {diff --git a/test/javascripts/lib/i18n-test.js b/test/javascripts/lib/i18n-test.jsindex 351bbb16f8e..7a8c20498f2 100644--- a/test/javascripts/lib/i18n-test.js+++ b/test/javascripts/lib/i18n-test.js@@ -70,11 +70,21 @@ QUnit.module("lib:i18n", {// fake pluralization rulesI18n.pluralizationRules = Object.assign({}, I18n.pluralizationRules);I18n.pluralizationRules.fr = function (n) {- if (n === 0) return "zero";- if (n === 1) return "one";- if (n === 2) return "two";- if (n >= 3 && n <= 9) return "few";- if (n >= 10 && n <= 99) return "many";+ if (n === 0) {+ return "zero";+ }+ if (n === 1) {+ return "one";+ }+ if (n === 2) {+ return "two";+ }+ if (n >= 3 && n <= 9) {+ return "few";+ }+ if (n >= 10 && n <= 99) {+ return "many";+ }return "other";};},@@ -153,9 +163,15 @@ QUnit.test("extra translations", (assert) => {},};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";+ if (n === 1) {+ return "one";+ }+ if (n % 10 >= 2 && n % 10 <= 4) {+ return "few";+ }+ if (n % 10 === 0) {+ return "many";+ }return "other";};