diff --git a/app/assets/javascripts/admin/components/admin-graph.js.es6 b/app/assets/javascripts/admin/components/admin-graph.js.es6
index 0c356c13075..5ef384022e8 100644
--- a/app/assets/javascripts/admin/components/admin-graph.js.es6
+++ b/app/assets/javascripts/admin/components/admin-graph.js.es6
@@ -15,9 +15,7 @@ export default Ember.Component.extend({
{
data: rawData.map(r => r.y),
label: model.get("title"),
- backgroundColor: `rgba(200,220,240,${
- this.type === "bar" ? 1 : 0.3
- })`,
+ backgroundColor: `rgba(200,220,240,${this.type === "bar" ? 1 : 0.3})`,
borderColor: "#08C"
}
]
diff --git a/app/assets/javascripts/admin/components/admin-report.js.es6 b/app/assets/javascripts/admin/components/admin-report.js.es6
index 2c41342bf31..d539776804a 100644
--- a/app/assets/javascripts/admin/components/admin-report.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report.js.es6
@@ -75,11 +75,7 @@ export default Ember.Component.extend({
this._super(...arguments);
if (this.report) {
- this._renderReport(
- this.report,
- this.forcedModes,
- this.currentMode
- );
+ this._renderReport(this.report, this.forcedModes, this.currentMode);
} else if (this.dataSourceName) {
this._fetchReport();
}
@@ -271,11 +267,7 @@ export default Ember.Component.extend({
this.set("showFilteringUI", false);
}
- this._renderReport(
- report,
- this.forcedModes,
- this.currentMode
- );
+ this._renderReport(report, this.forcedModes, this.currentMode);
},
_renderReport(report, forcedModes, currentMode) {
diff --git a/app/assets/javascripts/admin/components/embeddable-host.js.es6 b/app/assets/javascripts/admin/components/embeddable-host.js.es6
index f606e3152b1..34d46ac181d 100644
--- a/app/assets/javascripts/admin/components/embeddable-host.js.es6
+++ b/app/assets/javascripts/admin/components/embeddable-host.js.es6
@@ -46,10 +46,7 @@ export default Ember.Component.extend(bufferedProperty("host"), {
host
.save(props)
.then(() => {
- host.set(
- "category",
- Discourse.Category.findById(this.categoryId)
- );
+ host.set("category", Discourse.Category.findById(this.categoryId));
this.set("editToggled", false);
})
.catch(popupAjaxError);
@@ -58,11 +55,9 @@ export default Ember.Component.extend(bufferedProperty("host"), {
delete() {
bootbox.confirm(I18n.t("admin.embedding.confirm_delete"), result => {
if (result) {
- this.host
- .destroyRecord()
- .then(() => {
- this.deleteHost(this.host);
- });
+ this.host.destroyRecord().then(() => {
+ this.deleteHost(this.host);
+ });
}
});
},
diff --git a/app/assets/javascripts/admin/components/ip-lookup.js.es6 b/app/assets/javascripts/admin/components/ip-lookup.js.es6
index 27586945045..d4bf91ec6a1 100644
--- a/app/assets/javascripts/admin/components/ip-lookup.js.es6
+++ b/app/assets/javascripts/admin/components/ip-lookup.js.es6
@@ -19,8 +19,8 @@ export default Ember.Component.extend({
this.set("show", true);
if (!this.location) {
- ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(
- location => this.set("location", Ember.Object.create(location))
+ ajax("/admin/users/ip-info", { data: { ip: this.ip } }).then(location =>
+ this.set("location", Ember.Object.create(location))
);
}
diff --git a/app/assets/javascripts/admin/components/resumable-upload.js.es6 b/app/assets/javascripts/admin/components/resumable-upload.js.es6
index 9c30065f240..b9cab230405 100644
--- a/app/assets/javascripts/admin/components/resumable-upload.js.es6
+++ b/app/assets/javascripts/admin/components/resumable-upload.js.es6
@@ -109,9 +109,7 @@ export default Ember.Component.extend(
buffer.push(iconHTML(icon));
buffer.push("" + this.text + "");
buffer.push(
- ""
+ ""
);
},
diff --git a/app/assets/javascripts/admin/components/secret-value-list.js.es6 b/app/assets/javascripts/admin/components/secret-value-list.js.es6
index e6b1d8adc7d..58539cb9160 100644
--- a/app/assets/javascripts/admin/components/secret-value-list.js.es6
+++ b/app/assets/javascripts/admin/components/secret-value-list.js.es6
@@ -29,8 +29,7 @@ export default Ember.Component.extend({
},
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/value-list.js.es6 b/app/assets/javascripts/admin/components/value-list.js.es6
index d99541bd44a..ff93375260c 100644
--- a/app/assets/javascripts/admin/components/value-list.js.es6
+++ b/app/assets/javascripts/admin/components/value-list.js.es6
@@ -79,10 +79,7 @@ export default Ember.Component.extend({
return;
}
- this.set(
- "values",
- this.collection.join(this.inputDelimiter || "\n")
- );
+ this.set("values", this.collection.join(this.inputDelimiter || "\n"));
},
_splitValues(values, delimiter) {
diff --git a/app/assets/javascripts/admin/components/watched-word-form.js.es6 b/app/assets/javascripts/admin/components/watched-word-form.js.es6
index 3f11f4b3be4..837ce517b04 100644
--- a/app/assets/javascripts/admin/components/watched-word-form.js.es6
+++ b/app/assets/javascripts/admin/components/watched-word-form.js.es6
@@ -29,9 +29,7 @@ export default Ember.Component.extend({
@computed("word")
isUniqueWord(word) {
const words = this.filteredContent || [];
- const filtered = words.filter(
- content => content.action === this.actionKey
- );
+ const filtered = words.filter(content => content.action === this.actionKey);
return filtered.every(
content => content.word.toLowerCase() !== word.toLowerCase()
);
diff --git a/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6
index bc4fd72d53d..7a9be8cc5dc 100644
--- a/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin-customize-colors.js.es6
@@ -23,10 +23,7 @@ export default Ember.Controller.extend({
actions: {
newColorSchemeWithBase(baseKey) {
- const base = this.baseColorSchemes.findBy(
- "base_scheme_id",
- baseKey
- );
+ const base = this.baseColorSchemes.findBy("base_scheme_id", baseKey);
const newColorScheme = Ember.copy(base, true);
newColorScheme.setProperties({
name: I18n.t("admin.customize.colors.new_name"),
diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6
index 0c18d7e6996..ba54e3c91fd 100644
--- a/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-edit.js.es6
@@ -36,30 +36,18 @@ export default Ember.Controller.extend({
actions: {
save() {
this.set("saving", true);
- this.model
- .saveChanges("theme_fields")
- .finally(() => {
- this.set("saving", false);
- });
+ this.model.saveChanges("theme_fields").finally(() => {
+ this.set("saving", false);
+ });
},
fieldAdded(target, name) {
- this.replaceRoute(
- this.editRouteName,
- this.get("model.id"),
- target,
- name
- );
+ this.replaceRoute(this.editRouteName, this.get("model.id"), target, name);
},
onlyOverriddenChanged(onlyShowOverridden) {
if (onlyShowOverridden) {
- if (
- !this.model.hasEdited(
- this.currentTargetName,
- this.fieldName
- )
- ) {
+ if (!this.model.hasEdited(this.currentTargetName, this.fieldName)) {
let firstTarget = this.get("model.targets").find(t => t.edited);
let firstField = this.get(`model.fields.${firstTarget.name}`).find(
f => f.edited
diff --git a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6
index 9b4a5e10cbf..407478d681d 100644
--- a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6
@@ -39,11 +39,7 @@ export default Ember.Controller.extend({
this.set("sendingEmail", true);
this.set("sentEmail", false);
- EmailPreview.sendDigest(
- this.username,
- this.lastSeen,
- this.email
- )
+ EmailPreview.sendDigest(this.username, this.lastSeen, this.email)
.then(result => {
if (result.errors) {
bootbox.alert(result.errors);
diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6
index 9575f455425..09a335946d8 100644
--- a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6
@@ -12,9 +12,7 @@ export default Ember.Controller.extend({
let filter;
if (this.filter) {
- filter = this.filter
- .toLowerCase()
- .trim();
+ filter = this.filter.toLowerCase().trim();
}
if ((!filter || 0 === filter.length) && !this.onlyOverridden) {
diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6
index c1cfa3d0857..79eceed9f10 100644
--- a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6
@@ -209,9 +209,7 @@ export default Ember.Controller.extend(CanCheckEmails, {
this.adminTools.showSuspendModal(this.model);
},
unsuspend() {
- this.model
- .unsuspend()
- .catch(popupAjaxError);
+ this.model.unsuspend().catch(popupAjaxError);
},
showSilenceModal() {
this.adminTools.showSilenceModal(this.model);
diff --git a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6
index 6e44b15d7b2..2a637d72786 100644
--- a/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6
+++ b/app/assets/javascripts/admin/controllers/admin-web-hooks-show.js.es6
@@ -92,9 +92,7 @@ export default Ember.Controller.extend({
.save()
.then(() => {
this.set("saved", true);
- this.adminWebHooks
- .get("model")
- .addObject(model);
+ this.adminWebHooks.get("model").addObject(model);
if (isNew) {
this.transitionToRoute("adminWebHooks.show", model.get("id"));
@@ -135,9 +133,7 @@ export default Ember.Controller.extend({
model
.destroyRecord()
.then(() => {
- this.adminWebHooks
- .get("model")
- .removeObject(model);
+ this.adminWebHooks.get("model").removeObject(model);
this.transitionToRoute("adminWebHooks");
})
.catch(popupAjaxError);
diff --git a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6
index bde1d91e6ca..562bf406904 100644
--- a/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6
+++ b/app/assets/javascripts/admin/controllers/modals/admin-install-theme.js.es6
@@ -273,10 +273,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
this.set("loading", true);
ajax(this.importUrl, options)
.then(result => {
- const theme = this.store.createRecord(
- this.recordType,
- result.theme
- );
+ const theme = this.store.createRecord(this.recordType, result.theme);
this.adminCustomizeThemes.send("addTheme", theme);
this.send("closeModal");
})
diff --git a/app/assets/javascripts/admin/models/color-scheme-color.js.es6 b/app/assets/javascripts/admin/models/color-scheme-color.js.es6
index 970b1cfe90c..a2f1a7b12d6 100644
--- a/app/assets/javascripts/admin/models/color-scheme-color.js.es6
+++ b/app/assets/javascripts/admin/models/color-scheme-color.js.es6
@@ -76,12 +76,7 @@ const ColorSchemeColor = Discourse.Model.extend({
@observes("hex")
hexValueChanged() {
if (this.hex) {
- this.set(
- "hex",
- this.hex
- .toString()
- .replace(/[^0-9a-fA-F]/g, "")
- );
+ this.set("hex", this.hex.toString().replace(/[^0-9a-fA-F]/g, ""));
}
},
diff --git a/app/assets/javascripts/admin/models/screened-ip-address.js.es6 b/app/assets/javascripts/admin/models/screened-ip-address.js.es6
index 6aa5a8074d0..c7f3863738c 100644
--- a/app/assets/javascripts/admin/models/screened-ip-address.js.es6
+++ b/app/assets/javascripts/admin/models/screened-ip-address.js.es6
@@ -30,10 +30,9 @@ const ScreenedIpAddress = Discourse.Model.extend({
},
destroy() {
- return ajax(
- "/admin/logs/screened_ip_addresses/" + this.id + ".json",
- { type: "DELETE" }
- );
+ return ajax("/admin/logs/screened_ip_addresses/" + this.id + ".json", {
+ type: "DELETE"
+ });
}
});
diff --git a/app/assets/javascripts/admin/models/tl3-requirements.js.es6 b/app/assets/javascripts/admin/models/tl3-requirements.js.es6
index bf77f752aea..222c8077d73 100644
--- a/app/assets/javascripts/admin/models/tl3-requirements.js.es6
+++ b/app/assets/javascripts/admin/models/tl3-requirements.js.es6
@@ -50,23 +50,17 @@ export default Discourse.Model.extend({
topics_viewed: this.topics_viewed >= this.min_topics_viewed,
posts_read: this.posts_read >= this.min_posts_read,
topics_viewed_all_time:
- this.topics_viewed_all_time >=
- this.min_topics_viewed_all_time,
+ this.topics_viewed_all_time >= this.min_topics_viewed_all_time,
posts_read_all_time:
this.posts_read_all_time >= this.min_posts_read_all_time,
- flagged_posts:
- this.num_flagged_posts <= this.max_flagged_posts,
- flagged_by_users:
- this.num_flagged_by_users <= this.max_flagged_by_users,
+ flagged_posts: this.num_flagged_posts <= this.max_flagged_posts,
+ flagged_by_users: this.num_flagged_by_users <= this.max_flagged_by_users,
likes_given: this.num_likes_given >= this.min_likes_given,
- likes_received:
- this.num_likes_received >= this.min_likes_received,
+ likes_received: this.num_likes_received >= this.min_likes_received,
likes_received_days:
- this.num_likes_received_days >=
- this.min_likes_received_days,
+ this.num_likes_received_days >= this.min_likes_received_days,
likes_received_users:
- this.num_likes_received_users >=
- this.min_likes_received_users,
+ this.num_likes_received_users >= this.min_likes_received_users,
level_locked: this.trust_level_locked,
silenced: this.get("penalty_counts.silenced") === 0,
suspended: this.get("penalty_counts.suspended") === 0
diff --git a/app/assets/javascripts/discourse/components/badge-selector.js.es6 b/app/assets/javascripts/discourse/components/badge-selector.js.es6
index 06eb22f5fdf..b794984aecb 100644
--- a/app/assets/javascripts/discourse/components/badge-selector.js.es6
+++ b/app/assets/javascripts/discourse/components/badge-selector.js.es6
@@ -24,9 +24,7 @@ export default Ember.Component.extend({
self.$("input").autocomplete({
allowAny: false,
- items: _.isArray(this.badgeNames)
- ? this.badgeNames
- : [this.badgeNames],
+ items: _.isArray(this.badgeNames) ? this.badgeNames : [this.badgeNames],
single: this.single,
updateData: opts && opts.updateData ? opts.updateData : false,
onChangeItems: function(items) {
diff --git a/app/assets/javascripts/discourse/components/categories-boxes.js.es6 b/app/assets/javascripts/discourse/components/categories-boxes.js.es6
index bc35ab4b142..f78bfbfcd78 100644
--- a/app/assets/javascripts/discourse/components/categories-boxes.js.es6
+++ b/app/assets/javascripts/discourse/components/categories-boxes.js.es6
@@ -11,16 +11,12 @@ export default Ember.Component.extend({
@computed("categories.[].uploaded_logo.url")
anyLogos() {
- return this.categories.any(
- c => !Ember.isEmpty(c.get("uploaded_logo.url"))
- );
+ return this.categories.any(c => !Ember.isEmpty(c.get("uploaded_logo.url")));
},
@computed("categories.[].subcategories")
hasSubcategories() {
- return this.categories.any(
- c => !Ember.isEmpty(c.get("subcategories"))
- );
+ return this.categories.any(c => !Ember.isEmpty(c.get("subcategories")));
},
click(e) {
diff --git a/app/assets/javascripts/discourse/components/composer-body.js.es6 b/app/assets/javascripts/discourse/components/composer-body.js.es6
index a266d6fc0a5..bd7a4488eb0 100644
--- a/app/assets/javascripts/discourse/components/composer-body.js.es6
+++ b/app/assets/javascripts/discourse/components/composer-body.js.es6
@@ -87,10 +87,7 @@ export default Ember.Component.extend(KeyEnterEscape, {
@observes("composeState")
disableFullscreen() {
- if (
- this.composeState !== Composer.OPEN &&
- positioningWorkaround.blur
- ) {
+ if (this.composeState !== Composer.OPEN && positioningWorkaround.blur) {
positioningWorkaround.blur();
}
},
diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6
index 91d30b2d828..a81565c5cac 100644
--- a/app/assets/javascripts/discourse/components/composer-editor.js.es6
+++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6
@@ -341,14 +341,7 @@ export default Ember.Component.extend({
this.set("shouldBuildScrollMap", false);
}
- Ember.run.throttle(
- this,
- $callback,
- $input,
- $preview,
- this.scrollMap,
- 20
- );
+ Ember.run.throttle(this, $callback, $input, $preview, this.scrollMap, 20);
},
_teardownInputPreviewSync() {
@@ -739,10 +732,7 @@ export default Ember.Component.extend({
this._setUploadPlaceholderSend(data);
- this.appEvents.trigger(
- "composer:insert-text",
- this.uploadPlaceholder
- );
+ this.appEvents.trigger("composer:insert-text", this.uploadPlaceholder);
if (data.xhr && data.originalFiles.length === 1) {
this.set("isCancellable", true);
@@ -963,11 +953,7 @@ export default Ember.Component.extend({
unshift: true
});
- if (
- this.allowUpload &&
- this.uploadIcon &&
- !this.site.mobileView
- ) {
+ if (this.allowUpload && this.uploadIcon && !this.site.mobileView) {
toolbar.addButton({
id: "upload",
group: "insertions",
diff --git a/app/assets/javascripts/discourse/components/composer-title.js.es6 b/app/assets/javascripts/discourse/components/composer-title.js.es6
index 3c196f709db..345e2ca9b4f 100644
--- a/app/assets/javascripts/discourse/components/composer-title.js.es6
+++ b/app/assets/javascripts/discourse/components/composer-title.js.es6
@@ -64,9 +64,7 @@ export default Ember.Component.extend({
titleMaxLength() {
// maxLength gets in the way of pasting long links, so don't use it if featured links are allowed.
// Validation will display a message if titles are too long.
- return this.watchForLink
- ? null
- : this.siteSettings.max_topic_title_length;
+ return this.watchForLink ? null : this.siteSettings.max_topic_title_length;
},
@observes("composer.titleLength", "watchForLink")
diff --git a/app/assets/javascripts/discourse/components/create-topics-notice.js.es6 b/app/assets/javascripts/discourse/components/create-topics-notice.js.es6
index 404949510fc..1e7658cfd59 100644
--- a/app/assets/javascripts/discourse/components/create-topics-notice.js.es6
+++ b/app/assets/javascripts/discourse/components/create-topics-notice.js.es6
@@ -27,10 +27,7 @@ export default Ember.Component.extend({
}
});
- if (
- topicCount < this.requiredTopics ||
- postCount < this.requiredPosts
- ) {
+ if (topicCount < this.requiredTopics || postCount < this.requiredPosts) {
this.set("enabled", true);
this.fetchLiveStats();
}
diff --git a/app/assets/javascripts/discourse/components/d-button.js.es6 b/app/assets/javascripts/discourse/components/d-button.js.es6
index 3adebce86f3..c41ad2a53ee 100644
--- a/app/assets/javascripts/discourse/components/d-button.js.es6
+++ b/app/assets/javascripts/discourse/components/d-button.js.es6
@@ -55,10 +55,7 @@ export default Ember.Component.extend({
click() {
if (typeof this.action === "string") {
this.sendAction("action", this.actionParam);
- } else if (
- typeof this.action === "object" &&
- this.action.value
- ) {
+ } else if (typeof this.action === "object" && this.action.value) {
this.action.value(this.actionParam);
} else if (typeof this.action === "function") {
this.action(this.actionParam);
diff --git a/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6 b/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6
index 8290cae4bc7..907c2135993 100644
--- a/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6
+++ b/app/assets/javascripts/discourse/components/discovery-topics-list.js.es6
@@ -39,16 +39,14 @@ const DiscoveryTopicsListComponent = Ember.Component.extend(
actions: {
loadMore() {
Discourse.updateContextCount(0);
- this.model
- .loadMore()
- .then(hasMoreResults => {
- Ember.run.schedule("afterRender", () => this.saveScrollPosition());
- if (!hasMoreResults) {
- this.eyeline.flushRest();
- } else if ($(window).height() >= $(document).height()) {
- this.send("loadMore");
- }
- });
+ this.model.loadMore().then(hasMoreResults => {
+ Ember.run.schedule("afterRender", () => this.saveScrollPosition());
+ if (!hasMoreResults) {
+ this.eyeline.flushRest();
+ } else if ($(window).height() >= $(document).height()) {
+ this.send("loadMore");
+ }
+ });
}
}
}
diff --git a/app/assets/javascripts/discourse/components/group-members-input.js.es6 b/app/assets/javascripts/discourse/components/group-members-input.js.es6
index 59662c26b74..8ef63b5a505 100644
--- a/app/assets/javascripts/discourse/components/group-members-input.js.es6
+++ b/app/assets/javascripts/discourse/components/group-members-input.js.es6
@@ -63,9 +63,7 @@ export default Ember.Component.extend({
if (Ember.isEmpty(this.get("model.usernames"))) {
return;
}
- this.model
- .addMembers(this.get("model.usernames"))
- .catch(popupAjaxError);
+ this.model.addMembers(this.get("model.usernames")).catch(popupAjaxError);
this.set("model.usernames", null);
},
diff --git a/app/assets/javascripts/discourse/components/input-tip.js.es6 b/app/assets/javascripts/discourse/components/input-tip.js.es6
index b2ad93590eb..aceafa74580 100644
--- a/app/assets/javascripts/discourse/components/input-tip.js.es6
+++ b/app/assets/javascripts/discourse/components/input-tip.js.es6
@@ -12,9 +12,7 @@ export default Ember.Component.extend(
buildBuffer(buffer) {
const reason = this.get("validation.reason");
if (reason) {
- buffer.push(
- iconHTML(this.good ? "check" : "times") + " " + reason
- );
+ buffer.push(iconHTML(this.good ? "check" : "times") + " " + reason);
}
}
})
diff --git a/app/assets/javascripts/discourse/components/invite-panel.js.es6 b/app/assets/javascripts/discourse/components/invite-panel.js.es6
index feeae1b8fee..432a0b7325d 100644
--- a/app/assets/javascripts/discourse/components/invite-panel.js.es6
+++ b/app/assets/javascripts/discourse/components/invite-panel.js.es6
@@ -127,9 +127,7 @@ export default Ember.Component.extend({
@computed("inviteModel", "inviteModel.details.can_invite_via_email")
canInviteViaEmail(inviteModel, canInviteViaEmail) {
- return this.inviteModel === this.currentUser
- ? true
- : canInviteViaEmail;
+ return this.inviteModel === this.currentUser ? true : canInviteViaEmail;
},
@computed("isPM", "canInviteViaEmail")
@@ -184,10 +182,7 @@ export default Ember.Component.extend({
@computed("emailOrUsername")
showCustomMessage(emailOrUsername) {
- return (
- this.inviteModel === this.currentUser ||
- emailValid(emailOrUsername)
- );
+ return this.inviteModel === this.currentUser || emailValid(emailOrUsername);
},
// Instructional text for the modal.
@@ -386,11 +381,7 @@ export default Ember.Component.extend({
}
return model
- .generateInviteLink(
- this.emailOrUsername.trim(),
- groupNames,
- topicId
- )
+ .generateInviteLink(this.emailOrUsername.trim(), groupNames, topicId)
.then(result => {
model.setProperties({
saving: false,
diff --git a/app/assets/javascripts/discourse/components/topic-list-item.js.es6 b/app/assets/javascripts/discourse/components/topic-list-item.js.es6
index 8d3b139e4c0..cc0c07d8017 100644
--- a/app/assets/javascripts/discourse/components/topic-list-item.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-list-item.js.es6
@@ -181,9 +181,7 @@ export default Ember.Component.extend(
actions: {
toggleBookmark() {
- this.topic
- .toggleBookmark()
- .finally(() => this.rerenderBuffer());
+ this.topic.toggleBookmark().finally(() => this.rerenderBuffer());
}
},
diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6
index ec6d46d9aa0..1c8ecb254a1 100644
--- a/app/assets/javascripts/discourse/controllers/create-account.js.es6
+++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6
@@ -173,8 +173,7 @@ export default Ember.Controller.extend(
}
if (
this.get("emailValidation.ok") &&
- (Ember.isEmpty(this.accountUsername) ||
- this.get("authOptions.email"))
+ (Ember.isEmpty(this.accountUsername) || this.get("authOptions.email"))
) {
// If email is valid and username has not been entered yet,
// or email and username were filled automatically by 3rd parth auth,
diff --git a/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6 b/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6
index 781229ed638..d90ca5cbd4a 100644
--- a/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6
+++ b/app/assets/javascripts/discourse/controllers/edit-topic-timer.js.es6
@@ -85,9 +85,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
this.set("model.closed", result.closed);
} else {
const topicTimer =
- this.isPublic === "true"
- ? "topic_timer"
- : "private_topic_timer";
+ this.isPublic === "true" ? "topic_timer" : "private_topic_timer";
this.set(`model.${topicTimer}`, Ember.Object.create({}));
this.setProperties({
diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6
index 03bd572782e..af832d4fe2f 100644
--- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6
+++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6
@@ -291,9 +291,7 @@ export default Ember.Controller.extend({
},
selectAll() {
- this.selected.addObjects(
- this.get("model.posts").map(r => r.topic)
- );
+ this.selected.addObjects(this.get("model.posts").map(r => r.topic));
// Doing this the proper way is a HUGE pain,
// we can hack this to work by observing each on the array
// in the component, however, when we select ANYTHING, we would force
diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6
index d1d5c45f733..df2833e1878 100644
--- a/app/assets/javascripts/discourse/controllers/history.js.es6
+++ b/app/assets/javascripts/discourse/controllers/history.js.es6
@@ -180,9 +180,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
@computed("model.previous_hidden", "model.current_hidden", "displayingInline")
hiddenClasses(prevHidden, currentHidden, displayingInline) {
if (displayingInline) {
- return this.isEitherRevisionHidden
- ? "hidden-revision-either"
- : null;
+ return this.isEitherRevisionHidden ? "hidden-revision-either" : null;
} else {
var result = [];
if (prevHidden) {
diff --git a/app/assets/javascripts/discourse/controllers/invites-show.js.es6 b/app/assets/javascripts/discourse/controllers/invites-show.js.es6
index 463549851fb..2664a95bd78 100644
--- a/app/assets/javascripts/discourse/controllers/invites-show.js.es6
+++ b/app/assets/javascripts/discourse/controllers/invites-show.js.es6
@@ -97,9 +97,7 @@ export default Ember.Controller.extend(
result.errors.password &&
result.errors.password.length > 0
) {
- this.rejectedPasswords.pushObject(
- this.accountPassword
- );
+ this.rejectedPasswords.pushObject(this.accountPassword);
this.rejectedPasswordsMessages.set(
this.accountPassword,
result.errors.password[0]
diff --git a/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6 b/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6
index e5cabd5b28f..385db0406f5 100644
--- a/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6
+++ b/app/assets/javascripts/discourse/controllers/jump-to-post.js.es6
@@ -15,10 +15,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
actions: {
jump() {
if (this.postNumber) {
- this._jumpToIndex(
- this.filteredPostsCount,
- this.postNumber
- );
+ this._jumpToIndex(this.filteredPostsCount, this.postNumber);
} else if (this.postDate) {
this._jumpToDate(this.postDate);
}
diff --git a/app/assets/javascripts/discourse/controllers/password-reset.js.es6 b/app/assets/javascripts/discourse/controllers/password-reset.js.es6
index 2bfbe588d20..2d48d74e2ec 100644
--- a/app/assets/javascripts/discourse/controllers/password-reset.js.es6
+++ b/app/assets/javascripts/discourse/controllers/password-reset.js.es6
@@ -69,9 +69,7 @@ export default Ember.Controller.extend(PasswordValidation, {
result.errors.password &&
result.errors.password.length > 0
) {
- this.rejectedPasswords.pushObject(
- this.accountPassword
- );
+ this.rejectedPasswords.pushObject(this.accountPassword);
this.rejectedPasswordsMessages.set(
this.accountPassword,
result.errors.password[0]
diff --git a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6
index 859325fcf64..abbd0c912eb 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6
@@ -61,23 +61,21 @@ export default Ember.Controller.extend({
const self = this;
this.set("saving", true);
- return this.model
- .changeEmail(this.newEmail)
- .then(
- () => self.set("success", true),
- e => {
- self.setProperties({ error: true, saving: false });
- if (
- e.jqXHR.responseJSON &&
- e.jqXHR.responseJSON.errors &&
- e.jqXHR.responseJSON.errors[0]
- ) {
- self.set("errorMessage", e.jqXHR.responseJSON.errors[0]);
- } else {
- self.set("errorMessage", I18n.t("user.change_email.error"));
- }
+ return this.model.changeEmail(this.newEmail).then(
+ () => self.set("success", true),
+ e => {
+ self.setProperties({ error: true, saving: false });
+ if (
+ e.jqXHR.responseJSON &&
+ e.jqXHR.responseJSON.errors &&
+ e.jqXHR.responseJSON.errors[0]
+ ) {
+ self.set("errorMessage", e.jqXHR.responseJSON.errors[0]);
+ } else {
+ self.set("errorMessage", I18n.t("user.change_email.error"));
}
- );
+ }
+ );
}
}
});
diff --git a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6
index 4ef40b845cf..367f83903c5 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6
@@ -75,9 +75,7 @@ export default Ember.Controller.extend({
.changeUsername(this.newUsername)
.then(() => {
DiscourseURL.redirectTo(
- userPath(
- this.newUsername.toLowerCase() + "/preferences"
- )
+ userPath(this.newUsername.toLowerCase() + "/preferences")
);
})
.catch(popupAjaxError)
diff --git a/app/assets/javascripts/discourse/controllers/preferences/users.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/users.js.es6
index 88efe20a206..b1174ccba47 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/users.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/users.js.es6
@@ -25,9 +25,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
if (!user.get("ignored")) {
const usernames = this.ignoredUsernames
.split(",")
- .removeAt(
- this.ignoredUsernames.split(",").length - 1
- )
+ .removeAt(this.ignoredUsernames.split(",").length - 1)
.join(",");
this.set("ignoredUsernames", usernames);
}
@@ -36,9 +34,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
});
}
} else {
- return this.model
- .save(["ignored_usernames"])
- .catch(popupAjaxError);
+ return this.model.save(["ignored_usernames"]).catch(popupAjaxError);
}
},
save() {
diff --git a/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6
index d2128efab14..7b80def0b7d 100644
--- a/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6
+++ b/app/assets/javascripts/discourse/controllers/tag-groups-show.js.es6
@@ -14,12 +14,10 @@ export default Ember.Controller.extend({
destroy => {
if (destroy) {
const c = this.get("tagGroups.model");
- return this.model
- .destroy()
- .then(() => {
- c.removeObject(this.model);
- this.transitionToRoute("tagGroups");
- });
+ return this.model.destroy().then(() => {
+ c.removeObject(this.model);
+ this.transitionToRoute("tagGroups");
+ });
}
}
);
diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6
index d57fbd22d33..1ec3b6cf30a 100644
--- a/app/assets/javascripts/discourse/controllers/topic.js.es6
+++ b/app/assets/javascripts/discourse/controllers/topic.js.es6
@@ -607,16 +607,14 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
} else if (post) {
return post.toggleBookmark().catch(popupAjaxError);
} else {
- return this.model
- .toggleBookmark()
- .then(changedIds => {
- if (!changedIds) {
- return;
- }
- changedIds.forEach(id =>
- this.appEvents.trigger("post-stream:refresh", { id })
- );
- });
+ return this.model.toggleBookmark().then(changedIds => {
+ if (!changedIds) {
+ return;
+ }
+ changedIds.forEach(id =>
+ this.appEvents.trigger("post-stream:refresh", { id })
+ );
+ });
}
},
@@ -842,11 +840,9 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
toggleClosed() {
const topic = this.model;
- this.model
- .toggleStatus("closed")
- .then(result => {
- topic.set("topic_status_update", result.topic_status_update);
- });
+ this.model.toggleStatus("closed").then(result => {
+ topic.set("topic_status_update", result.topic_status_update);
+ });
},
recoverTopic() {
@@ -1044,9 +1040,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
);
} else {
postStream.loadPostByPostNumber(postNumber).then(p => {
- DiscourseURL.routeTo(
- this.model.urlForPostNumber(p.get("post_number"))
- );
+ DiscourseURL.routeTo(this.model.urlForPostNumber(p.get("post_number")));
});
}
},
@@ -1197,10 +1191,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
},
postSelected(post) {
- return (
- this.selectedAllPost ||
- this.selectedPostIds.includes(post.id)
- );
+ return this.selectedAllPost || this.selectedPostIds.includes(post.id);
},
@computed
diff --git a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6
index d689dc54cfc..d7450ae3bca 100644
--- a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6
+++ b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6
@@ -26,11 +26,9 @@ export default Ember.Controller.extend({
@observes("searchTerm")
_searchTermChanged: debounce(function() {
- Invite.findInvitedBy(
- this.user,
- this.filter,
- this.searchTerm
- ).then(invites => this.set("model", invites));
+ Invite.findInvitedBy(this.user, this.filter, this.searchTerm).then(
+ invites => this.set("model", invites)
+ );
}, 250),
inviteRedeemed: Ember.computed.equal("filter", "redeemed"),
diff --git a/app/assets/javascripts/discourse/mixins/upload.js.es6 b/app/assets/javascripts/discourse/mixins/upload.js.es6
index ce46d04c031..394b6a73f38 100644
--- a/app/assets/javascripts/discourse/mixins/upload.js.es6
+++ b/app/assets/javascripts/discourse/mixins/upload.js.es6
@@ -106,8 +106,7 @@ export default Ember.Mixin.create({
}.on("didInsertElement"),
_destroy: function() {
- this.messageBus &&
- this.messageBus.unsubscribe("/uploads/" + this.type);
+ this.messageBus && this.messageBus.unsubscribe("/uploads/" + this.type);
const $upload = this.$();
try {
diff --git a/app/assets/javascripts/discourse/models/badge-grouping.js.es6 b/app/assets/javascripts/discourse/models/badge-grouping.js.es6
index 2e79188b69f..573dff223d7 100644
--- a/app/assets/javascripts/discourse/models/badge-grouping.js.es6
+++ b/app/assets/javascripts/discourse/models/badge-grouping.js.es6
@@ -4,9 +4,7 @@ import RestModel from "discourse/models/rest";
export default RestModel.extend({
@computed("name")
i18nNameKey() {
- return this.name
- .toLowerCase()
- .replace(/\s/g, "_");
+ return this.name.toLowerCase().replace(/\s/g, "_");
},
@computed("name")
diff --git a/app/assets/javascripts/discourse/models/group.js.es6 b/app/assets/javascripts/discourse/models/group.js.es6
index f017d836ed1..8e05d10f94b 100644
--- a/app/assets/javascripts/discourse/models/group.js.es6
+++ b/app/assets/javascripts/discourse/models/group.js.es6
@@ -41,33 +41,27 @@ const Group = RestModel.extend({
return;
}
- const offset = Math.min(
- this.user_count,
- Math.max(this.offset, 0)
+ const offset = Math.min(this.user_count, Math.max(this.offset, 0));
+
+ return Group.loadMembers(this.name, offset, this.limit, params).then(
+ result => {
+ var ownerIds = {};
+ result.owners.forEach(owner => (ownerIds[owner.id] = true));
+
+ this.setProperties({
+ user_count: result.meta.total,
+ limit: result.meta.limit,
+ offset: result.meta.offset,
+ members: result.members.map(member => {
+ if (ownerIds[member.id]) {
+ member.owner = true;
+ }
+ return User.create(member);
+ }),
+ owners: result.owners.map(owner => User.create(owner))
+ });
+ }
);
-
- return Group.loadMembers(
- this.name,
- offset,
- this.limit,
- params
- ).then(result => {
- var ownerIds = {};
- result.owners.forEach(owner => (ownerIds[owner.id] = true));
-
- this.setProperties({
- user_count: result.meta.total,
- limit: result.meta.limit,
- offset: result.meta.offset,
- members: result.members.map(member => {
- if (ownerIds[member.id]) {
- member.owner = true;
- }
- return User.create(member);
- }),
- owners: result.owners.map(owner => User.create(owner))
- });
- });
},
removeOwner(member) {
@@ -251,16 +245,14 @@ const Group = RestModel.extend({
data.category_id = parseInt(opts.categoryId);
}
- return ajax(`/groups/${this.name}/${type}.json`, { data }).then(
- posts => {
- return posts.map(p => {
- p.user = User.create(p.user);
- p.topic = Topic.create(p.topic);
- p.category = Category.findById(p.category_id);
- return Ember.Object.create(p);
- });
- }
- );
+ return ajax(`/groups/${this.name}/${type}.json`, { data }).then(posts => {
+ return posts.map(p => {
+ p.user = User.create(p.user);
+ p.topic = Topic.create(p.topic);
+ p.category = Category.findById(p.category_id);
+ return Ember.Object.create(p);
+ });
+ });
},
setNotification(notification_level, userId) {
diff --git a/app/assets/javascripts/discourse/models/login-method.js.es6 b/app/assets/javascripts/discourse/models/login-method.js.es6
index 001671dcc01..f79644ee712 100644
--- a/app/assets/javascripts/discourse/models/login-method.js.es6
+++ b/app/assets/javascripts/discourse/models/login-method.js.es6
@@ -3,25 +3,17 @@ import computed from "ember-addons/ember-computed-decorators";
const LoginMethod = Ember.Object.extend({
@computed
title() {
- return (
- this.title_override || I18n.t(`login.${this.name}.title`)
- );
+ return this.title_override || I18n.t(`login.${this.name}.title`);
},
@computed
prettyName() {
- return (
- this.pretty_name_override ||
- I18n.t(`login.${this.name}.name`)
- );
+ return this.pretty_name_override || I18n.t(`login.${this.name}.name`);
},
@computed
message() {
- return (
- this.message_override ||
- I18n.t("login." + this.name + ".message")
- );
+ return this.message_override || I18n.t("login." + this.name + ".message");
},
doLogin({ reconnect = false, fullScreenLogin = true } = {}) {
diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6
index 2812693388f..ed079dcc31b 100644
--- a/app/assets/javascripts/discourse/models/post-stream.js.es6
+++ b/app/assets/javascripts/discourse/models/post-stream.js.es6
@@ -487,9 +487,7 @@ export default RestModel.extend({
**/
undoPost(post) {
this.stream.removeObject(-1);
- this.postsWithPlaceholders.removePost(() =>
- this.posts.removeObject(post)
- );
+ this.postsWithPlaceholders.removePost(() => this.posts.removeObject(post));
this._identityMap[-1] = null;
const topic = this.topic;
@@ -520,9 +518,7 @@ export default RestModel.extend({
if (!posts.includes(stored)) {
if (!this.loadingBelow) {
- this.postsWithPlaceholders.appendPost(() =>
- posts.pushObject(stored)
- );
+ this.postsWithPlaceholders.appendPost(() => posts.pushObject(stored));
} else {
posts.pushObject(stored);
}
diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6
index 6b431edec94..5ce71ab8b55 100644
--- a/app/assets/javascripts/discourse/models/post.js.es6
+++ b/app/assets/javascripts/discourse/models/post.js.es6
@@ -91,9 +91,7 @@ const Post = RestModel.extend({
internalLinks() {
if (Ember.isEmpty(this.link_counts)) return null;
- return this.link_counts
- .filterBy("internal")
- .filterBy("title");
+ return this.link_counts.filterBy("internal").filterBy("title");
},
@computed("actions_summary.@each.can_act")
diff --git a/app/assets/javascripts/discourse/models/topic.js.es6 b/app/assets/javascripts/discourse/models/topic.js.es6
index 7f4f97c9477..a86a33303f1 100644
--- a/app/assets/javascripts/discourse/models/topic.js.es6
+++ b/app/assets/javascripts/discourse/models/topic.js.es6
@@ -69,11 +69,7 @@ const Topic = RestModel.extend({
const maxUserCount = 5;
const posterCount = users.length;
- if (
- this.isPrivateMessage &&
- participants &&
- posterCount < maxUserCount
- ) {
+ if (this.isPrivateMessage && participants && posterCount < maxUserCount) {
let pushOffset = 0;
if (posterCount > 1) {
const lastUser = users[posterCount - 1];
diff --git a/app/assets/javascripts/discourse/models/user-action.js.es6 b/app/assets/javascripts/discourse/models/user-action.js.es6
index e51d7c96d29..50600bc7fb6 100644
--- a/app/assets/javascripts/discourse/models/user-action.js.es6
+++ b/app/assets/javascripts/discourse/models/user-action.js.es6
@@ -50,13 +50,9 @@ const UserAction = RestModel.extend({
if (this.postReplyType) {
if (this.reply_to_post_number) {
- return this.sameUser
- ? "you_replied_to_post"
- : "user_replied_to_post";
+ return this.sameUser ? "you_replied_to_post" : "user_replied_to_post";
} else {
- return this.sameUser
- ? "you_replied_to_topic"
- : "user_replied_to_topic";
+ return this.sameUser ? "you_replied_to_topic" : "user_replied_to_topic";
}
}
@@ -64,9 +60,7 @@ const UserAction = RestModel.extend({
if (this.sameUser) {
return "you_mentioned_user";
} else {
- return this.targetUser
- ? "user_mentioned_you"
- : "user_mentioned_user";
+ return this.targetUser ? "user_mentioned_you" : "user_mentioned_user";
}
}
},
@@ -102,20 +96,12 @@ const UserAction = RestModel.extend({
@computed()
postUrl() {
- return postUrl(
- this.slug,
- this.topic_id,
- this.post_number
- );
+ return postUrl(this.slug, this.topic_id, this.post_number);
},
@computed()
replyUrl() {
- return postUrl(
- this.slug,
- this.topic_id,
- this.reply_to_post_number
- );
+ return postUrl(this.slug, this.topic_id, this.reply_to_post_number);
},
replyType: Ember.computed.equal("action_type", UserActionTypes.replies),
diff --git a/app/assets/javascripts/discourse/models/user-draft.js.es6 b/app/assets/javascripts/discourse/models/user-draft.js.es6
index df931235fa3..2ab353e92cd 100644
--- a/app/assets/javascripts/discourse/models/user-draft.js.es6
+++ b/app/assets/javascripts/discourse/models/user-draft.js.es6
@@ -24,11 +24,7 @@ export default RestModel.extend({
postUrl(topicId) {
if (!topicId) return;
- return postUrl(
- this.slug,
- this.topic_id,
- this.post_number
- );
+ return postUrl(this.slug, this.topic_id, this.post_number);
},
@computed("draft_key")
diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6
index 788b58268a0..90b47dc083f 100644
--- a/app/assets/javascripts/discourse/models/user.js.es6
+++ b/app/assets/javascripts/discourse/models/user.js.es6
@@ -218,13 +218,10 @@ const User = RestModel.extend({
silencedTillDate: longDate,
changeUsername(new_username) {
- return ajax(
- userPath(`${this.username_lower}/preferences/username`),
- {
- type: "PUT",
- data: { new_username }
- }
- );
+ return ajax(userPath(`${this.username_lower}/preferences/username`), {
+ type: "PUT",
+ data: { new_username }
+ });
},
changeEmail(email) {
@@ -390,13 +387,10 @@ const User = RestModel.extend({
},
revokeAssociatedAccount(providerName) {
- return ajax(
- userPath(`${this.username}/preferences/revoke-account`),
- {
- data: { provider_name: providerName },
- type: "POST"
- }
- );
+ return ajax(userPath(`${this.username}/preferences/revoke-account`), {
+ data: { provider_name: providerName },
+ type: "POST"
+ });
},
loadUserAction(id) {
@@ -528,17 +522,17 @@ const User = RestModel.extend({
},
pickAvatar(upload_id, type) {
- return ajax(
- userPath(`${this.username_lower}/preferences/avatar/pick`),
- { type: "PUT", data: { upload_id, type } }
- );
+ return ajax(userPath(`${this.username_lower}/preferences/avatar/pick`), {
+ type: "PUT",
+ data: { upload_id, type }
+ });
},
selectAvatar(avatarUrl) {
- return ajax(
- userPath(`${this.username_lower}/preferences/avatar/select`),
- { type: "PUT", data: { url: avatarUrl } }
- );
+ return ajax(userPath(`${this.username_lower}/preferences/avatar/select`), {
+ type: "PUT",
+ data: { url: avatarUrl }
+ });
},
isAllowedToUploadAFile(type) {
@@ -657,49 +651,47 @@ const User = RestModel.extend({
// let { store } = this; would fail in tests
const store = Discourse.__container__.lookup("service:store");
- return ajax(userPath(`${this.username_lower}/summary.json`)).then(
- json => {
- const summary = json.user_summary;
- const topicMap = {};
- const badgeMap = {};
+ return ajax(userPath(`${this.username_lower}/summary.json`)).then(json => {
+ const summary = json.user_summary;
+ const topicMap = {};
+ const badgeMap = {};
- json.topics.forEach(
- t => (topicMap[t.id] = store.createRecord("topic", t))
- );
- Badge.createFromJson(json).forEach(b => (badgeMap[b.id] = b));
+ json.topics.forEach(
+ t => (topicMap[t.id] = store.createRecord("topic", t))
+ );
+ Badge.createFromJson(json).forEach(b => (badgeMap[b.id] = b));
- summary.topics = summary.topic_ids.map(id => topicMap[id]);
+ summary.topics = summary.topic_ids.map(id => topicMap[id]);
- summary.replies.forEach(r => {
- r.topic = topicMap[r.topic_id];
- r.url = r.topic.urlForPostNumber(r.post_number);
- r.createdAt = new Date(r.created_at);
+ summary.replies.forEach(r => {
+ r.topic = topicMap[r.topic_id];
+ r.url = r.topic.urlForPostNumber(r.post_number);
+ r.createdAt = new Date(r.created_at);
+ });
+
+ summary.links.forEach(l => {
+ l.topic = topicMap[l.topic_id];
+ l.post_url = l.topic.urlForPostNumber(l.post_number);
+ });
+
+ if (summary.badges) {
+ summary.badges = summary.badges.map(ub => {
+ const badge = badgeMap[ub.badge_id];
+ badge.count = ub.count;
+ return badge;
});
-
- summary.links.forEach(l => {
- l.topic = topicMap[l.topic_id];
- l.post_url = l.topic.urlForPostNumber(l.post_number);
- });
-
- if (summary.badges) {
- summary.badges = summary.badges.map(ub => {
- const badge = badgeMap[ub.badge_id];
- badge.count = ub.count;
- return badge;
- });
- }
-
- if (summary.top_categories) {
- summary.top_categories.forEach(c => {
- if (c.parent_category_id) {
- c.parentCategory = Category.findById(c.parent_category_id);
- }
- });
- }
-
- return summary;
}
- );
+
+ if (summary.top_categories) {
+ summary.top_categories.forEach(c => {
+ if (c.parent_category_id) {
+ c.parentCategory = Category.findById(c.parent_category_id);
+ }
+ });
+ }
+
+ return summary;
+ });
},
canManageGroup(group) {
diff --git a/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6
index 5b3dc51e1d6..8d9d1e81449 100644
--- a/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6
+++ b/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6
@@ -12,8 +12,7 @@ export default Discourse.Route.extend(ViewingActionType, {
afterModel(model, transition) {
return model.filterBy({
filter: this.userActionType,
- noContentHelpKey:
- this.noContentHelpKey || "user_activity.no_default",
+ noContentHelpKey: this.noContentHelpKey || "user_activity.no_default",
actingUsername: transition.to.queryParams.acting_username
});
},
diff --git a/app/assets/javascripts/select-kit/components/category-selector.js.es6 b/app/assets/javascripts/select-kit/components/category-selector.js.es6
index 81d11929c18..c9f1f974fa9 100644
--- a/app/assets/javascripts/select-kit/components/category-selector.js.es6
+++ b/app/assets/javascripts/select-kit/components/category-selector.js.es6
@@ -46,8 +46,7 @@ export default MultiSelectComponent.extend({
const blacklist = Ember.makeArray(this.blacklist);
return Category.list().filter(category => {
return (
- this.categories.includes(category) ||
- !blacklist.includes(category)
+ this.categories.includes(category) || !blacklist.includes(category)
);
});
}
diff --git a/app/assets/javascripts/select-kit/components/list-setting.js.es6 b/app/assets/javascripts/select-kit/components/list-setting.js.es6
index e150b55c49a..66b252bc488 100644
--- a/app/assets/javascripts/select-kit/components/list-setting.js.es6
+++ b/app/assets/javascripts/select-kit/components/list-setting.js.es6
@@ -39,9 +39,7 @@ export default MultiSelectComponent.extend({
},
computeValues() {
- return this.settingValue
- .split(this.tokenSeparator)
- .filter(c => c);
+ return this.settingValue.split(this.tokenSeparator).filter(c => c);
},
_handleTabOnKeyDown(event) {
diff --git a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6
index a5639af9144..2df02b143dc 100644
--- a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6
+++ b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6
@@ -154,8 +154,7 @@ export default ComboBox.extend(TagsMixin, {
}
if (!this.hasReachedMinimum && isEmpty(this.selection)) {
- const key =
- this.minimumLabel || "select_kit.min_content_not_reached";
+ const key = this.minimumLabel || "select_kit.min_content_not_reached";
const label = I18n.t(key, { count: this.minimum });
content.title = content.name = content.label = label;
}
diff --git a/app/assets/javascripts/select-kit/components/multi-select.js.es6 b/app/assets/javascripts/select-kit/components/multi-select.js.es6
index 8b72423ffb2..4d0571429a0 100644
--- a/app/assets/javascripts/select-kit/components/multi-select.js.es6
+++ b/app/assets/javascripts/select-kit/components/multi-select.js.es6
@@ -168,14 +168,11 @@ export default SelectKitComponent.extend({
if (this.noneLabel) {
if (!this.hasSelection) {
- content.title = content.name = content.label = I18n.t(
- this.noneLabel
- );
+ content.title = content.name = content.label = I18n.t(this.noneLabel);
}
} else {
if (!this.hasReachedMinimum) {
- const key =
- this.minimumLabel || "select_kit.min_content_not_reached";
+ const key = this.minimumLabel || "select_kit.min_content_not_reached";
content.title = content.name = content.label = I18n.t(key, {
count: this.minimum
});
@@ -243,10 +240,7 @@ export default SelectKitComponent.extend({
if (isEmpty(this.collectionComputedContent)) {
if (this.createRowComputedContent) {
this.highlight(this.createRowComputedContent);
- } else if (
- this.noneRowComputedContent &&
- this.hasSelection
- ) {
+ } else if (this.noneRowComputedContent && this.hasSelection) {
this.highlight(this.noneRowComputedContent);
}
} else {
@@ -260,10 +254,7 @@ export default SelectKitComponent.extend({
!computedContentItem ||
computedContentItem.__sk_row_type === "noneRow"
) {
- applyOnSelectNonePluginApiCallbacks(
- this.pluginApiIdentifiers,
- this
- );
+ applyOnSelectNonePluginApiCallbacks(this.pluginApiIdentifiers, this);
this._boundaryActionHandler("onSelectNone");
this.clearSelection();
return;
diff --git a/app/assets/javascripts/select-kit/components/single-select.js.es6 b/app/assets/javascripts/select-kit/components/single-select.js.es6
index 0e659e45451..5b4f6cd8777 100644
--- a/app/assets/javascripts/select-kit/components/single-select.js.es6
+++ b/app/assets/javascripts/select-kit/components/single-select.js.es6
@@ -157,9 +157,7 @@ export default SelectKitComponent.extend({
@computed("selection")
hasSelection(selection) {
- return (
- selection !== this.noneRowComputedContent && !isNone(selection)
- );
+ return selection !== this.noneRowComputedContent && !isNone(selection);
},
@computed(
@@ -180,19 +178,12 @@ export default SelectKitComponent.extend({
return;
}
- if (
- !isEmpty(this.filter) &&
- !isEmpty(this.collectionComputedContent)
- ) {
+ if (!isEmpty(this.filter) && !isEmpty(this.collectionComputedContent)) {
this.highlight(this.get("collectionComputedContent.firstObject"));
return;
}
- if (
- !this.isAsync &&
- this.hasSelection &&
- isEmpty(this.filter)
- ) {
+ if (!this.isAsync && this.hasSelection && isEmpty(this.filter)) {
this.highlight(get(makeArray(this.selection), "firstObject"));
return;
}
@@ -235,10 +226,7 @@ export default SelectKitComponent.extend({
!computedContentItem ||
computedContentItem.__sk_row_type === "noneRow"
) {
- applyOnSelectNonePluginApiCallbacks(
- this.pluginApiIdentifiers,
- this
- );
+ applyOnSelectNonePluginApiCallbacks(this.pluginApiIdentifiers, this);
this._boundaryActionHandler("onSelectNone");
this._boundaryActionHandler("onSelectAny", computedContentItem);
this.clearSelection();
diff --git a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6
index e55773850f0..e03450bab2b 100644
--- a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6
+++ b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6
@@ -105,9 +105,10 @@ export default MultiSelectComponent.extend(TagsMixin, {
};
if (selectedTags.length || this.blacklist.length) {
- data.selected_tags = _.uniq(
- selectedTags.concat(this.blacklist)
- ).slice(0, 100);
+ data.selected_tags = _.uniq(selectedTags.concat(this.blacklist)).slice(
+ 0,
+ 100
+ );
}
if (!this.everyTag) data.filterForInput = true;
diff --git a/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6 b/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6
index a0faea34e4c..20fb744c43a 100644
--- a/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6
+++ b/app/assets/javascripts/select-kit/mixins/dom-helpers.js.es6
@@ -180,10 +180,7 @@ export default Ember.Mixin.create({
const offsetBottom = this.element.getBoundingClientRect().bottom;
const windowWidth = $(window).width();
- if (
- this.fullWidthOnMobile &&
- (this.site && this.site.isMobileDevice)
- ) {
+ if (this.fullWidthOnMobile && (this.site && this.site.isMobileDevice)) {
const margin = 10;
const relativeLeft = this.$().offset().left - $(window).scrollLeft();
options.left = margin - relativeLeft;
@@ -218,8 +215,7 @@ export default Ember.Mixin.create({
if (this._isRTL()) {
options.right = this.horizontalOffset;
} else {
- options.left =
- -bodyWidth + elementWidth - this.horizontalOffset;
+ options.left = -bodyWidth + elementWidth - this.horizontalOffset;
}
} else {
this.$()
@@ -227,16 +223,14 @@ export default Ember.Mixin.create({
.removeClass("is-left-aligned");
if (this._isRTL()) {
- options.right =
- -bodyWidth + elementWidth - this.horizontalOffset;
+ options.right = -bodyWidth + elementWidth - this.horizontalOffset;
} else {
options.left = this.horizontalOffset;
}
}
}
- const fullHeight =
- this.verticalOffset + bodyHeight + componentHeight;
+ const fullHeight = this.verticalOffset + bodyHeight + componentHeight;
const hasBelowSpace = $(window).height() - offsetBottom - fullHeight >= -1;
const hasAboveSpace = offsetTop - fullHeight - discourseHeaderHeight >= -1;
const headerHeight = this._computedStyle(this.$header()[0], "height");
diff --git a/app/assets/javascripts/select-kit/mixins/utils.js.es6 b/app/assets/javascripts/select-kit/mixins/utils.js.es6
index 88fa9838f5d..3bbf7e8d8e5 100644
--- a/app/assets/javascripts/select-kit/mixins/utils.js.es6
+++ b/app/assets/javascripts/select-kit/mixins/utils.js.es6
@@ -55,11 +55,7 @@ export default Ember.Mixin.create({
},
_castInteger(value) {
- if (
- this.castInteger &&
- Ember.isPresent(value) &&
- this._isNumeric(value)
- ) {
+ if (this.castInteger && Ember.isPresent(value) && this._isNumeric(value)) {
return parseInt(value, 10);
}
diff --git a/app/assets/javascripts/wizard/lib/preview.js.es6 b/app/assets/javascripts/wizard/lib/preview.js.es6
index abf735ebde7..9a6dc99f37c 100644
--- a/app/assets/javascripts/wizard/lib/preview.js.es6
+++ b/app/assets/javascripts/wizard/lib/preview.js.es6
@@ -79,9 +79,7 @@ export function createPreviewComponent(width, height, obj) {
return false;
}
- const colors = this.wizard.getCurrentColors(
- this.colorsId
- );
+ const colors = this.wizard.getCurrentColors(this.colorsId);
if (!colors) {
return;
}
diff --git a/test/javascripts/components/category-chooser-test.js.es6 b/test/javascripts/components/category-chooser-test.js.es6
index 91218515792..c93a14e5847 100644
--- a/test/javascripts/components/category-chooser-test.js.es6
+++ b/test/javascripts/components/category-chooser-test.js.es6
@@ -11,18 +11,8 @@ componentTest("with value", {
template: "{{category-chooser value=2}}",
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- 2
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "feature"
- );
+ assert.equal(this.subject.header().value(), 2);
+ assert.equal(this.subject.header().title(), "feature");
}
});
@@ -32,11 +22,7 @@ componentTest("with excludeCategoryId", {
async test(assert) {
await this.subject.expand();
- assert.notOk(
- this.subject
- .rowByValue(2)
- .exists()
- );
+ assert.notOk(this.subject.rowByValue(2).exists());
}
});
@@ -47,29 +33,15 @@ componentTest("with scopedCategoryId", {
await this.subject.expand();
assert.equal(
- this.subject
- .rowByIndex(0)
- .title(),
+ this.subject.rowByIndex(0).title(),
"Discussion about features or potential features of Discourse: how they work, why they work, etc."
);
+ assert.equal(this.subject.rowByIndex(0).value(), 2);
assert.equal(
- this.subject
- .rowByIndex(0)
- .value(),
- 2
- );
- assert.equal(
- this.subject
- .rowByIndex(1)
- .title(),
+ this.subject.rowByIndex(1).title(),
"My idea here is to have mini specs for features we would like built but have no bandwidth to build"
);
- assert.equal(
- this.subject
- .rowByIndex(1)
- .value(),
- 26
- );
+ assert.equal(this.subject.rowByIndex(1).value(), 26);
assert.equal(this.subject.rows().length, 2);
await this.subject.fillInFilter("dev");
@@ -86,18 +58,8 @@ componentTest("with allowUncategorized=null", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "category"
- );
+ assert.equal(this.subject.header().value(), null);
+ assert.equal(this.subject.header().title(), "category");
}
});
@@ -109,18 +71,8 @@ componentTest("with allowUncategorized=null rootNone=true", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "category"
- );
+ assert.equal(this.subject.header().value(), null);
+ assert.equal(this.subject.header().title(), "category");
}
});
@@ -134,18 +86,8 @@ componentTest("with disallowed uncategorized, rootNone and rootNoneLabel", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "category"
- );
+ assert.equal(this.subject.header().value(), null);
+ assert.equal(this.subject.header().title(), "category");
}
});
@@ -157,18 +99,8 @@ componentTest("with allowed uncategorized", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "uncategorized"
- );
+ assert.equal(this.subject.header().value(), null);
+ assert.equal(this.subject.header().title(), "uncategorized");
}
});
@@ -180,18 +112,8 @@ componentTest("with allowed uncategorized and rootNone", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "(no category)"
- );
+ assert.equal(this.subject.header().value(), null);
+ assert.equal(this.subject.header().title(), "(no category)");
}
});
@@ -205,17 +127,7 @@ componentTest("with allowed uncategorized rootNone and rootNoneLabel", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
- assert.equal(
- this.subject
- .header()
- .title(),
- "root none label"
- );
+ assert.equal(this.subject.header().value(), null);
+ assert.equal(this.subject.header().title(), "root none label");
}
});
diff --git a/test/javascripts/components/category-drop-test.js.es6 b/test/javascripts/components/category-drop-test.js.es6
index 835063092b4..f4569c4d98e 100644
--- a/test/javascripts/components/category-drop-test.js.es6
+++ b/test/javascripts/components/category-drop-test.js.es6
@@ -25,25 +25,19 @@ componentTest("subcatgories - no selection", {
async test(assert) {
assert.equal(
- this.subject
- .header()
- .title(),
+ this.subject.header().title(),
I18n.t("categories.all_subcategories")
);
await this.subject.expand();
assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
+ this.subject.rowByIndex(0).name(),
I18n.t("categories.no_subcategory")
);
assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
+ this.subject.rowByIndex(1).name(),
this.get("childCategories.firstObject.name")
);
}
@@ -67,25 +61,19 @@ componentTest("subcatgories - selection", {
async test(assert) {
assert.equal(
- this.subject
- .header()
- .title(),
+ this.subject.header().title(),
this.get("childCategories.firstObject.name")
);
await this.subject.expand();
assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
+ this.subject.rowByIndex(0).name(),
I18n.t("categories.all_subcategories")
);
assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
+ this.subject.rowByIndex(1).name(),
I18n.t("categories.no_subcategory")
);
}
diff --git a/test/javascripts/components/category-selector-test.js.es6 b/test/javascripts/components/category-selector-test.js.es6
index 603af37de39..c6f82fa1fae 100644
--- a/test/javascripts/components/category-selector-test.js.es6
+++ b/test/javascripts/components/category-selector-test.js.es6
@@ -16,16 +16,9 @@ componentTest("default", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- 2
- );
+ assert.equal(this.subject.header().value(), 2);
assert.notOk(
- this.subject
- .rowByValue(2)
- .exists(),
+ this.subject.rowByValue(2).exists(),
"selected categories are not in the list"
);
}
@@ -43,15 +36,11 @@ componentTest("with blacklist", {
await this.subject.expand();
assert.ok(
- this.subject
- .rowByValue(6)
- .exists(),
+ this.subject.rowByValue(6).exists(),
"not blacklisted categories are in the list"
);
assert.notOk(
- this.subject
- .rowByValue(8)
- .exists(),
+ this.subject.rowByValue(8).exists(),
"blacklisted categories are not in the list"
);
}
@@ -70,9 +59,7 @@ componentTest("interactions", {
await this.subject.selectRowByValue(8);
assert.equal(
- this.subject
- .header()
- .value(),
+ this.subject.header().value(),
"2,6,8",
"it adds the selected category"
);
@@ -84,9 +71,7 @@ componentTest("interactions", {
await this.subject.keyboard("backspace");
assert.equal(
- this.subject
- .header()
- .value(),
+ this.subject.header().value(),
"2,6",
"it removes the last selected category"
);
diff --git a/test/javascripts/components/combo-box-test.js.es6 b/test/javascripts/components/combo-box-test.js.es6
index 589e742f7d8..274202fa241 100644
--- a/test/javascripts/components/combo-box-test.js.es6
+++ b/test/javascripts/components/combo-box-test.js.es6
@@ -15,24 +15,9 @@ componentTest("default", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .name(),
- "hello"
- );
- assert.equal(
- this.subject
- .rowByValue(1)
- .name(),
- "hello"
- );
- assert.equal(
- this.subject
- .rowByValue(2)
- .name(),
- "world"
- );
+ assert.equal(this.subject.header().name(), "hello");
+ assert.equal(this.subject.rowByValue(1).name(), "hello");
+ assert.equal(this.subject.rowByValue(2).name(), "world");
}
});
@@ -48,18 +33,8 @@ componentTest("with valueAttribute", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .rowByValue(0)
- .name(),
- "hello"
- );
- assert.equal(
- this.subject
- .rowByValue(1)
- .name(),
- "world"
- );
+ assert.equal(this.subject.rowByValue(0).name(), "hello");
+ assert.equal(this.subject.rowByValue(1).name(), "world");
}
});
@@ -72,18 +47,8 @@ componentTest("with nameProperty", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .rowByValue(0)
- .name(),
- "hello"
- );
- assert.equal(
- this.subject
- .rowByValue(1)
- .name(),
- "world"
- );
+ assert.equal(this.subject.rowByValue(0).name(), "hello");
+ assert.equal(this.subject.rowByValue(1).name(), "world");
}
});
@@ -96,18 +61,8 @@ componentTest("with an array as content", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .rowByValue("evil")
- .name(),
- "evil"
- );
- assert.equal(
- this.subject
- .rowByValue("trout")
- .name(),
- "trout"
- );
+ assert.equal(this.subject.rowByValue("evil").name(), "evil");
+ assert.equal(this.subject.rowByValue("trout").name(), "trout");
}
});
@@ -122,30 +77,10 @@ componentTest("with value and none as a string", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .noneRow()
- .name(),
- "none"
- );
- assert.equal(
- this.subject
- .rowByValue("evil")
- .name(),
- "evil"
- );
- assert.equal(
- this.subject
- .rowByValue("trout")
- .name(),
- "trout"
- );
- assert.equal(
- this.subject
- .header()
- .name(),
- "trout"
- );
+ assert.equal(this.subject.noneRow().name(), "none");
+ assert.equal(this.subject.rowByValue("evil").name(), "evil");
+ assert.equal(this.subject.rowByValue("trout").name(), "trout");
+ assert.equal(this.subject.header().name(), "trout");
assert.equal(this.value, "trout");
await this.subject.selectNoneRow();
@@ -165,30 +100,10 @@ componentTest("with value and none as an object", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .noneRow()
- .name(),
- "none"
- );
- assert.equal(
- this.subject
- .rowByValue("evil")
- .name(),
- "evil"
- );
- assert.equal(
- this.subject
- .rowByValue("trout")
- .name(),
- "trout"
- );
- assert.equal(
- this.subject
- .header()
- .name(),
- "evil"
- );
+ assert.equal(this.subject.noneRow().name(), "none");
+ assert.equal(this.subject.rowByValue("evil").name(), "evil");
+ assert.equal(this.subject.rowByValue("trout").name(), "trout");
+ assert.equal(this.subject.header().name(), "evil");
assert.equal(this.value, "evil");
await this.subject.selectNoneRow();
@@ -209,12 +124,7 @@ componentTest("with no value and none as an object", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .name(),
- "none"
- );
+ assert.equal(this.subject.header().name(), "none");
}
});
@@ -230,12 +140,7 @@ componentTest("with no value and none string", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .name(),
- "none"
- );
+ assert.equal(this.subject.header().name(), "none");
}
});
@@ -250,9 +155,7 @@ componentTest("with no value and no none", {
await this.subject.expand();
assert.equal(
- this.subject
- .header()
- .name(),
+ this.subject.header().name(),
"evil",
"it sets the first row as value"
);
@@ -270,9 +173,7 @@ componentTest("with empty string as value", {
await this.subject.expand();
assert.equal(
- this.subject
- .header()
- .name(),
+ this.subject.header().name(),
"evil",
"it sets the first row as value"
);
@@ -292,9 +193,7 @@ componentTest("with noneLabel", {
await this.subject.expand();
assert.equal(
- this.subject
- .header()
- .name(),
+ this.subject.header().name(),
"none",
"it displays noneLabel as the header name"
);
diff --git a/test/javascripts/components/d-editor-test.js.es6 b/test/javascripts/components/d-editor-test.js.es6
index 49c3d00ef90..cd43f18c1d7 100644
--- a/test/javascripts/components/d-editor-test.js.es6
+++ b/test/javascripts/components/d-editor-test.js.es6
@@ -248,10 +248,7 @@ testCase("link modal (link with description)", async function(assert) {
await fillIn(".insert-link input.link-text", "evil trout");
await click(".insert-link button.btn-primary");
assert.equal(find(".insert-link.hidden").length, 1);
- assert.equal(
- this.value,
- "hello world.[evil trout](http://eviltrout.com)"
- );
+ assert.equal(this.value, "hello world.[evil trout](http://eviltrout.com)");
});
componentTest("advanced code", {
@@ -347,10 +344,7 @@ third line`
textarea.selectionEnd = 10;
await click("button.code");
- assert.equal(
- this.value,
- "first `line`\n\nsecond line\n\nthird line"
- );
+ assert.equal(this.value, "first `line`\n\nsecond line\n\nthird line");
assert.equal(textarea.selectionStart, 7);
assert.equal(textarea.selectionEnd, 11);
@@ -363,10 +357,7 @@ third line`
textarea.selectionEnd = 23;
await click("button.code");
- assert.equal(
- this.value,
- " first line\n\n second line\n\nthird line"
- );
+ assert.equal(this.value, " first line\n\n second line\n\nthird line");
assert.equal(textarea.selectionStart, 0);
assert.equal(textarea.selectionEnd, 31);
diff --git a/test/javascripts/components/mini-tag-chooser-test.js.es6 b/test/javascripts/components/mini-tag-chooser-test.js.es6
index 765eec965c6..8ff526f46f6 100644
--- a/test/javascripts/components/mini-tag-chooser-test.js.es6
+++ b/test/javascripts/components/mini-tag-chooser-test.js.es6
@@ -43,17 +43,13 @@ componentTest("default", {
await this.subject.expand();
assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
+ this.subject.rowByIndex(0).name(),
"bianca",
"it has the correct tag"
);
assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
+ this.subject.rowByIndex(1).name(),
"régis",
"it has the correct tag"
);
diff --git a/test/javascripts/components/multi-select-test.js.es6 b/test/javascripts/components/multi-select-test.js.es6
index 3935e0aa173..fbb3022fc74 100644
--- a/test/javascripts/components/multi-select-test.js.es6
+++ b/test/javascripts/components/multi-select-test.js.es6
@@ -18,12 +18,7 @@ componentTest("with objects and values", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .value(),
- "1,2"
- );
+ assert.equal(this.subject.header().value(), "1,2");
}
});
@@ -61,24 +56,16 @@ componentTest("interactions", {
await this.subject.expand();
assert.equal(
- this.subject
- .highlightedRow()
- .name(),
+ this.subject.highlightedRow().name(),
"robin",
"it highlights the first content row"
);
await this.set("none", "test.none");
- assert.ok(
- this.subject
- .noneRow()
- .exists()
- );
+ assert.ok(this.subject.noneRow().exists());
assert.equal(
- this.subject
- .highlightedRow()
- .name(),
+ this.subject.highlightedRow().name(),
"robin",
"it highlights the first content row"
);
@@ -87,9 +74,7 @@ componentTest("interactions", {
await this.subject.expand();
assert.equal(
- this.subject
- .highlightedRow()
- .name(),
+ this.subject.highlightedRow().name(),
"none",
"it highlights none row if no content"
);
@@ -97,9 +82,7 @@ componentTest("interactions", {
await this.subject.fillInFilter("joffrey");
assert.equal(
- this.subject
- .highlightedRow()
- .name(),
+ this.subject.highlightedRow().name(),
"joffrey",
"it highlights create row when filling filter"
);
@@ -107,9 +90,7 @@ componentTest("interactions", {
await this.subject.keyboard("enter");
assert.equal(
- this.subject
- .highlightedRow()
- .name(),
+ this.subject.highlightedRow().name(),
"none",
"it highlights none row after creating content and no content left"
);
@@ -140,9 +121,7 @@ componentTest("interactions", {
"it removes the previous highlighted selected content"
);
assert.notOk(
- this.subject
- .rowByValue("joffrey")
- .exists(),
+ this.subject.rowByValue("joffrey").exists(),
"generated content shouldn’t appear in content when removed"
);
@@ -191,12 +170,7 @@ componentTest("with limitMatches", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .el()
- .find(".select-kit-row").length,
- 2
- );
+ assert.equal(this.subject.el().find(".select-kit-row").length, 2);
}
});
@@ -210,19 +184,11 @@ componentTest("with minimum", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject.validationMessage(),
- "Select at least 1 item."
- );
+ assert.equal(this.subject.validationMessage(), "Select at least 1 item.");
await this.subject.selectRowByValue("sam");
- assert.equal(
- this.subject
- .header()
- .label(),
- "sam"
- );
+ assert.equal(this.subject.header().label(), "sam");
}
});
@@ -242,12 +208,7 @@ componentTest("with minimumLabel", {
await this.subject.selectRowByValue("jeff");
- assert.equal(
- this.subject
- .header()
- .label(),
- "jeff"
- );
+ assert.equal(this.subject.header().label(), "jeff");
}
});
diff --git a/test/javascripts/components/pinned-options-test.js.es6 b/test/javascripts/components/pinned-options-test.js.es6
index ae6877a6906..a7fe2c50fb7 100644
--- a/test/javascripts/components/pinned-options-test.js.es6
+++ b/test/javascripts/components/pinned-options-test.js.es6
@@ -27,20 +27,10 @@ componentTest("updating the content refreshes the list", {
},
async test(assert) {
- assert.equal(
- this.subject
- .header()
- .name(),
- "pinned"
- );
+ assert.equal(this.subject.header().name(), "pinned");
await this.set("pinned", false);
- assert.equal(
- this.subject
- .header()
- .name(),
- "unpinned"
- );
+ assert.equal(this.subject.header().name(), "unpinned");
}
});
diff --git a/test/javascripts/components/single-select-test.js.es6 b/test/javascripts/components/single-select-test.js.es6
index 6c403a0b4c3..c92cd9dc094 100644
--- a/test/javascripts/components/single-select-test.js.es6
+++ b/test/javascripts/components/single-select-test.js.es6
@@ -19,21 +19,11 @@ componentTest("updating the content refreshes the list", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .rowByValue(1)
- .name(),
- "BEFORE"
- );
+ assert.equal(this.subject.rowByValue(1).name(), "BEFORE");
await this.set("content", [{ id: 1, name: "AFTER" }]);
- assert.equal(
- this.subject
- .rowByValue(1)
- .name(),
- "AFTER"
- );
+ assert.equal(this.subject.rowByValue(1).name(), "AFTER");
}
});
@@ -49,9 +39,7 @@ componentTest("accepts a value by reference", {
await this.subject.expand();
assert.equal(
- this.subject
- .selectedRow()
- .name(),
+ this.subject.selectedRow().name(),
"robin",
"it highlights the row corresponding to the value"
);
@@ -67,9 +55,7 @@ componentTest("no default icon", {
test(assert) {
assert.equal(
- this.subject
- .header()
- .icon().length,
+ this.subject.header().icon().length,
0,
"it doesn’t have an icon if not specified"
);
@@ -82,14 +68,7 @@ componentTest("default search icon", {
async test(assert) {
await this.subject.expand();
- assert.ok(
- exists(
- this.subject
- .filter()
- .icon()
- ),
- "it has an icon"
- );
+ assert.ok(exists(this.subject.filter().icon()), "it has an icon");
}
});
@@ -99,14 +78,7 @@ componentTest("with no search icon", {
async test(assert) {
await this.subject.expand();
- assert.notOk(
- exists(
- this.subject
- .filter()
- .icon()
- ),
- "it has no icon"
- );
+ assert.notOk(exists(this.subject.filter().icon()), "it has no icon");
}
});
@@ -151,12 +123,7 @@ componentTest("accepts custom value/name keys", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .selectedRow()
- .name(),
- "robin"
- );
+ assert.equal(this.subject.selectedRow().name(), "robin");
}
});
@@ -186,19 +153,12 @@ componentTest("dynamic headerText", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .name(),
- "robin"
- );
+ assert.equal(this.subject.header().name(), "robin");
await this.subject.selectRowByValue(2);
assert.equal(
- this.subject
- .header()
- .name(),
+ this.subject.header().name(),
"regis",
"it changes header text"
);
@@ -243,19 +203,12 @@ componentTest("supports converting select value to integer", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .selectedRow()
- .name(),
- "régis"
- );
+ assert.equal(this.subject.selectedRow().name(), "régis");
await this.set("value", 1);
assert.equal(
- this.subject
- .selectedRow()
- .name(),
+ this.subject.selectedRow().name(),
"robin",
"it works with dynamic content"
);
@@ -276,19 +229,12 @@ componentTest("supports converting string as boolean to boolean", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .selectedRow()
- .name(),
- "ASC"
- );
+ assert.equal(this.subject.selectedRow().name(), "ASC");
await this.set("value", false);
assert.equal(
- this.subject
- .selectedRow()
- .name(),
+ this.subject.selectedRow().name(),
"DESC",
"it works with dynamic content"
);
@@ -308,9 +254,7 @@ componentTest("supports keyboard events", {
await this.subject.keyboard("down");
assert.equal(
- this.subject
- .highlightedRow()
- .title(),
+ this.subject.highlightedRow().title(),
"regis",
"the next row is highlighted"
);
@@ -318,9 +262,7 @@ componentTest("supports keyboard events", {
await this.subject.keyboard("down");
assert.equal(
- this.subject
- .highlightedRow()
- .title(),
+ this.subject.highlightedRow().title(),
"robin",
"it returns to the first row"
);
@@ -328,9 +270,7 @@ componentTest("supports keyboard events", {
await this.subject.keyboard("up");
assert.equal(
- this.subject
- .highlightedRow()
- .title(),
+ this.subject.highlightedRow().title(),
"regis",
"it highlights the last row"
);
@@ -338,9 +278,7 @@ componentTest("supports keyboard events", {
await this.subject.keyboard("enter");
assert.equal(
- this.subject
- .selectedRow()
- .title(),
+ this.subject.selectedRow().title(),
"regis",
"it selects the row when pressing enter"
);
@@ -352,10 +290,7 @@ componentTest("supports keyboard events", {
await this.subject.expand();
await this.subject.keyboard("escape");
- assert.notOk(
- this.subject.isExpanded(),
- "it collapses the select box"
- );
+ assert.notOk(this.subject.isExpanded(), "it collapses the select box");
await this.subject.expand();
await this.subject.fillInFilter("regis");
@@ -381,11 +316,7 @@ componentTest("with allowInitialValueMutation", {
},
test(assert) {
- assert.equal(
- this.value,
- "1",
- "it mutates the value on initial rendering"
- );
+ assert.equal(this.value, "1", "it mutates the value on initial rendering");
}
});
@@ -405,12 +336,7 @@ componentTest("support appending content through plugin api", {
await this.subject.expand();
assert.equal(this.subject.rows().length, 2);
- assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
- "regis"
- );
+ assert.equal(this.subject.rowByIndex(1).name(), "regis");
clearCallbacks();
}
@@ -439,12 +365,7 @@ componentTest("support modifying content through plugin api", {
await this.subject.expand();
assert.equal(this.subject.rows().length, 3);
- assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
- "sam"
- );
+ assert.equal(this.subject.rowByIndex(1).name(), "sam");
clearCallbacks();
}
@@ -467,12 +388,7 @@ componentTest("support prepending content through plugin api", {
await this.subject.expand();
assert.equal(this.subject.rows().length, 2);
- assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
- "regis"
- );
+ assert.equal(this.subject.rowByIndex(0).name(), "regis");
clearCallbacks();
}
@@ -551,21 +467,11 @@ componentTest("with nameChanges", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .name(),
- "robin"
- );
+ assert.equal(this.subject.header().name(), "robin");
await this.set("robin.name", "robin2");
- assert.equal(
- this.subject
- .header()
- .name(),
- "robin2"
- );
+ assert.equal(this.subject.header().name(), "robin2");
}
});
@@ -579,18 +485,8 @@ componentTest("with null value", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .name(),
- "robin"
- );
- assert.equal(
- this.subject
- .header()
- .value(),
- undefined
- );
+ assert.equal(this.subject.header().name(), "robin");
+ assert.equal(this.subject.header().value(), undefined);
}
});
@@ -616,12 +512,7 @@ componentTest("with title", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .title(),
- "My title"
- );
+ assert.equal(this.subject.header().title(), "My title");
}
});
@@ -642,12 +533,7 @@ componentTest("support modifying header computed content through plugin api", {
},
test(assert) {
- assert.equal(
- this.subject
- .header()
- .title(),
- "Not so evil"
- );
+ assert.equal(this.subject.header().title(), "Not so evil");
clearCallbacks();
}
@@ -663,12 +549,7 @@ componentTest("with limitMatches", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .el()
- .find(".select-kit-row").length,
- 2
- );
+ assert.equal(this.subject.el().find(".select-kit-row").length, 2);
}
});
@@ -683,19 +564,11 @@ componentTest("with minimum", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject.validationMessage(),
- "Select at least 1 item."
- );
+ assert.equal(this.subject.validationMessage(), "Select at least 1 item.");
await this.subject.selectRowByValue("sam");
- assert.equal(
- this.subject
- .header()
- .label(),
- "sam"
- );
+ assert.equal(this.subject.header().label(), "sam");
}
});
@@ -715,12 +588,7 @@ componentTest("with minimumLabel", {
await this.subject.selectRowByValue("jeff");
- assert.equal(
- this.subject
- .header()
- .label(),
- "jeff"
- );
+ assert.equal(this.subject.header().label(), "jeff");
}
});
@@ -736,12 +604,7 @@ componentTest("with accents in filter", {
await this.subject.fillInFilter("jéff");
assert.equal(this.subject.rows().length, 1);
- assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
- "jeff"
- );
+ assert.equal(this.subject.rowByIndex(0).name(), "jeff");
}
});
@@ -757,12 +620,7 @@ componentTest("with accents in content", {
await this.subject.fillInFilter("jeff");
assert.equal(this.subject.rows().length, 1);
- assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
- "jéff"
- );
+ assert.equal(this.subject.rowByIndex(0).name(), "jéff");
}
});
@@ -771,15 +629,9 @@ componentTest("with no content and allowAny", {
skip: true,
async test(assert) {
- await click(
- this.subject
- .header()
- .el()
- );
+ await click(this.subject.header().el());
- const $filter = this.subject
- .filter()
- .el();
+ const $filter = this.subject.filter().el();
assert.ok($filter.hasClass("is-focused"));
assert.ok(!$filter.hasClass("is-hidden"));
diff --git a/test/javascripts/components/tag-drop-test.js.es6 b/test/javascripts/components/tag-drop-test.js.es6
index e1a5de574d4..7ef094c461e 100644
--- a/test/javascripts/components/tag-drop-test.js.es6
+++ b/test/javascripts/components/tag-drop-test.js.es6
@@ -41,35 +41,27 @@ componentTest("default", {
await this.subject.expand();
assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
+ this.subject.rowByIndex(1).name(),
"jeff",
"it has the correct tag"
);
assert.equal(
- this.subject
- .rowByIndex(2)
- .name(),
+ this.subject.rowByIndex(2).name(),
"neil",
"it has the correct tag"
);
await this.subject.fillInFilter("rég");
assert.equal(
- this.subject
- .rowByIndex(0)
- .name(),
+ this.subject.rowByIndex(0).name(),
"régis",
"it displays the searched tag"
);
await this.subject.fillInFilter("");
assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
+ this.subject.rowByIndex(1).name(),
"jeff",
"it returns top tags for an empty search"
);
@@ -96,9 +88,7 @@ componentTest("no tags", {
await this.subject.expand();
assert.equal(
- this.subject
- .rowByIndex(1)
- .name(),
+ this.subject.rowByIndex(1).name(),
undefined,
"it has no tags and doesn’t crash"
);
diff --git a/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6 b/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6
index 85adcc7186c..adcdc37a801 100644
--- a/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6
+++ b/test/javascripts/components/topic-footer-mobile-dropdown-test.js.es6
@@ -24,22 +24,10 @@ componentTest("default", {
async test(assert) {
await this.subject.expand();
- assert.equal(
- this.subject
- .header()
- .title(),
- "Topic Controls"
- );
- assert.equal(
- this.subject
- .header()
- .value(),
- null
- );
+ assert.equal(this.subject.header().title(), "Topic Controls");
+ assert.equal(this.subject.header().value(), null);
assert.notOk(
- this.subject
- .selectedRow()
- .exists(),
+ this.subject.selectedRow().exists(),
"it doesn’t preselect first row"
);
}