DEV: Extensively use `includes()` (#17541)
Also, the change in insert-hyperlink (from `this.linkUrl.indexOf("http") === -1` to `!this.linkUrl.startsWith("http")`) was intentional fix: we don't want to prevent users from looking up topics with http in their titles.
This commit is contained in:
parent
5f7163b5bb
commit
057d6b406d
|
@ -41,7 +41,7 @@ export default Component.extend({
|
||||||
if (["color_definitions"].includes(fieldName)) {
|
if (["color_definitions"].includes(fieldName)) {
|
||||||
return "scss";
|
return "scss";
|
||||||
}
|
}
|
||||||
return fieldName && fieldName.indexOf("scss") > -1 ? "scss" : "html";
|
return fieldName && fieldName.includes("scss") ? "scss" : "html";
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("currentTargetName", "fieldName")
|
@discourseComputed("currentTargetName", "fieldName")
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Component from "@ember/component";
|
||||||
|
|
||||||
function RGBToHex(rgb) {
|
function RGBToHex(rgb) {
|
||||||
// Choose correct separator
|
// Choose correct separator
|
||||||
let sep = rgb.indexOf(",") > -1 ? "," : " ";
|
let sep = rgb.includes(",") ? "," : " ";
|
||||||
// Turn "rgb(r,g,b)" into [r,g,b]
|
// Turn "rgb(r,g,b)" into [r,g,b]
|
||||||
rgb = rgb.slice(4).split(")")[0].split(sep);
|
rgb = rgb.slice(4).split(")")[0].split(sep);
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default Component.extend({
|
||||||
|
|
||||||
@discourseComputed("choices.[]", "collection.[]")
|
@discourseComputed("choices.[]", "collection.[]")
|
||||||
filteredChoices(choices, collection) {
|
filteredChoices(choices, collection) {
|
||||||
return makeArray(choices).filter((i) => collection.indexOf(i) < 0);
|
return makeArray(choices).filter((i) => !collection.includes(i));
|
||||||
},
|
},
|
||||||
|
|
||||||
keyDown(event) {
|
keyDown(event) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ export default Controller.extend({
|
||||||
if (available) {
|
if (available) {
|
||||||
const themes = !childThemes
|
const themes = !childThemes
|
||||||
? available
|
? available
|
||||||
: available.filter((theme) => childThemes.indexOf(theme) === -1);
|
: available.filter((theme) => !childThemes.includes(theme));
|
||||||
return themes.length === 0 ? null : themes;
|
return themes.length === 0 ? null : themes;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,8 +17,8 @@ export default Controller.extend({
|
||||||
filter = filter.toLowerCase();
|
filter = filter.toLowerCase();
|
||||||
reports = reports.filter((report) => {
|
reports = reports.filter((report) => {
|
||||||
return (
|
return (
|
||||||
(get(report, "title") || "").toLowerCase().indexOf(filter) > -1 ||
|
(get(report, "title") || "").toLowerCase().includes(filter) ||
|
||||||
(get(report, "description") || "").toLowerCase().indexOf(filter) > -1
|
(get(report, "description") || "").toLowerCase().includes(filter)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
this.allWatchedWords.forEach((wordsForAction) => {
|
this.allWatchedWords.forEach((wordsForAction) => {
|
||||||
const wordRecords = wordsForAction.words.filter((wordRecord) => {
|
const wordRecords = wordsForAction.words.filter((wordRecord) => {
|
||||||
return wordRecord.word.indexOf(filter) > -1;
|
return wordRecord.word.includes(filter);
|
||||||
});
|
});
|
||||||
|
|
||||||
model.pushObject(
|
model.pushObject(
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default Controller.extend({
|
||||||
_addIncoming(eventId) {
|
_addIncoming(eventId) {
|
||||||
const incomingEventIds = this.incomingEventIds;
|
const incomingEventIds = this.incomingEventIds;
|
||||||
|
|
||||||
if (incomingEventIds.indexOf(eventId) === -1) {
|
if (!incomingEventIds.includes(eventId)) {
|
||||||
incomingEventIds.pushObject(eventId);
|
incomingEventIds.pushObject(eventId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default Controller.extend({
|
||||||
@discourseComputed("model.secret")
|
@discourseComputed("model.secret")
|
||||||
secretValidation(secret) {
|
secretValidation(secret) {
|
||||||
if (!isEmpty(secret)) {
|
if (!isEmpty(secret)) {
|
||||||
if (secret.indexOf(" ") !== -1) {
|
if (secret.includes(" ")) {
|
||||||
return EmberObject.create({
|
return EmberObject.create({
|
||||||
failed: true,
|
failed: true,
|
||||||
reason: I18n.t("admin.web_hooks.secret_invalid"),
|
reason: I18n.t("admin.web_hooks.secret_invalid"),
|
||||||
|
|
|
@ -86,7 +86,7 @@ export default Mixin.create({
|
||||||
|
|
||||||
@discourseComputed("type")
|
@discourseComputed("type")
|
||||||
componentType(type) {
|
componentType(type) {
|
||||||
return CUSTOM_TYPES.indexOf(type) !== -1 ? type : "string";
|
return CUSTOM_TYPES.includes(type) ? type : "string";
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("setting")
|
@discourseComputed("setting")
|
||||||
|
|
|
@ -103,7 +103,7 @@ export function registerIconRenderer(renderer) {
|
||||||
function iconClasses(icon, params) {
|
function iconClasses(icon, params) {
|
||||||
// "notification." is invalid syntax for classes, use replacement instead
|
// "notification." is invalid syntax for classes, use replacement instead
|
||||||
const dClass =
|
const dClass =
|
||||||
icon.replacementId && icon.id.indexOf("notification.") > -1
|
icon.replacementId && icon.id.includes("notification.")
|
||||||
? icon.replacementId
|
? icon.replacementId
|
||||||
: icon.id;
|
: icon.id;
|
||||||
|
|
||||||
|
|
|
@ -50,11 +50,7 @@ function niceAttr(attr) {
|
||||||
let i;
|
let i;
|
||||||
|
|
||||||
for (i = 0; i < parts.length; i++) {
|
for (i = 0; i < parts.length; i++) {
|
||||||
if (
|
if (parts[i] === "@each" || parts[i] === "[]" || parts[i].includes("{")) {
|
||||||
parts[i] === "@each" ||
|
|
||||||
parts[i] === "[]" ||
|
|
||||||
parts[i].indexOf("{") !== -1
|
|
||||||
) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ export default EmberObject.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
basePath(store, type) {
|
basePath(store, type) {
|
||||||
if (ADMIN_MODELS.indexOf(type.replace("_", "-")) !== -1) {
|
if (ADMIN_MODELS.includes(type.replace("_", "-"))) {
|
||||||
return "/admin/";
|
return "/admin/";
|
||||||
}
|
}
|
||||||
return "/";
|
return "/";
|
||||||
|
|
|
@ -488,7 +488,7 @@ export default Component.extend(ComposerUploadUppy, {
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = mention.dataset.name;
|
let name = mention.dataset.name;
|
||||||
if (found.indexOf(name) === -1) {
|
if (!found.includes(name)) {
|
||||||
this.groupsMentioned([
|
this.groupsMentioned([
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
|
@ -517,7 +517,7 @@ export default Component.extend(ComposerUploadUppy, {
|
||||||
preview?.querySelectorAll(".mention.cannot-see")?.forEach((mention) => {
|
preview?.querySelectorAll(".mention.cannot-see")?.forEach((mention) => {
|
||||||
let name = mention.dataset.name;
|
let name = mention.dataset.name;
|
||||||
|
|
||||||
if (found.indexOf(name) === -1) {
|
if (!found.includes(name)) {
|
||||||
// add a delay to allow for typing, so you don't open the warning right away
|
// add a delay to allow for typing, so you don't open the warning right away
|
||||||
// previously we would warn after @bob even if you were about to mention @bob2
|
// previously we would warn after @bob even if you were about to mention @bob2
|
||||||
discourseLater(
|
discourseLater(
|
||||||
|
|
|
@ -602,7 +602,7 @@ export default Component.extend(TextareaTextManipulation, {
|
||||||
},
|
},
|
||||||
|
|
||||||
_applyList(sel, head, exampleKey, opts) {
|
_applyList(sel, head, exampleKey, opts) {
|
||||||
if (sel.value.indexOf("\n") !== -1) {
|
if (sel.value.includes("\n")) {
|
||||||
this.applySurround(sel, head, "", exampleKey, opts);
|
this.applySurround(sel, head, "", exampleKey, opts);
|
||||||
} else {
|
} else {
|
||||||
const [hval, hlen] = getHead(head);
|
const [hval, hlen] = getHead(head);
|
||||||
|
@ -739,7 +739,7 @@ export default Component.extend(TextareaTextManipulation, {
|
||||||
|
|
||||||
const sel = this.getSelected("", { lineVal: true });
|
const sel = this.getSelected("", { lineVal: true });
|
||||||
const selValue = sel.value;
|
const selValue = sel.value;
|
||||||
const hasNewLine = selValue.indexOf("\n") !== -1;
|
const hasNewLine = selValue.includes("\n");
|
||||||
const isBlankLine = sel.lineVal.trim().length === 0;
|
const isBlankLine = sel.lineVal.trim().length === 0;
|
||||||
const isFourSpacesIndent =
|
const isFourSpacesIndent =
|
||||||
this.siteSettings.code_formatting_style === FOUR_SPACES_INDENT;
|
this.siteSettings.code_formatting_style === FOUR_SPACES_INDENT;
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default TextField.extend({
|
||||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=987293
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=987293
|
||||||
// work around issue while leaving a semi useable honeypot for
|
// work around issue while leaving a semi useable honeypot for
|
||||||
// bots that are running full Chrome
|
// bots that are running full Chrome
|
||||||
if (navigator.userAgent.indexOf("Chrome") > -1) {
|
if (navigator.userAgent.includes("Chrome")) {
|
||||||
this.set("type", "text");
|
this.set("type", "text");
|
||||||
} else {
|
} else {
|
||||||
this.set("type", "password");
|
this.set("type", "password");
|
||||||
|
|
|
@ -251,7 +251,7 @@ export default MountWidget.extend({
|
||||||
|
|
||||||
delete prev[postNumber];
|
delete prev[postNumber];
|
||||||
|
|
||||||
if (onscreen.indexOf(idx) !== -1) {
|
if (onscreen.includes(idx)) {
|
||||||
onscreenPostNumbers.push(postNumber);
|
onscreenPostNumbers.push(postNumber);
|
||||||
if (post.read) {
|
if (post.read) {
|
||||||
readPostNumbers.push(postNumber);
|
readPostNumbers.push(postNumber);
|
||||||
|
|
|
@ -121,14 +121,14 @@ export default TextField.extend({
|
||||||
return v.username || v.name;
|
return v.username || v.name;
|
||||||
} else {
|
} else {
|
||||||
const excludes = allExcludedUsernames();
|
const excludes = allExcludedUsernames();
|
||||||
return v.usernames.filter((item) => excludes.indexOf(item) === -1);
|
return v.usernames.filter((item) => !excludes.includes(item));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeItems(items) {
|
onChangeItems(items) {
|
||||||
let hasGroups = false;
|
let hasGroups = false;
|
||||||
items = items.map((i) => {
|
items = items.map((i) => {
|
||||||
if (groups.indexOf(i) > -1) {
|
if (groups.includes(i)) {
|
||||||
hasGroups = true;
|
hasGroups = true;
|
||||||
}
|
}
|
||||||
return i.username ? i.username : i;
|
return i.username ? i.username : i;
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.siteSettings.hide_email_address_taken) {
|
if (this.siteSettings.hide_email_address_taken) {
|
||||||
return (accountEmailOrUsername || "").indexOf("@") === -1;
|
return !(accountEmailOrUsername || "").includes("@");
|
||||||
} else {
|
} else {
|
||||||
return isEmpty((accountEmailOrUsername || "").trim());
|
return isEmpty((accountEmailOrUsername || "").trim());
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ export default Controller.extend({
|
||||||
|
|
||||||
@discourseComputed("q")
|
@discourseComputed("q")
|
||||||
showLikeCount(q) {
|
showLikeCount(q) {
|
||||||
return q && q.indexOf("order:likes") > -1;
|
return q?.includes("order:likes");
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("q")
|
@observes("q")
|
||||||
|
@ -211,11 +211,11 @@ export default Controller.extend({
|
||||||
return (
|
return (
|
||||||
q &&
|
q &&
|
||||||
this.currentUser &&
|
this.currentUser &&
|
||||||
(q.indexOf("in:messages") > -1 ||
|
(q.includes("in:messages") ||
|
||||||
q.indexOf("in:personal") > -1 ||
|
q.includes("in:personal") ||
|
||||||
q.indexOf(
|
q.includes(
|
||||||
`personal_messages:${this.currentUser.get("username_lower")}`
|
`personal_messages:${this.currentUser.get("username_lower")}`
|
||||||
) > -1)
|
))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ export default Controller.extend({
|
||||||
actions: {
|
actions: {
|
||||||
createTopic(searchTerm) {
|
createTopic(searchTerm) {
|
||||||
let topicCategory;
|
let topicCategory;
|
||||||
if (searchTerm.indexOf("category:") !== -1) {
|
if (searchTerm.includes("category:")) {
|
||||||
const match = searchTerm.match(/category:(\S*)/);
|
const match = searchTerm.match(/category:(\S*)/);
|
||||||
if (match && match[1]) {
|
if (match && match[1]) {
|
||||||
topicCategory = match[1];
|
topicCategory = match[1];
|
||||||
|
|
|
@ -102,7 +102,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
},
|
},
|
||||||
|
|
||||||
triggerSearch() {
|
triggerSearch() {
|
||||||
if (this.linkUrl.length > 3 && this.linkUrl.indexOf("http") === -1) {
|
if (this.linkUrl.length > 3 && !this.linkUrl.startsWith("http")) {
|
||||||
this.set("searchLoading", true);
|
this.set("searchLoading", true);
|
||||||
this._activeSearch = searchForTerm(this.linkUrl, {
|
this._activeSearch = searchForTerm(this.linkUrl, {
|
||||||
typeFilter: "topic",
|
typeFilter: "topic",
|
||||||
|
|
|
@ -106,7 +106,7 @@ export default Controller.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
let newList = this.reviewables.reject((reviewable) => {
|
let newList = this.reviewables.reject((reviewable) => {
|
||||||
return ids.indexOf(reviewable.id) !== -1;
|
return ids.includes(reviewable.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newList.length === 0) {
|
if (newList.length === 0) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ export default {
|
||||||
initialize() {
|
initialize() {
|
||||||
let queryStrings = window.location.search;
|
let queryStrings = window.location.search;
|
||||||
|
|
||||||
if (queryStrings.indexOf("user_api_public_key") !== -1) {
|
if (queryStrings.includes("user_api_public_key")) {
|
||||||
let params = queryStrings.startsWith("?")
|
let params = queryStrings.startsWith("?")
|
||||||
? queryStrings.slice(1).split("&")
|
? queryStrings.slice(1).split("&")
|
||||||
: [];
|
: [];
|
||||||
|
|
|
@ -483,7 +483,7 @@ export default function (options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function performAutocomplete(e) {
|
function performAutocomplete(e) {
|
||||||
if ([keys.esc, keys.enter].indexOf(e.which) !== -1) {
|
if ([keys.esc, keys.enter].includes(e.which)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ const set =
|
||||||
|
|
||||||
return {
|
return {
|
||||||
has(key) {
|
has(key) {
|
||||||
return Boolean(list.indexOf(key) > -1);
|
return Boolean(list.includes(key));
|
||||||
},
|
},
|
||||||
add(key) {
|
add(key) {
|
||||||
list.push(key);
|
list.push(key);
|
||||||
|
|
|
@ -26,7 +26,7 @@ const DefaultConnectorClass = {
|
||||||
|
|
||||||
function findOutlets(collection, callback) {
|
function findOutlets(collection, callback) {
|
||||||
Object.keys(collection).forEach(function (res) {
|
Object.keys(collection).forEach(function (res) {
|
||||||
if (res.indexOf("/connectors/") !== -1) {
|
if (res.includes("/connectors/")) {
|
||||||
const segments = res.split("/");
|
const segments = res.split("/");
|
||||||
let outletName = segments[segments.length - 2];
|
let outletName = segments[segments.length - 2];
|
||||||
const uniqueName = segments[segments.length - 1];
|
const uniqueName = segments[segments.length - 1];
|
||||||
|
|
|
@ -53,7 +53,7 @@ export function isTrackedTopic(topic) {
|
||||||
const tags = User.current().trackedTags;
|
const tags = User.current().trackedTags;
|
||||||
|
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
if (topic.tags.indexOf(tag) > -1) {
|
if (topic.tags.includes(tag)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ export default function transformPost(
|
||||||
}
|
}
|
||||||
|
|
||||||
const showTopicMap =
|
const showTopicMap =
|
||||||
_additionalAttributes.indexOf("topicMap") !== -1 ||
|
_additionalAttributes.includes("topicMap") ||
|
||||||
showPMMap ||
|
showPMMap ||
|
||||||
(post.post_number === 1 &&
|
(post.post_number === 1 &&
|
||||||
topic.archetype === "regular" &&
|
topic.archetype === "regular" &&
|
||||||
|
|
|
@ -135,7 +135,7 @@ function extensionsToArray(exts) {
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/[\s\.]+/g, "")
|
.replace(/[\s\.]+/g, "")
|
||||||
.split("|")
|
.split("|")
|
||||||
.filter((ext) => ext.indexOf("*") === -1);
|
.filter((ext) => !ext.includes("*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function extensions(siteSettings) {
|
function extensions(siteSettings) {
|
||||||
|
|
|
@ -490,7 +490,7 @@ export function setURLContainer(container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function prefixProtocol(url) {
|
export function prefixProtocol(url) {
|
||||||
return url.indexOf("://") === -1 && !url.startsWith("mailto:")
|
return !url.includes("://") && !url.startsWith("mailto:")
|
||||||
? "https://" + url
|
? "https://" + url
|
||||||
: url;
|
: url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ function organizeResults(r, options) {
|
||||||
|
|
||||||
if (r.users) {
|
if (r.users) {
|
||||||
r.users.every(function (u) {
|
r.users.every(function (u) {
|
||||||
if (exclude.indexOf(u.username) === -1) {
|
if (!exclude.includes(u.username)) {
|
||||||
users.push(u);
|
users.push(u);
|
||||||
results.push(u);
|
results.push(u);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ function organizeResults(r, options) {
|
||||||
options.term.toLowerCase() === g.name.toLowerCase() ||
|
options.term.toLowerCase() === g.name.toLowerCase() ||
|
||||||
results.length < limit
|
results.length < limit
|
||||||
) {
|
) {
|
||||||
if (exclude.indexOf(g.name) === -1) {
|
if (!exclude.includes(g.name)) {
|
||||||
groups.push(g);
|
groups.push(g);
|
||||||
results.push(g);
|
results.push(g);
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ export function skipSearch(term, allowEmails, lastSeenUsers = false) {
|
||||||
if (lastSeenUsers) {
|
if (lastSeenUsers) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (term.indexOf("@") > -1 && !allowEmails) {
|
if (term.includes("@") && !allowEmails) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ export function hostnameValid(hostname) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractDomainFromUrl(url) {
|
export function extractDomainFromUrl(url) {
|
||||||
if (url.indexOf("://") > -1) {
|
if (url.includes("://")) {
|
||||||
url = url.split("/")[2];
|
url = url.split("/")[2];
|
||||||
} else {
|
} else {
|
||||||
url = url.split("/")[0];
|
url = url.split("/")[0];
|
||||||
|
@ -441,7 +441,7 @@ export function areCookiesEnabled() {
|
||||||
// see: https://github.com/Modernizr/Modernizr/blob/400db4043c22af98d46e1d2b9cbc5cb062791192/feature-detects/cookies.js
|
// see: https://github.com/Modernizr/Modernizr/blob/400db4043c22af98d46e1d2b9cbc5cb062791192/feature-detects/cookies.js
|
||||||
try {
|
try {
|
||||||
document.cookie = "cookietest=1";
|
document.cookie = "cookietest=1";
|
||||||
let ret = document.cookie.indexOf("cookietest=") !== -1;
|
let ret = document.cookie.includes("cookietest=");
|
||||||
document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
||||||
return ret;
|
return ret;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -116,7 +116,7 @@ const Bookmark = RestModel.extend({
|
||||||
const newTags = [];
|
const newTags = [];
|
||||||
|
|
||||||
tags.forEach(function (tag) {
|
tags.forEach(function (tag) {
|
||||||
if (title.toLowerCase().indexOf(tag) === -1) {
|
if (!title.toLowerCase().includes(tag)) {
|
||||||
newTags.push(tag);
|
newTags.push(tag);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -602,7 +602,7 @@ Category.reopenClass({
|
||||||
category.get("slug").toLowerCase().indexOf(slugTerm) > 0) &&
|
category.get("slug").toLowerCase().indexOf(slugTerm) > 0) &&
|
||||||
validCategoryParent(category)
|
validCategoryParent(category)
|
||||||
) {
|
) {
|
||||||
if (data.indexOf(category) === -1) {
|
if (!data.includes(category)) {
|
||||||
data.push(category);
|
data.push(category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,7 @@ const Composer = RestModel.extend({
|
||||||
if (
|
if (
|
||||||
!categoryId &&
|
!categoryId &&
|
||||||
categoryIds &&
|
categoryIds &&
|
||||||
(categoryIds.indexOf(this.site.uncategorized_category_id) !== -1 ||
|
(categoryIds.includes(this.site.uncategorized_category_id) ||
|
||||||
!this.siteSettings.allow_uncategorized_topics)
|
!this.siteSettings.allow_uncategorized_topics)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -311,7 +311,7 @@ const Composer = RestModel.extend({
|
||||||
return (
|
return (
|
||||||
categoryIds === undefined ||
|
categoryIds === undefined ||
|
||||||
!categoryIds.length ||
|
!categoryIds.length ||
|
||||||
categoryIds.indexOf(categoryId) !== -1
|
categoryIds.includes(categoryId)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -714,7 +714,7 @@ export default RestModel.extend({
|
||||||
let missingIds = [];
|
let missingIds = [];
|
||||||
|
|
||||||
postIds.forEach((postId) => {
|
postIds.forEach((postId) => {
|
||||||
if (postId && this.stream.indexOf(postId) === -1) {
|
if (postId && !this.stream.includes(postId)) {
|
||||||
missingIds.push(postId);
|
missingIds.push(postId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -725,7 +725,7 @@ export default RestModel.extend({
|
||||||
|
|
||||||
if (loadedAllPosts) {
|
if (loadedAllPosts) {
|
||||||
missingIds.forEach((postId) => {
|
missingIds.forEach((postId) => {
|
||||||
if (this._loadingPostIds.indexOf(postId) === -1) {
|
if (!this._loadingPostIds.includes(postId)) {
|
||||||
this._loadingPostIds.push(postId);
|
this._loadingPostIds.push(postId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -500,15 +500,11 @@ const TopicTrackingState = EmberObject.extend({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagId && !(topic.tags && topic.tags.indexOf(tagId) > -1)) {
|
if (tagId && !topic.tags?.includes(tagId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (type === "new" && mutedCategoryIds?.includes(topic.category_id)) {
|
||||||
type === "new" &&
|
|
||||||
mutedCategoryIds &&
|
|
||||||
mutedCategoryIds.indexOf(topic.category_id) !== -1
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,7 +584,7 @@ const TopicTrackingState = EmberObject.extend({
|
||||||
(topic, newTopic, unreadTopic) => {
|
(topic, newTopic, unreadTopic) => {
|
||||||
if (topic.tags && topic.tags.length > 0) {
|
if (topic.tags && topic.tags.length > 0) {
|
||||||
tags.forEach((tag) => {
|
tags.forEach((tag) => {
|
||||||
if (topic.tags.indexOf(tag) > -1) {
|
if (topic.tags.includes(tag)) {
|
||||||
if (unreadTopic) {
|
if (unreadTopic) {
|
||||||
counts[tag].unreadCount++;
|
counts[tag].unreadCount++;
|
||||||
}
|
}
|
||||||
|
@ -615,7 +611,7 @@ const TopicTrackingState = EmberObject.extend({
|
||||||
if (
|
if (
|
||||||
topic.category_id === category_id &&
|
topic.category_id === category_id &&
|
||||||
!topic.deleted &&
|
!topic.deleted &&
|
||||||
(!tagId || (topic.tags && topic.tags.indexOf(tagId) > -1))
|
(!tagId || topic.tags?.includes(tagId))
|
||||||
) {
|
) {
|
||||||
sum +=
|
sum +=
|
||||||
topic.last_read_post_number === null ||
|
topic.last_read_post_number === null ||
|
||||||
|
@ -940,7 +936,7 @@ const TopicTrackingState = EmberObject.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_addIncoming(topicId) {
|
_addIncoming(topicId) {
|
||||||
if (this.newIncoming.indexOf(topicId) === -1) {
|
if (!this.newIncoming.includes(topicId)) {
|
||||||
this.newIncoming.push(topicId);
|
this.newIncoming.push(topicId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -960,7 +956,7 @@ const TopicTrackingState = EmberObject.extend({
|
||||||
_stateKey(topicOrId) {
|
_stateKey(topicOrId) {
|
||||||
if (typeof topicOrId === "number") {
|
if (typeof topicOrId === "number") {
|
||||||
return `t${topicOrId}`;
|
return `t${topicOrId}`;
|
||||||
} else if (typeof topicOrId === "string" && topicOrId.indexOf("t") > -1) {
|
} else if (typeof topicOrId === "string" && topicOrId.includes("t")) {
|
||||||
return topicOrId;
|
return topicOrId;
|
||||||
} else {
|
} else {
|
||||||
return `t${topicOrId.topic_id}`;
|
return `t${topicOrId.topic_id}`;
|
||||||
|
|
|
@ -164,7 +164,7 @@ const Topic = RestModel.extend({
|
||||||
const newTags = [];
|
const newTags = [];
|
||||||
|
|
||||||
tags.forEach(function (tag) {
|
tags.forEach(function (tag) {
|
||||||
if (title.indexOf(tag.toLowerCase()) === -1) {
|
if (!title.includes(tag.toLowerCase())) {
|
||||||
newTags.push(tag);
|
newTags.push(tag);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -369,13 +369,13 @@ const User = RestModel.extend({
|
||||||
|
|
||||||
save(fields) {
|
save(fields) {
|
||||||
const data = this.getProperties(
|
const data = this.getProperties(
|
||||||
userFields.filter((uf) => !fields || fields.indexOf(uf) !== -1)
|
userFields.filter((uf) => !fields || fields.includes(uf))
|
||||||
);
|
);
|
||||||
|
|
||||||
let filteredUserOptionFields = [];
|
let filteredUserOptionFields = [];
|
||||||
if (fields) {
|
if (fields) {
|
||||||
filteredUserOptionFields = userOptionFields.filter(
|
filteredUserOptionFields = userOptionFields.filter((uo) =>
|
||||||
(uo) => fields.indexOf(uo) !== -1
|
fields.includes(uo)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
filteredUserOptionFields = userOptionFields;
|
filteredUserOptionFields = userOptionFields;
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default DiscourseRoute.extend(OpenComposer, {
|
||||||
let matches;
|
let matches;
|
||||||
if (
|
if (
|
||||||
(url === "/" || url === "/latest" || url === "/categories") &&
|
(url === "/" || url === "/latest" || url === "/categories") &&
|
||||||
transition.targetName.indexOf("discovery.top") === -1 &&
|
!transition.targetName.includes("discovery.top") &&
|
||||||
User.currentProp("should_be_redirected_to_top")
|
User.currentProp("should_be_redirected_to_top")
|
||||||
) {
|
) {
|
||||||
User.currentProp("should_be_redirected_to_top", false);
|
User.currentProp("should_be_redirected_to_top", false);
|
||||||
|
|
|
@ -204,7 +204,7 @@ export default class ScreenTrack extends Service {
|
||||||
this.appEvents.trigger("topic:timings-sent", data);
|
this.appEvents.trigger("topic:timings-sent", data);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
if (e.jqXHR && ALLOWED_AJAX_FAILURES.indexOf(e.jqXHR.status) > -1) {
|
if (e.jqXHR && ALLOWED_AJAX_FAILURES.includes(e.jqXHR.status)) {
|
||||||
const delay = AJAX_FAILURE_DELAYS[this._ajaxFailures];
|
const delay = AJAX_FAILURE_DELAYS[this._ajaxFailures];
|
||||||
this._ajaxFailures += 1;
|
this._ajaxFailures += 1;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ export default class ScreenTrack extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
topicIds.indexOf(topicId) === -1 &&
|
!topicIds.includes(topicId) &&
|
||||||
topicIds.length < ANON_MAX_TOPIC_IDS
|
topicIds.length < ANON_MAX_TOPIC_IDS
|
||||||
) {
|
) {
|
||||||
topicIds.push(topicId);
|
topicIds.push(topicId);
|
||||||
|
|
|
@ -509,7 +509,7 @@ export default createWidget("post-menu", {
|
||||||
if (
|
if (
|
||||||
(attrs.yours && button.attrs && button.attrs.alwaysShowYours) ||
|
(attrs.yours && button.attrs && button.attrs.alwaysShowYours) ||
|
||||||
(attrs.reviewableId && i === "flag") ||
|
(attrs.reviewableId && i === "flag") ||
|
||||||
hiddenButtons.indexOf(i) === -1
|
!hiddenButtons.includes(i)
|
||||||
) {
|
) {
|
||||||
visibleButtons.push(button);
|
visibleButtons.push(button);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,13 +58,13 @@ const DEFAULT_QUICK_TIPS = [
|
||||||
let QUICK_TIPS = [];
|
let QUICK_TIPS = [];
|
||||||
|
|
||||||
export function addSearchSuggestion(value) {
|
export function addSearchSuggestion(value) {
|
||||||
if (suggestionShortcuts.indexOf(value) === -1) {
|
if (!suggestionShortcuts.includes(value)) {
|
||||||
suggestionShortcuts.push(value);
|
suggestionShortcuts.push(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addQuickSearchRandomTip(tip) {
|
export function addQuickSearchRandomTip(tip) {
|
||||||
if (QUICK_TIPS.indexOf(tip) === -1) {
|
if (!QUICK_TIPS.includes(tip)) {
|
||||||
QUICK_TIPS.push(tip);
|
QUICK_TIPS.push(tip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,7 +902,7 @@ export function applyDefaultHandlers(pretender) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.queryParams.url.indexOf("/internal-page.html") > -1) {
|
if (request.queryParams.url.includes("/internal-page.html")) {
|
||||||
return [
|
return [
|
||||||
200,
|
200,
|
||||||
{ "Content-Type": "application/html" },
|
{ "Content-Type": "application/html" },
|
||||||
|
|
|
@ -11,7 +11,7 @@ import sinon from "sinon";
|
||||||
function buildStream(id, stream) {
|
function buildStream(id, stream) {
|
||||||
const store = createStore();
|
const store = createStore();
|
||||||
const topic = store.createRecord("topic", { id, chunk_size: 5 });
|
const topic = store.createRecord("topic", { id, chunk_size: 5 });
|
||||||
const ps = topic.get("postStream");
|
const ps = topic.postStream;
|
||||||
if (stream) {
|
if (stream) {
|
||||||
ps.set("stream", stream);
|
ps.set("stream", stream);
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
|
|
||||||
test("defaults", function (assert) {
|
test("defaults", function (assert) {
|
||||||
const postStream = buildStream(1234);
|
const postStream = buildStream(1234);
|
||||||
assert.blank(
|
assert.blank(postStream.posts, "there are no posts in a stream by default");
|
||||||
postStream.get("posts"),
|
|
||||||
"there are no posts in a stream by default"
|
|
||||||
);
|
|
||||||
assert.ok(!postStream.get("loaded"), "it has never loaded");
|
assert.ok(!postStream.get("loaded"), "it has never loaded");
|
||||||
assert.present(postStream.get("topic"));
|
assert.present(postStream.get("topic"));
|
||||||
});
|
});
|
||||||
|
@ -206,7 +203,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
1,
|
1,
|
||||||
"it loaded the posts"
|
"it loaded the posts"
|
||||||
);
|
);
|
||||||
assert.containsInstance(postStream.get("posts"), Post);
|
assert.containsInstance(postStream.posts, Post);
|
||||||
|
|
||||||
assert.strictEqual(postStream.get("extra_property"), 12);
|
assert.strictEqual(postStream.get("extra_property"), 12);
|
||||||
});
|
});
|
||||||
|
@ -617,7 +614,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
postStream.get("posts").length,
|
postStream.posts.length,
|
||||||
6,
|
6,
|
||||||
"it adds the right posts into the stream"
|
"it adds the right posts into the stream"
|
||||||
);
|
);
|
||||||
|
@ -640,7 +637,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
postStream.get("posts").length,
|
postStream.posts.length,
|
||||||
6,
|
6,
|
||||||
"it adds the right posts into the stream"
|
"it adds the right posts into the stream"
|
||||||
);
|
);
|
||||||
|
@ -723,7 +720,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
"it is assigned a created date"
|
"it is assigned a created date"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
postStream.get("posts").includes(stagedPost),
|
postStream.posts.includes(stagedPost),
|
||||||
"the post is added to the stream"
|
"the post is added to the stream"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
|
@ -752,7 +749,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
"it retains the filteredPostsCount"
|
"it retains the filteredPostsCount"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
!postStream.get("posts").includes(stagedPost),
|
!postStream.posts.includes(stagedPost),
|
||||||
"the post is removed from the stream"
|
"the post is removed from the stream"
|
||||||
);
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
|
@ -815,7 +812,7 @@ module("Unit | Model | post-stream", function () {
|
||||||
|
|
||||||
postStream.commitPost(stagedPost);
|
postStream.commitPost(stagedPost);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
postStream.get("posts").includes(stagedPost),
|
postStream.posts.includes(stagedPost),
|
||||||
"the post is still in the stream"
|
"the post is still in the stream"
|
||||||
);
|
);
|
||||||
assert.ok(!postStream.get("loading"), "it is no longer loading");
|
assert.ok(!postStream.get("loading"), "it is no longer loading");
|
||||||
|
@ -828,7 +825,10 @@ module("Unit | Model | post-stream", function () {
|
||||||
|
|
||||||
const found = postStream.findLoadedPost(stagedPost.get("id"));
|
const found = postStream.findLoadedPost(stagedPost.get("id"));
|
||||||
assert.present(found, "the post is in the identity map");
|
assert.present(found, "the post is in the identity map");
|
||||||
assert.ok(postStream.indexOf(stagedPost) > -1, "the post is in the stream");
|
assert.ok(
|
||||||
|
postStream.posts.includes(stagedPost),
|
||||||
|
"the post is in the stream"
|
||||||
|
);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
found.get("raw"),
|
found.get("raw"),
|
||||||
"different raw value",
|
"different raw value",
|
||||||
|
|
|
@ -118,9 +118,8 @@ export function sanitize(text, allowLister) {
|
||||||
const forAttr = forTag[name];
|
const forAttr = forTag[name];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(forAttr &&
|
(forAttr && (forAttr.includes("*") || forAttr.includes(value))) ||
|
||||||
(forAttr.indexOf("*") !== -1 || forAttr.indexOf(value) !== -1)) ||
|
(!name.includes("data-html-") &&
|
||||||
(name.indexOf("data-html-") === -1 &&
|
|
||||||
name.startsWith("data-") &&
|
name.startsWith("data-") &&
|
||||||
(forTag["data-*"] || testDataAttribute(forTag, name, value))) ||
|
(forTag["data-*"] || testDataAttribute(forTag, name, value))) ||
|
||||||
(tag === "a" &&
|
(tag === "a" &&
|
||||||
|
@ -157,7 +156,7 @@ export function sanitize(text, allowLister) {
|
||||||
|
|
||||||
// Heading ids must begin with `heading--`
|
// Heading ids must begin with `heading--`
|
||||||
if (
|
if (
|
||||||
["h1", "h2", "h3", "h4", "h5", "h6"].indexOf(tag) !== -1 &&
|
["h1", "h2", "h3", "h4", "h5", "h6"].includes(tag) &&
|
||||||
value.match(/^heading\-\-[a-zA-Z0-9\-\_]+$/)
|
value.match(/^heading\-\-[a-zA-Z0-9\-\_]+$/)
|
||||||
) {
|
) {
|
||||||
return attr(name, value);
|
return attr(name, value);
|
||||||
|
|
|
@ -116,7 +116,7 @@ function getAttributeBasedUrl(dataAttribute, cachedUpload, siteSettings) {
|
||||||
// in this case for permission checks
|
// in this case for permission checks
|
||||||
if (
|
if (
|
||||||
siteSettings.secure_media &&
|
siteSettings.secure_media &&
|
||||||
cachedUpload.url.indexOf("secure-media-uploads") > -1
|
cachedUpload.url.includes("secure-media-uploads")
|
||||||
) {
|
) {
|
||||||
return cachedUpload.url;
|
return cachedUpload.url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ function render(tokens, idx, options, env, slf, md) {
|
||||||
const acceptableCodeClasses =
|
const acceptableCodeClasses =
|
||||||
md.options.discourse.acceptableCodeClasses || [];
|
md.options.discourse.acceptableCodeClasses || [];
|
||||||
|
|
||||||
if (TEXT_CODE_CLASSES.indexOf(tag) > -1) {
|
if (TEXT_CODE_CLASSES.includes(tag)) {
|
||||||
className = "lang-nohighlight";
|
className = "lang-nohighlight";
|
||||||
} else if (acceptableCodeClasses.indexOf(tag) > -1) {
|
} else if (acceptableCodeClasses.includes(tag)) {
|
||||||
className = `lang-${tag}`;
|
className = `lang-${tag}`;
|
||||||
} else {
|
} else {
|
||||||
className = "lang-nohighlight";
|
className = "lang-nohighlight";
|
||||||
|
@ -91,7 +91,7 @@ export function setup(helper) {
|
||||||
if (tag === "code" && name === "class") {
|
if (tag === "code" && name === "class") {
|
||||||
const m = /^lang\-(.+)$/.exec(value);
|
const m = /^lang\-(.+)$/.exec(value);
|
||||||
if (m) {
|
if (m) {
|
||||||
return helper.getOptions().acceptableCodeClasses.indexOf(m[1]) !== -1;
|
return helper.getOptions().acceptableCodeClasses.includes(m[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -140,7 +140,7 @@ function rule(state) {
|
||||||
// url to take advantage of access control security
|
// url to take advantage of access control security
|
||||||
if (
|
if (
|
||||||
state.md.options.discourse.limitedSiteSettings.secureMedia &&
|
state.md.options.discourse.limitedSiteSettings.secureMedia &&
|
||||||
mapped.url.indexOf("secure-media-uploads") > -1
|
mapped.url.includes("secure-media-uploads")
|
||||||
) {
|
) {
|
||||||
token.attrs[srcIndex][1] = mapped.url;
|
token.attrs[srcIndex][1] = mapped.url;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -191,6 +191,6 @@ export default ComboBoxComponent.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_matchCategory(filter, categoryName) {
|
_matchCategory(filter, categoryName) {
|
||||||
return this._normalize(categoryName).indexOf(filter) > -1;
|
return this._normalize(categoryName).includes(filter);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,17 +18,13 @@ export default MultiSelectComponent.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
modifyComponentForRow(collection) {
|
modifyComponentForRow(collection) {
|
||||||
if (
|
if (collection === MAIN_COLLECTION && this.settingName?.includes("color")) {
|
||||||
collection === MAIN_COLLECTION &&
|
|
||||||
this.settingName &&
|
|
||||||
this.settingName.indexOf("color") > -1
|
|
||||||
) {
|
|
||||||
return "create-color-row";
|
return "create-color-row";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
selectedChoiceComponent: computed("settingName", function () {
|
selectedChoiceComponent: computed("settingName", function () {
|
||||||
if (this.settingName && this.settingName.indexOf("color") > -1) {
|
if (this.settingName?.includes("color")) {
|
||||||
return "selected-choice-color";
|
return "selected-choice-color";
|
||||||
} else {
|
} else {
|
||||||
return "selected-choice";
|
return "selected-choice";
|
||||||
|
|
|
@ -232,7 +232,7 @@ export default Component.extend(
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof value === "string" &&
|
typeof value === "string" &&
|
||||||
value.indexOf(".") < 0 &&
|
!value.includes(".") &&
|
||||||
value in this
|
value in this
|
||||||
) {
|
) {
|
||||||
const computedValue = get(this, value);
|
const computedValue = get(this, value);
|
||||||
|
@ -593,7 +593,7 @@ export default Component.extend(
|
||||||
filter = this._normalize(filter);
|
filter = this._normalize(filter);
|
||||||
content = content.filter((c) => {
|
content = content.filter((c) => {
|
||||||
const name = this._normalize(this.getName(c));
|
const name = this._normalize(this.getName(c));
|
||||||
return name && name.indexOf(filter) > -1;
|
return name?.includes(filter);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
|
|
|
@ -77,7 +77,7 @@ export default Mixin.create({
|
||||||
const property = get(this.selectKit, type);
|
const property = get(this.selectKit, type);
|
||||||
|
|
||||||
if (!property) {
|
if (!property) {
|
||||||
if (content.indexOf(item) > -1) {
|
if (content.includes(item)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
} else if (typeof property === "string") {
|
} else if (typeof property === "string") {
|
||||||
|
|
|
@ -78,7 +78,7 @@ function __getURLNoCDN(url) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.indexOf(__paths.baseUri) !== -1) {
|
if (url.includes(__paths.baseUri)) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
if (url[0] !== "/") {
|
if (url[0] !== "/") {
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
if (!e) {
|
if (!e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (normalizeUrl(DE.discourseUrl).indexOf(normalizeUrl(e.origin)) === -1) {
|
if (!normalizeUrl(DE.discourseUrl).includes(normalizeUrl(e.origin))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ async function runAllTests() {
|
||||||
expression: `(${qunit_script})();`,
|
expression: `(${qunit_script})();`,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (args[0].indexOf("report_requests=1") > -1) {
|
if (args[0].includes("report_requests=1")) {
|
||||||
await Runtime.evaluate({
|
await Runtime.evaluate({
|
||||||
expression: "QUnit.config.logAllRequests = true",
|
expression: "QUnit.config.logAllRequests = true",
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue