diff --git a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 index 5a8922a6380..530d1a616ee 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 @@ -42,17 +42,15 @@ export default Controller.extend({ if (isEmpty(this.newUsername)) return; if (this.unchanged) return; - User.checkUsername( - newUsername, - undefined, - this.get("model.id") - ).then(result => { - if (result.errors) { - this.set("errorMessage", result.errors.join(" ")); - } else if (result.available === false) { - this.set("taken", true); + User.checkUsername(newUsername, undefined, this.get("model.id")).then( + result => { + if (result.errors) { + this.set("errorMessage", result.errors.join(" ")); + } else if (result.available === false) { + this.set("taken", true); + } } - }); + ); } }, diff --git a/app/assets/javascripts/discourse/lib/click-track.js.es6 b/app/assets/javascripts/discourse/lib/click-track.js.es6 index 72002b4516e..c3186937b05 100644 --- a/app/assets/javascripts/discourse/lib/click-track.js.es6 +++ b/app/assets/javascripts/discourse/lib/click-track.js.es6 @@ -120,9 +120,7 @@ export default { } const isInternal = DiscourseURL.isInternal(href); - const openExternalInNewTab = User.currentProp( - "external_links_in_new_tab" - ); + const openExternalInNewTab = User.currentProp("external_links_in_new_tab"); if (!wantsNewWindow(e)) { if (!isInternal && openExternalInNewTab) { diff --git a/app/assets/javascripts/discourse/lib/render-topic-featured-link.js.es6 b/app/assets/javascripts/discourse/lib/render-topic-featured-link.js.es6 index 910809eea20..b4751954aa3 100644 --- a/app/assets/javascripts/discourse/lib/render-topic-featured-link.js.es6 +++ b/app/assets/javascripts/discourse/lib/render-topic-featured-link.js.es6 @@ -10,9 +10,7 @@ export function addFeaturedLinkMetaDecorator(decorator) { export function extractLinkMeta(topic) { const href = topic.get("featured_link"); - const target = User.currentProp("external_links_in_new_tab") - ? "_blank" - : ""; + const target = User.currentProp("external_links_in_new_tab") ? "_blank" : ""; if (!href) { return; diff --git a/app/assets/javascripts/discourse/lib/utilities.js.es6 b/app/assets/javascripts/discourse/lib/utilities.js.es6 index 635b442020b..bdc7b59d7c6 100644 --- a/app/assets/javascripts/discourse/lib/utilities.js.es6 +++ b/app/assets/javascripts/discourse/lib/utilities.js.es6 @@ -327,10 +327,7 @@ function staffExtensionsRegex() { } function isAuthorizedFile(fileName) { - if ( - User.currentProp("staff") && - staffExtensionsRegex().test(fileName) - ) { + if (User.currentProp("staff") && staffExtensionsRegex().test(fileName)) { return true; } return extensionsRegex().test(fileName); diff --git a/app/assets/javascripts/discourse/mixins/username-validation.js.es6 b/app/assets/javascripts/discourse/mixins/username-validation.js.es6 index 611f48fc8e5..3e18f815c5c 100644 --- a/app/assets/javascripts/discourse/mixins/username-validation.js.es6 +++ b/app/assets/javascripts/discourse/mixins/username-validation.js.es6 @@ -77,44 +77,43 @@ export default Mixin.create({ checkUsernameAvailability: discourseDebounce(function() { if (this.shouldCheckUsernameAvailability()) { - return User.checkUsername( - this.accountUsername, - this.accountEmail - ).then(result => { - this.set("isDeveloper", false); - if (result.available) { - if (result.is_developer) { - this.set("isDeveloper", true); - } - return this.set( - "uniqueUsernameValidation", - EmberObject.create({ - ok: true, - reason: I18n.t("user.username.available") - }) - ); - } else { - if (result.suggestion) { + return User.checkUsername(this.accountUsername, this.accountEmail).then( + result => { + this.set("isDeveloper", false); + if (result.available) { + if (result.is_developer) { + this.set("isDeveloper", true); + } return this.set( "uniqueUsernameValidation", EmberObject.create({ - failed: true, - reason: I18n.t("user.username.not_available", result) + ok: true, + reason: I18n.t("user.username.available") }) ); } else { - return this.set( - "uniqueUsernameValidation", - EmberObject.create({ - failed: true, - reason: result.errors - ? result.errors.join(" ") - : I18n.t("user.username.not_available_no_suggestion") - }) - ); + if (result.suggestion) { + return this.set( + "uniqueUsernameValidation", + EmberObject.create({ + failed: true, + reason: I18n.t("user.username.not_available", result) + }) + ); + } else { + return this.set( + "uniqueUsernameValidation", + EmberObject.create({ + failed: true, + reason: result.errors + ? result.errors.join(" ") + : I18n.t("user.username.not_available_no_suggestion") + }) + ); + } } } - }); + ); } }, 500), diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index 00088032c64..614db163326 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -606,8 +606,7 @@ export default RestModel.extend({ return this.findPostsByIds([postId]) .then(posts => { const ignoredUsers = - User.current() && - User.current().get("ignored_users"); + User.current() && User.current().get("ignored_users"); posts.forEach(p => { if (ignoredUsers && ignoredUsers.includes(p.username)) { this.stream.removeObject(postId); diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index b43c7da3b1d..d3e540aa911 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -27,7 +27,6 @@ import { Promise } from "rsvp"; import { getProperties } from "@ember/object"; import deprecated from "discourse-common/lib/deprecated"; import Site from "discourse/models/site"; -import User from "discourse/models/user"; export const SECOND_FACTOR_METHODS = { TOTP: 1,