DEV: Correct typos and spelling mistakes (#12812)

Over the years we accrued many spelling mistakes in the code base. 

This PR attempts to fix spelling mistakes and typos in all areas of the code that are extremely safe to change 

- comments
- test descriptions
- other low risk areas
This commit is contained in:
Josh Soref 2021-05-20 21:43:47 -04:00 committed by GitHub
parent 6421fabb02
commit 59097b207f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
207 changed files with 315 additions and 315 deletions

View File

@ -1 +1 @@
<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in Javascript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->

View File

@ -288,7 +288,7 @@ export default Component.extend({
// when adding two separate files with the same filename search for matching
// placeholder already existing in the editor ie [Uploading: test.png...]
// and add order nr to the next one: [Uplodading: test.png(1)...]
// and add order nr to the next one: [Uploading: test.png(1)...]
const escapedFilename = filename.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const regexString = `\\[${I18n.t("uploading_filename", {
filename: escapedFilename + "(?:\\()?([0-9])?(?:\\))?",

View File

@ -268,7 +268,7 @@ export default Controller.extend(
(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,
// or email and username were filled automatically by 3rd party auth,
// then look for a registered username that matches the email.
discourseDebounce(this, this.fetchExistingUsername, 500);
}

View File

@ -87,7 +87,7 @@ export default Controller.extend(ModalFunctionality, {
attestation: "none",
authenticatorSelection: {
// see https://chromium.googlesource.com/chromium/src/+/master/content/browser/webauth/uv_preferred.md for why
// default value of preferred is not necesarrily what we want, it limits webauthn to only devices that support
// default value of preferred is not necessarily what we want, it limits webauthn to only devices that support
// user verification, which usually requires entering a PIN
userVerification: "discouraged",
},

View File

@ -1606,7 +1606,7 @@ export default Controller.extend(bufferedProperty("model"), {
}
// scroll to bottom is very specific to new posts from discobot
// hence the -2 check (dicobot id). We can shift all this code
// hence the -2 check (discobot id). We can shift all this code
// to discobot plugin longer term
if (
topic.get("isPrivateMessage") &&

View File

@ -59,7 +59,7 @@ function renderAvatar(user, options) {
const description = get(user, "description");
// if a description has been provided
if (description && description.length > 0) {
// preprend the username before the description
// prepend the username before the description
title = I18n.t("user.avatar.name_and_description", {
name: displayName,
description,

View File

@ -1,4 +1,4 @@
// Updates the PWA badging if avaliable
// Updates the PWA badging if available
export default {
name: "badging",
after: "message-bus",

View File

@ -99,7 +99,7 @@ export default function (options) {
let div = null;
let prevTerm = null;
// By default, when the autcomplete popup is rendered it has the
// By default, when the autocomplete popup is rendered it has the
// first suggestion 'selected', and pressing enter key inserts
// the first suggestion into the input box.
// If you want to stop that behavior, i.e. have the popup renders

View File

@ -67,7 +67,7 @@ Eyeline.prototype.update = function () {
}
// It's seen if...
// ...the element is vertically within the top and botom
// ...the element is vertically within the top and bottom
if (elemTop <= docViewBottom && elemTop >= docViewTop) {
markSeen = true;
}

View File

@ -1,6 +1,6 @@
/*eslint no-bitwise:0 */
// Note: before changing this be aware the same algo is used server side for avatars.
// Note: before changing this be aware the same algorithm is used server side for avatars.
export function hashString(str) {
let hash = 0;
for (let i = 0; i < str.length; i++) {

View File

@ -23,7 +23,7 @@ export function startPageTracking(router, appEvents, documentTitle) {
return;
}
router.on("routeDidChange", (transition) => {
// we ocassionally prevent tracking of replaced pages when only query params changed
// we occasionally prevent tracking of replaced pages when only query params changed
// eg: google analytics
const replacedOnlyQueryParams =
transition.urlMethod === "replace" && transition.queryParamsOnly;

View File

@ -33,7 +33,7 @@ const SERVER_SIDE_ONLY = [
/^\/styleguide/,
];
// The amount of height (in pixles) that we factor in when jumpEnd is called so
// The amount of height (in pixels) that we factor in when jumpEnd is called so
// that we show a little bit of the post text even on mobile devices instead of
// scrolling to "suggested topics".
const JUMP_END_BUFFER = 250;

View File

@ -157,7 +157,7 @@ function organizeResults(r, options) {
return results;
}
// all punctuations except for -, _ and . which are allowed in usernames
// all punctuation except for -, _ and . which are allowed in usernames
// note: these are valid in names, but will end up tripping search anyway so just skip
// this means searching for `sam saffron` is OK but if my name is `sam$ saffron` autocomplete
// will not find me, which is a reasonable compromise

View File

@ -452,9 +452,9 @@ const CODE_BLOCKS_REGEX = /^( |\t).*|`[^`]+`|^```[^]*?^```|\[code\][^]*?\[\/c
// | | | |
// | | | code blocks between [code]
// | | |
// | | +--- code blocks between three backquote
// | | +--- code blocks between three backticks
// | |
// | +----- inline code between backquotes
// | +----- inline code between backticks
// |
// +------- paragraphs starting with 4 spaces or tab

View File

@ -42,7 +42,7 @@ export function getWebauthnCredential(
timeout: 60000,
// see https://chromium.googlesource.com/chromium/src/+/master/content/browser/webauth/uv_preferred.md for why
// default value of preferred is not necesarrily what we want, it limits webauthn to only devices that support
// default value of preferred is not necessarily what we want, it limits webauthn to only devices that support
// user verification, which usually requires entering a PIN
userVerification: "discouraged",
},

View File

@ -426,7 +426,7 @@ Category.reopenClass({
findBySlugPathWithID(slugPathWithID) {
let parts = slugPathWithID.split("/").filter(Boolean);
// slugs found by star/glob pathing in emeber do not automatically url decode - ensure that these are decoded
// slugs found by star/glob pathing in ember do not automatically url decode - ensure that these are decoded
if (this.slugEncoded()) {
parts = parts.map((urlPart) => decodeURI(urlPart));
}

View File

@ -155,7 +155,7 @@ export default class PostCooked {
valid = href.split("?")[0] === lc.url;
}
// don't display badge counts on category badge & oneboxes (unless when explicitely stated)
// don't display badge counts on category badge & oneboxes (unless when explicitly stated)
if (valid && isValidLink($link)) {
const title = I18n.t("topic_map.clicks", { count: lc.clicks });
$link.append(

View File

@ -18,7 +18,7 @@ class TranslationPlugin extends Plugin {
build() {
// We could get fancy eventually and do this based on whether the yaml
// or vendor files change but in practice we should't need exact up to date
// or vendor files change but in practice we shouldn't need exact up to date
// translations in admin.
if (built) {
return;

View File

@ -95,7 +95,7 @@ acceptance("Admin - Badges - Show", function (needs) {
await click("input#badge-icon");
assert.ok(exists(".icon-picker"), "icon picker is becomes visible");
assert.ok(!exists(".image-uploader"), "image uploader bcomes hidden");
assert.ok(!exists(".image-uploader"), "image uploader becomes hidden");
assert.equal(query(".icon-picker").textContent.trim(), "fa-rocket");
});
});

View File

@ -788,7 +788,7 @@ acceptance("Composer", function (needs) {
"![test|690x313, 50%](upload://test.png)",
// 3 No dimensions, should not work
"![test](upload://test.jpeg)",
// 4 Wrapped in backquetes should not work
// 4 Wrapped in backticks should not work
"`![test|690x313](upload://test.png)`",
// 5 html image - should not work
"<img src='/images/avatar.png' wight='20' height='20'>",

View File

@ -27,7 +27,7 @@ acceptance("Group Members - Anonymous", function () {
assert.equal(
queryAll(".group-username-filter").attr("placeholder"),
I18n.t("groups.members.filter_placeholder"),
"it should display the right filter placehodler"
"it should display the right filter placeholder"
);
});
});
@ -65,7 +65,7 @@ acceptance("Group Members", function (needs) {
assert.equal(
queryAll(".group-username-filter").attr("placeholder"),
I18n.t("groups.members.filter_placeholder_admin"),
"it should display the right filter placehodler"
"it should display the right filter placeholder"
);
});

View File

@ -129,7 +129,7 @@ export default {
{ id: 6680, username: "cdman", avatar_template: "/images/avatar.png" },
{ id: 500, username: "aeid", avatar_template: "/images/avatar.png" },
{ id: 8, username: "geek", avatar_template: "/images/avatar.png" },
{ id: 606, username: "Cafeine", avatar_template: "/images/avatar.png" }
{ id: 606, username: "Caffeine", avatar_template: "/images/avatar.png" }
],
topic_list: {
can_create_topic: false,
@ -1272,7 +1272,7 @@ export default {
{ id: 6680, username: "cdman", avatar_template: "/images/avatar.png" },
{ id: 500, username: "aeid", avatar_template: "/images/avatar.png" },
{ id: 8, username: "geek", avatar_template: "/images/avatar.png" },
{ id: 606, username: "Cafeine", avatar_template: "/images/avatar.png" }
{ id: 606, username: "Caffeine", avatar_template: "/images/avatar.png" }
],
topic_list: {
can_create_topic: false,
@ -3003,7 +3003,7 @@ export default {
{ id: 3681, username: "Ajarn", avatar_template: "/images/avatar.png" },
{ id: 1621, username: "bnb", avatar_template: "/images/avatar.png" },
{ id: 6266, username: "bragi", avatar_template: "/images/avatar.png" },
{ id: 5335, username: "masda70", avatar_template: "/images/avatar.png" },
{ id: 5335, username: "mazda70", avatar_template: "/images/avatar.png" },
{
id: 6314,
username: "rafaelfranca",
@ -4183,7 +4183,7 @@ export default {
{ id: 3681, username: "Ajarn", avatar_template: "/images/avatar.png" },
{ id: 1621, username: "bnb", avatar_template: "/images/avatar.png" },
{ id: 6266, username: "bragi", avatar_template: "/images/avatar.png" },
{ id: 5335, username: "masda70", avatar_template: "/images/avatar.png" },
{ id: 5335, username: "mazda70", avatar_template: "/images/avatar.png" },
{
id: 6314,
username: "rafaelfranca",
@ -5255,7 +5255,7 @@ export default {
{ id: 3681, username: "Ajarn", avatar_template: "/images/avatar.png" },
{ id: 1621, username: "bnb", avatar_template: "/images/avatar.png" },
{ id: 6266, username: "bragi", avatar_template: "/images/avatar.png" },
{ id: 5335, username: "masda70", avatar_template: "/images/avatar.png" },
{ id: 5335, username: "mazda70", avatar_template: "/images/avatar.png" },
{
id: 6314,
username: "rafaelfranca",

File diff suppressed because one or more lines are too long

View File

@ -3091,11 +3091,11 @@ export default {
{
id: 27346,
title:
'Reply+{messagekey}@... optionaly in header "from" in addition to "reply-to"',
'Reply+{messagekey}@... optionally in header "from" in addition to "reply-to"',
fancy_title:
"Reply+{messagekey}@&hellip; optionaly in header &ldquo;from&rdquo; in addition to &ldquo;reply-to&rdquo;",
"Reply+{messagekey}@&hellip; optionally in header &ldquo;from&rdquo; in addition to &ldquo;reply-to&rdquo;",
slug:
"reply-messagekey-optionaly-in-header-from-in-addition-to-reply-to",
"reply-messagekey-optionally-in-header-from-in-addition-to-reply-to",
posts_count: 1,
reply_count: 0,
highest_post_number: 1,

View File

@ -1132,7 +1132,7 @@ export default {
action_type: 6,
created_at: "2014-01-13T21:58:28Z",
excerpt:
"It looks uneeded, but you need to review a fair amount of code to confirm it is not needed. \n\nI am going to keep it for now cause its safer under some weird edge conditions.",
"It looks unneeded, but you need to review a fair amount of code to confirm it is not needed. \n\nI am going to keep it for now cause its safer under some weird edge conditions.",
avatar_template:
"//www.gravatar.com/avatar/3dcae8378d46c244172a115c28ca49ce.png?s={size}&r=pg&d=identicon",
acting_avatar_template:

View File

@ -526,7 +526,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {
},
});
componentTest("reply directly above (supressed)", {
componentTest("reply directly above (suppressed)", {
template: hbs`{{mount-widget widget="post" args=args}}`,
beforeEach() {
this.set("args", {
@ -545,7 +545,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {
},
});
componentTest("reply a few posts above (supressed)", {
componentTest("reply a few posts above (suppressed)", {
template: hbs`{{mount-widget widget="post" args=args}}`,
beforeEach() {
this.set("args", {

View File

@ -25,7 +25,7 @@ discourseModule(
async test(assert) {
assert.ok(queryAll('[data-user-card="eviltrout"]').length === 1);
assert.ok(queryAll('[data-user-card="someone"]').length === 0);
assert.ok(queryAll(".unknown").length, "includes unkown user");
assert.ok(queryAll(".unknown").length, "includes unknown user");
},
});
}

View File

@ -305,7 +305,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {
},
test(assert) {
// comin up
// coming up
assert.equal(queryAll("span.string").text(), "evil");
assert.equal(queryAll("span.var").text(), "trout");
assert.equal(queryAll("a").prop("title"), "evil");

View File

@ -247,7 +247,7 @@ function setupTestsCommon(application, container, config) {
if (!setupApplicationTest) {
// ensures any event not removed is not leaking between tests
// most likely in intialisers, other places (controller, component...)
// most likely in initializers, other places (controller, component...)
// should be fixed in code
clearAppEventsCache(getOwner(this));
}

View File

@ -538,7 +538,7 @@ discourseModule("Unit | Controller | topic", function (hooks) {
post: placeholder,
}),
null,
"it should work with a post-placehodler"
"it should work with a post-placeholder"
);
});

View File

@ -1602,7 +1602,7 @@ var bar = 'bar';
assert.cookedOptions(" -->asd", enabledTypographer, "<p>&gt;asd</p>");
});
test("default typhographic replacements", function (assert) {
test("default typographic replacements", function (assert) {
const enabledTypographer = {
siteSettings: { enable_markdown_typographer: true },
};
@ -1628,7 +1628,7 @@ var bar = 'bar';
assert.cookedOptions("(pa) (PA)", enabledTypographer, "<p>¶ ¶</p>");
});
test("default typhographic replacements - dashes", function (assert) {
test("default typographic replacements - dashes", function (assert) {
const enabledTypographer = {
siteSettings: { enable_markdown_typographer: true },
};
@ -1663,7 +1663,7 @@ var bar = 'bar';
);
});
test("disabled typhographic replacements", function (assert) {
test("disabled typographic replacements", function (assert) {
const enabledTypographer = {
siteSettings: { enable_markdown_typographer: true },
};

View File

@ -129,7 +129,7 @@ module("Unit | Utility | user-search", function (hooks) {
assert.equal(results[results.length - 1]["name"], "team");
});
test("it skips a search depending on punctuations", async function (assert) {
test("it skips a search depending on punctuation", async function (assert) {
let results;
let skippedTerms = [
"@sam s", // double space is not allowed

View File

@ -47,7 +47,7 @@ discourseModule("Unit | Model | composer", function () {
2,
"handles nested quotes correctly"
);
replyLength("<!-- a commnent -->", 0, "remove comments");
replyLength("<!-- a comment -->", 0, "remove comments");
replyLength(
"<!-- a comment -->\n more text \n<!-- a comment -->",
@ -333,7 +333,7 @@ discourseModule("Unit | Model | composer", function () {
assert.equal(
newComposer().get("replyDirty"),
false,
"replyDirty is initally false with a quote"
"replyDirty is initially false with a quote"
);
});

View File

@ -826,7 +826,7 @@ module("Unit | Model | post-stream", function () {
assert.ok(
postStream.get("lastAppended"),
found,
"comitting a post changes lastAppended"
"committing a post changes lastAppended"
);
});
@ -885,7 +885,7 @@ module("Unit | Model | post-stream", function () {
);
});
test("comitting and triggerNewPostsInStream race condition", function (assert) {
test("committing and triggerNewPostsInStream race condition", function (assert) {
const postStream = buildStream(4964);
const store = postStream.store;

View File

@ -50,7 +50,7 @@ module("Unit | Model | rest-model", function () {
const secondPromise = widget.update({ name: "new name" });
firstPromise.then(function () {
assert.ok(true, "the first promise succeeeds");
assert.ok(true, "the first promise succeeds");
});
secondPromise.catch(function () {
@ -93,7 +93,7 @@ module("Unit | Model | rest-model", function () {
const firstPromise = widget.save({ name: "Evil Widget" });
const secondPromise = widget.save({ name: "Evil Widget" });
firstPromise.then(function () {
assert.ok(true, "the first promise succeeeds");
assert.ok(true, "the first promise succeeds");
});
secondPromise.catch(function () {
@ -127,7 +127,7 @@ module("Unit | Model | rest-model", function () {
//Create
const widget = store.createRecord("my-widget");
await widget.save({ name: "Evil Widget" });
assert.equal(widget.id, 100, "it saved a new record successully");
assert.equal(widget.id, 100, "it saved a new record successfully");
assert.equal(widget.get("name"), "Evil Widget");
// Update

View File

@ -73,7 +73,7 @@ I18n.lookup = function(scope, options) {
return messages;
};
// Merge serveral hash options, checking if value is set before
// Merge several hash options, checking if value is set before
// overwriting any value. The precedence is from left to right.
//
// I18n.prepareOptions({name: "John Doe"}, {name: "Mary Doe", role: "user"});

View File

@ -97,7 +97,7 @@ export function sanitize(text, allowLister) {
}
if (tag === "video" && name === "autoplay") {
// This might give us duplicate 'muted' atttributes
// This might give us duplicate 'muted' attributes
// but they will be deduped by later processing
return "autoplay muted";
}

View File

@ -1,4 +1,4 @@
// special handling for IMG tags on a line by themeselves
// special handling for IMG tags on a line by themselves
// we always have to handle it as so it is an inline
// see: https://talk.commonmark.org/t/newline-and-img-tags/2511

View File

@ -37,7 +37,7 @@ function mentionRegex(unicodeUsernames) {
if (unicodeUsernames) {
try {
// Create the regex from a string, because Babel doesn't understand
// Unicode property escapes and completly mangles the regexp.
// Unicode property escapes and completely mangles the regexp.
const alnum = "\\p{Alphabetic}\\p{Mark}\\p{Decimal_Number}";
return new RegExp(
`@([${alnum}_][${alnum}._-]{0,58}[${alnum}])|@([${alnum}_])`,

View File

@ -20,7 +20,7 @@ function newline(state, silent) {
// ' \n' -> hardbreak
// Lookup in pending chars is bad practice! Don't copy to other rules!
// Pending string is stored in concat mode, indexed lookups will cause
// convertion to flat mode.
// conversion to flat mode.
if (!silent) {
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {

View File

@ -62,7 +62,7 @@ function applyOnebox(state, silent) {
let href = attrs[0][1];
// edge case ... what if this is not http or protocoless?
// edge case ... what if this is not http or protocolless?
if (!/^http|^\/\//i.test(href)) {
continue;
}

View File

@ -225,7 +225,7 @@ export default DropdownSelectBoxComponent.extend({
}
// Edge case: If personal messages are disabled, it is possible to have
// no items which stil renders a button that pops up nothing. In this
// no items which still renders a button that pops up nothing. In this
// case, add an option for what you're currently doing.
if (items.length === 0) {
showCreateTopic = true;

View File

@ -6,7 +6,7 @@
//
// 1. Default Settings
// 2. General styles
// - Transluscent overlay
// - Translucent overlay
// - Containers, wrappers
// - Cursors
// - Helper classes
@ -66,7 +66,7 @@ $use-visuallyhidden: false !default; // Hide content from browsers, but make it
// 2. General styles
////////////////////////
// Transluscent overlay
// Translucent overlay
.mfp-bg {
top: 0;
left: 0;

View File

@ -260,7 +260,7 @@
opacity: 1;
}
// d-editor bar button sizing for all editors - this is kept seprate to keep
// d-editor bar button sizing for all editors - this is kept separate to keep
// everything in one place
.d-editor-button-bar {
margin: 0.25em;

View File

@ -5,7 +5,7 @@
--base-font-size-larger: 1.063em; // eq. to 17px
--base-font-size-largest: 1.118em; // eq. to 19px
// Font-size defintions, multiplier ^ (step / interval)
// Font-size definitions, multiplier ^ (step / interval)
--font-up-6: 2.296em;
--font-up-5: 2em;
--font-up-4: 1.7511em;

View File

@ -50,7 +50,7 @@ $base-font-size-larger: var(--base-font-size-larger) !default;
$base-font-size-largest: var(--base-font-size-largest) !default;
$heading-font-family: var(--heading-font-family) !default;
// Font-size defintions, multiplier ^ (step / interval)
// Font-size definitions, multiplier ^ (step / interval)
$font-up-6: var(--font-up-6) !default;
$font-up-5: var(--font-up-5) !default;
$font-up-4: var(--font-up-4) !default;

View File

@ -326,7 +326,7 @@ class ApplicationController < ActionController::Base
end
# If a controller requires a plugin, it will raise an exception if that plugin is
# disabled. This allows plugins to be disabled programatically.
# disabled. This allows plugins to be disabled programmatically.
def self.requires_plugin(plugin_name)
before_action do
raise PluginDisabled.new if Discourse.disabled_plugin_names.include?(plugin_name)
@ -399,7 +399,7 @@ class ApplicationController < ActionController::Base
@preloaded ||= {}
# I dislike that there is a gsub as opposed to a gsub!
# but we can not be mucking with user input, I wonder if there is a way
# to inject this safty deeper in the library or even in AM serializer
# to inject this safety deeper in the library or even in AM serializer
@preloaded[key] = json.gsub("</", "<\\/")
end

View File

@ -80,7 +80,7 @@ class UsersEmailController < ApplicationController
rate_limit_second_factor!(@user)
if !@error
# this is needed becase the form posts this field as JSON and it can be a
# this is needed because the form posts this field as JSON and it can be a
# hash when authenticating security key.
if params[:second_factor_method].to_i == UserSecondFactor.methods[:security_key]
begin

View File

@ -47,7 +47,7 @@ module UserNotificationsHelper
return result unless result.blank?
# If there is no first paragaph with text, return the first paragraph with
# If there is no first paragraph with text, return the first paragraph with
# something else (an image) or div (a onebox).
doc.css('body > p:not(:empty), body > div:not(:empty), body > p > div.lightbox-wrapper img').first
end

View File

@ -22,7 +22,7 @@ module Jobs
return
end
# this handles deleting the topic timer as wel, see TopicStatusUpdater
# this handles deleting the topic timer as well, see TopicStatusUpdater
topic.update_status('autoclosed', true, user, { silent: silent })
MessageBus.publish("/topic/#{topic.id}", reload_topic: true)

View File

@ -26,7 +26,7 @@ module Jobs
else
# autoclosed, false is just another way of saying open.
# this handles deleting the topic timer as wel, see TopicStatusUpdater
# this handles deleting the topic timer as well, see TopicStatusUpdater
topic.update_status('autoclosed', false, user)
end

View File

@ -257,7 +257,7 @@ module HasCustomFields
end
end
# We support unique indexes on certain fields. In the event two concurrenct processes attempt to
# We support unique indexes on certain fields. In the event two concurrent processes attempt to
# update the same custom field we should catch the error and perform an update instead.
def create_singular(name, value, field_type = nil)
write_value = value.is_a?(Hash) || field_type == :json ? value.to_json : value

View File

@ -240,7 +240,7 @@ class TopicEmbed < ActiveRecord::Base
end
return result unless result.blank?
# If there is no first paragaph, return the first div (onebox)
# If there is no first paragraph, return the first div (onebox)
doc.css('div').first.to_s
end

View File

@ -78,7 +78,7 @@ class TopicLinkClick < ActiveRecord::Base
# Find the forum topic link
link = link.where(post_id: args[:post_id]) if args[:post_id].present?
# If we don't have a post, just find the first occurance of the link
# If we don't have a post, just find the first occurrence of the link
link = link.where(topic_id: args[:topic_id]) if args[:topic_id].present?
link = link.first

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
# this class is used to mirror unread and new status back to end users
# in JavaScript there is a mirror class that is kept in-sync using the mssage bus
# in JavaScript there is a mirror class that is kept in-sync using the massage bus
# the allows end users to always know which topics have unread posts in them
# and which topics are new

View File

@ -303,7 +303,7 @@ class TopicUser < ActiveRecord::Base
threshold: SiteSetting.default_other_auto_track_topics_after_msecs
}
# In case anyone seens "highest_seen_post_number" and gets confused, like I do.
# In case anyone sees "highest_seen_post_number" and gets confused, like I do.
# highest_seen_post_number represents the highest_post_number of the topic when
# the user visited it. It may be out of alignment with last_read, meaning
# ... user visited the topic but did not read the posts

View File

@ -52,7 +52,7 @@ class UserAuthToken < ActiveRecord::Base
return false unless User.find_by(id: user_id)&.staff?
ips = UserAuthTokenLog.where(user_id: user_id).pluck(:client_ip)
ips.delete_at(ips.index(user_ip) || ips.length) # delete one occurance (current)
ips.delete_at(ips.index(user_ip) || ips.length) # delete one occurrence (current)
ips.uniq!
return false if ips.empty? # first login is never suspicious

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
# UserHistory stores information about actions that users have taken,
# like deleting users, changing site settings, dimissing notifications, etc.
# like deleting users, changing site settings, dismissing notifications, etc.
# Use other classes, like StaffActionLogger, to log records to this table.
class UserHistory < ActiveRecord::Base
belongs_to :acting_user, class_name: 'User'

View File

@ -68,7 +68,7 @@ class UserSearch
if @term.present?
exact_matches = scoped_users.where(username_lower: @term)
# don't polute mentions with users who haven't shown up in over a year
# don't pollute mentions with users who haven't shown up in over a year
exact_matches = exact_matches.where('last_seen_at > ?', 1.year.ago) if @topic_id || @category_id
exact_matches

View File

@ -161,7 +161,7 @@ class UserStat < ActiveRecord::Base
X.c <> topics_entered
SQL
# Update denormalzied posts_read_count
# Update denormalized posts_read_count
DB.exec(<<~SQL, seen_at: last_seen)
UPDATE user_stats SET posts_read_count = X.c
FROM

View File

@ -93,7 +93,7 @@ class TopicViewDetailsSerializer < ApplicationSerializer
# NOTE: A Category Group Moderator moving a topic to a different category
# may result in the 'can_edit?' result changing from `true` to `false`.
# Explictly returning a `false` value is required to update the client UI.
# Explicitly returning a `false` value is required to update the client UI.
def can_edit
scope.can_edit?(object.topic)
end

View File

@ -103,7 +103,7 @@ class SearchIndexer
end
def self.update_topics_index(topic_id, title, cooked)
# a bit inconsitent that we use title as A and body as B when in
# a bit inconsistent that we use title as A and body as B when in
# the post index body is D
update_index(
table: 'topic',

View File

@ -93,7 +93,7 @@ module Discourse
require_dependency 'lib/highlight_js/highlight_js'
# we skip it cause we configure it in the initializer
# the railstie for message_bus would insert it in the
# the railtie for message_bus would insert it in the
# wrong position
config.skip_message_bus_middleware = true
config.skip_multisite_middleware = true
@ -138,7 +138,7 @@ module Discourse
config.assets.paths += %W(#{config.root}/config/locales #{config.root}/public/javascripts)
# Allows us to skip minifincation on some files
# Allows us to skip minification on some files
config.assets.skip_minification = []
# explicitly precompile any images in plugins ( /assets/images ) path
@ -292,7 +292,7 @@ module Discourse
# our setup does not use rack cache and instead defers to nginx
config.action_dispatch.rack_cache = nil
# ember stuff only used for asset precompliation, production variant plays up
# ember stuff only used for asset precompilation, production variant plays up
config.ember.variant = :development
config.ember.ember_location = "#{Rails.root}/vendor/assets/javascripts/production/ember.js"
config.ember.handlebars_location = "#{Rails.root}/vendor/assets/javascripts/handlebars.js"

View File

@ -6,7 +6,7 @@ development:
pool: 5
timeout: 5000
checkout_timeout: <%= ENV['CHECKOUT_TIMEOUT'] || 5 %>
advisory_locks: false # Disable until https://github.com/rails/rails/issues/40029 has beeen resolved.
advisory_locks: false # Disable until https://github.com/rails/rails/issues/40029 has been resolved.
host_names:
### Don't include the port number here. Change the "port" site setting instead, at /admin/site_settings.
### If you change this setting you will need to
@ -40,7 +40,7 @@ test:
min_messages: warning
pool: 5
timeout: 5000
advisory_locks: false # Disable until https://github.com/rails/rails/issues/40029 has beeen resolved.
advisory_locks: false # Disable until https://github.com/rails/rails/issues/40029 has been resolved.
host_names:
- test.localhost

View File

@ -173,7 +173,7 @@ message_bus_redis_skip_client_commands = false
enable_cors = false
cors_origin = ''
# enable if you really need to serve assets in prd
# enable if you really need to serve assets in prod
serve_static_assets = false
# number of sidekiq workers (launched via unicorn master)
@ -210,7 +210,7 @@ secret_key_base =
fallback_assets_path =
# S3 settings used for serving ALL public files
# be sure to configre a CDN as well per cdn_url
# be sure to configure a CDN as well per cdn_url
s3_bucket =
s3_region =
s3_access_key_id =
@ -315,7 +315,7 @@ anon_cache_store_threshold = 2
# you may restrict it so only specific themes are approved
# in allowlist mode all theme updates must happen via git repos
# themes missing from the list are automatically disallowed
# list is a comma seperated list of git repos eg:
# list is a comma separated list of git repos eg:
# https://github.com/discourse/discourse-custom-header-links.git,https://github.com/discourse/discourse-simple-theme.git
allowed_theme_repos =

View File

@ -12,7 +12,7 @@ Discourse::Application.configure do
# Configure static asset server for tests with Cache-Control for performance
config.public_file_server.enabled = true
# don't consider reqs local so we can properly handle exceptions like we do in prd
# don't consider reqs local so we can properly handle exceptions like we do in prod
config.consider_all_requests_local = false
# disable caching

View File

@ -5,7 +5,7 @@
# It simply drains all the requests (waits up to 4 seconds) and issues a HUP
# if you need a more sophisticated cycling restart for multiple thins it will need to be written
#
# This works fine for Discourse.org cause we host our app accross multiple machines, if you hosting
# This works fine for Discourse.org cause we host our app across multiple machines, if you hosting
# on a single machine you have a trickier problem at hand as you need to cycle the processes in order
#

View File

@ -9,7 +9,7 @@ upstream discourse {
}
# inactive means we keep stuff around for 1440m minutes regardless of last access (1 week)
# levels means it is a 2 deep heirarchy cause we can have lots of files
# levels means it is a 2 deep hierarchy cause we can have lots of files
# max_size limits the size of the cache
proxy_cache_path /var/nginx/cache inactive=1440m levels=1:2 keys_zone=one:10m max_size=600m;
@ -131,7 +131,7 @@ server {
}
# some minimal caching here so we don't keep asking
# longer term we should increas probably to 1y
# longer term we should increase probably to 1y
location ~ ^/javascripts/ {
expires 1d;
add_header Cache-Control public,immutable;

View File

@ -12,7 +12,7 @@ For a list of recent security commits, check [our GitHub commits prefixed with S
Discourse uses the PBKDF2 algorithm to encrypt salted passwords. This algorithm is blessed by NIST. Security experts on the web [tend to agree that PBKDF2 is a secure choice](https://security.stackexchange.com/questions/4781/do-any-security-experts-recommend-bcrypt-for-password-storage).
**options you can customise in your production.rb file**
**options you can customize in your production.rb file**
- `pbkdf2_algorithm`: the hashing algorithm used (default "sha256")
- `pbkdf2_iterations`: the number of iterations to run (default 64000)
@ -43,7 +43,7 @@ Discourse extends the built-in Rails CSRF protection in the following ways:
2. API calls using the secret API bypass CSRF checks.
3. Certain pages are "cachable", we do not render the CSRF token (`<meta name='csrf-token' ...`) on any cachable pages. Instead when users are about to perform the first non GET request they retrieve the token just in time via `GET session/csrf`
3. Certain pages are "cacheable", we do not render the CSRF token (`<meta name='csrf-token' ...`) on any cacheable pages. Instead when users are about to perform the first non GET request they retrieve the token just in time via `GET session/csrf`
### DDOS

View File

@ -227,7 +227,7 @@ class Autospec::Manager
file, line = line.split(' ')
file = reverse_symlink(file)
file = file.sub(Rails.root.to_s + "/", "")
# process_change can aquire a mutex and block
# process_change can acquire a mutex and block
# the acceptor
Thread.new do
if file =~ /(es6|js)$/

View File

@ -23,7 +23,7 @@ module Autospec
command = begin
line_specified = specs.split.any? { |s| s =~ /\:/ } # Parallel spec can't run specific line
multiple_files = specs.split.count > 1 || specs == "spec" # Only paralellize multiple files
multiple_files = specs.split.count > 1 || specs == "spec" # Only parallelize multiple files
if ENV["PARALLEL_SPEC"] == '1' && multiple_files && !line_specified
"bin/turbo_rspec #{args.join(" ")} #{specs.split.join(" ")}"
else

View File

@ -93,7 +93,7 @@ module BadgeQueries
JOIN post_actions pa1 on pa1.id = x.id
SQL
# Incorrect, but good enough - (earlies post edited vs first edit)
# Incorrect, but good enough - (earliest post edited vs first edit)
Editor = <<~SQL
SELECT p.user_id, min(p.id) post_id, min(p.created_at) granted_at
FROM badge_posts p

View File

@ -14,7 +14,7 @@ module Base62
str = ""
while num > 0
# prepend base62 charaters
# prepend base62 characters
str = KEYS[num % BASE] + str
num = num / BASE
end

View File

@ -32,7 +32,7 @@ module DiscourseTagging
# tag names which are visible, but not usable, by *some users*
readonly_tags = DiscourseTagging.readonly_tag_names(guardian)
# tags names which are not visibile or usuable by this user
# tags names which are not visible or usable by this user
hidden_tags = DiscourseTagging.hidden_tag_names(guardian)
# tag names which ARE permitted by *this user*

View File

@ -93,7 +93,7 @@ module FileStore
begin
parsed_url = URI.parse(UrlHelper.encode(url))
rescue
# There are many exceptions possible here including Addressable::URI:: excpetions
# There are many exceptions possible here including Addressable::URI:: exceptions
# and URI:: exceptions, catch all may seem wide, but it makes no sense to raise ever
# on an invalid url here
return false

View File

@ -19,7 +19,7 @@ module ActiveRecord
BLANK_ARRAY = [].freeze
# this patch just allows everyting in Rails 6
# this patch just allows everything in Rails 6
def disallow_raw_sql!(args, permit: nil)
# we may consider moving to https://github.com/rails/rails/pull/33330
# once all frozen string hints are in place

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#mixin for all guardian methods dealing with category permisions
#mixin for all guardian methods dealing with category permissions
module CategoryGuardian
# Creating Method

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#mixin for all guardian methods dealing with tagging permisions
#mixin for all guardian methods dealing with tagging permissions
module TagGuardian
def can_create_tag?
return is_admin? if SiteSetting.min_trust_to_create_tag.to_s == 'admin'

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
#mixin for all guardian methods dealing with topic permisions
#mixin for all guardian methods dealing with topic permissions
module TopicGuardian
def can_remove_allowed_users?(topic, target_user = nil)

View File

@ -42,7 +42,7 @@ module Imap
if @status[:uid_validity] != @group.imap_uid_validity
# If UID validity changes, the whole mailbox must be synchronized (all
# emails are considered new and will be associated to existent topics
# in Email::Reciever by matching Message-Ids).
# in Email::Receiver by matching Message-Ids).
ImapSyncLog.warn("UIDVALIDITY = #{@status[:uid_validity]} does not match expected #{@group.imap_uid_validity}, invalidating IMAP cache and resyncing emails for mailbox #{@group.imap_mailbox_name}", @group)
@group.imap_last_uid = 0
end

View File

@ -10,7 +10,7 @@
*/
(function ( root ) {
// Create the contructor function
// Create the constructor function
function MessageFormat ( locale, pluralFunc ) {
var fallbackLocale;
@ -133,7 +133,7 @@
var result = {
/*
* Parses the input with a generated parser. If the parsing is successfull,
* Parses the input with a generated parser. If the parsing is successful,
* returns a value explicitly or implicitly specified by the grammar from
* which the parser was generated (see |PEG.buildParser|). If the parsing is
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error.

View File

@ -125,7 +125,7 @@ function mustacheValue(node, state) {
return `${useHelper(state, "iconNode")}(${valueOf(node.params[0])})`;
break;
default:
// Shortcut: If our mustach has hash arguments, we can assume it's attaching.
// Shortcut: If our mustache has hash arguments, we can assume it's attaching.
// For example `{{home-logo count=123}}` can become `this.attach('home-logo, { "count": 123 });`
let hash = node.hash;
if (hash.pairs.length) {

View File

@ -242,7 +242,7 @@ module JsLocaleHelper
return locale_data if locale_data
end
# English should alyways work
# English should always work
["en", File.join(path, "en.js")] if fallback_to_english
end

View File

@ -121,7 +121,7 @@ class LetterAvatar
end
end
# palette of optimally disctinct colors
# palette of optimally distinct colors
# cf. http://tools.medialab.sciences-po.fr/iwanthue/index.php
# parameters used:
# - H: 0 - 360

View File

@ -10,7 +10,7 @@ module Middleware
# enforces hostname to match the hostname of our connection
# this middleware lives after rails multisite so at this point
# Discourse.current_hostname MUST be canonical, enforce it so
# all Rails helpers are guarenteed to use it unconditionally and
# all Rails helpers are guaranteed to use it unconditionally and
# never generate incorrect links
env[Rack::Request::HTTP_X_FORWARDED_HOST] = nil

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
# Note: This logic was originaly extracted from the Pbkdf2 gem to fix Ruby 2.0
# Note: This logic was originally extracted from the Pbkdf2 gem to fix Ruby 2.0
# issues, but that gem has gone stale so we won't be returning to it.
require 'openssl'

View File

@ -591,7 +591,7 @@ class Plugin::Instance
end
end
# note, we need to be able to parse seperately to activation.
# note, we need to be able to parse separately to activation.
# this allows us to present information about a plugin in the UI
# prior to activations
def activate!
@ -816,7 +816,7 @@ class Plugin::Instance
end
# Register a new UserApiKey scope, and its allowed routes. Scope will be prefixed
# with the (parametetized) plugin name followed by a colon.
# with the (parameterized) plugin name followed by a colon.
#
# For example, if discourse-awesome-plugin registered this:
#

View File

@ -127,7 +127,7 @@ class PostActionCreator
end
rescue ActiveRecord::RecordNotUnique
# If the user already performed this action, it's proably due to a different browser tab
# If the user already performed this action, it's probably due to a different browser tab
# or non-debounced clicking. We can ignore.
result.success = true
result.post_action = PostAction.find_by(

View File

@ -32,7 +32,7 @@ class PostCreator
# skip_jobs - Don't enqueue jobs when creation succeeds. This is needed if you
# wrap `PostCreator` in a transaction, as the sidekiq jobs could
# dequeue before the commit finishes. If you do this, be sure to
# call `enqueue_jobs` after the transaction is comitted.
# call `enqueue_jobs` after the transaction is committed.
# hidden_reason_id - Reason for hiding the post (optional)
# skip_validations - Do not validate any of the content in the post
# draft_key - the key of the draft we are creating (will be deleted on success)

View File

@ -10,7 +10,7 @@ class PostJobsEnqueuer
def enqueue_jobs
# We need to enqueue jobs after the transaction.
# Otherwise they might begin before the data has been comitted.
# Otherwise they might begin before the data has been committed.
enqueue_post_alerts unless @opts[:import_mode]
feature_topic_users unless @opts[:import_mode]
trigger_post_post_process

View File

@ -187,7 +187,7 @@ class RateLimiter
# number of events in buffer less than max allowed? OR
(redis.llen(prefixed_key) < @max) ||
# age bigger than silding window size?
# age bigger than sliding window size?
(age_of_oldest(now) >= @secs)
end

View File

@ -76,7 +76,7 @@ class Search
data.force_encoding("UTF-8")
if purpose != :topic
# TODO cppjieba_rb is designed for chinese, we need something else for Japanese
# Korean appears to be safe cause words are already space seperated
# Korean appears to be safe cause words are already space separated
# For Japanese we should investigate using kakasi
if segment_cjk?
require 'cppjieba_rb' unless defined? CppjiebaRb

View File

@ -39,7 +39,7 @@ task "admin:create" => :environment do
email = ask("Email: ")
existing_user = User.find_by_email(email)
# check if user account already exixts
# check if user account already exists
if existing_user
# user already exists, ask for password reset
admin = existing_user

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
# I like guard, don't get me wrong, but it is just not working right
# architectually it can not do what I want it to do, this is how I want
# architecturally it can not do what I want it to do, this is how I want
# it to behave
desc "Run all specs automatically as needed"

View File

@ -8,7 +8,7 @@
# => SKIP_TESTS set to 1 to skip all tests
# => SKIP_CORE set to 1 to skip core tests (rspec and qunit)
# => SKIP_PLUGINS set to 1 to skip plugin tests (rspec and qunit)
# => SKIP_INSTALL_PLUGINS comma seperated list of plugins you want to skip installing
# => SKIP_INSTALL_PLUGINS comma separated list of plugins you want to skip installing
# => INSTALL_OFFICIAL_PLUGINS set to 1 to install all core plugins before running tests
# => RUBY_ONLY set to 1 to skip all qunit tests
# => JS_ONLY set to 1 to skip all rspec tests

View File

@ -111,7 +111,7 @@ task 'emails:test', [:email] => [:environment] do |_, args|
STR
elsif e.to_s.match(/530.*STARTTLS/)
# We can't run a prelimary test with STARTTLS, we'll just try sending the test email.
# We can't run a preliminary test with STARTTLS, we'll just try sending the test email.
message = "OK"
elsif e.to_s.match(/535/)

View File

@ -46,7 +46,7 @@ def gather_uploads
`cp --link '#{source}' '#{destination}'`
end
# ensure file has been succesfuly copied over
# ensure file has been successfully copied over
raise unless file_exists?(destination)
# remap links in db

View File

@ -4,7 +4,7 @@
# Clean up a text
#
# Whe use ActiveSupport mb_chars from here to properly support non ascii downcase
# We use ActiveSupport mb_chars from here to properly support non ascii downcase
require 'active_support/core_ext/string/multibyte'
class TextCleaner

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
# Whe use ActiveSupport mb_chars from here to properly support non ascii downcase
# We use ActiveSupport mb_chars from here to properly support non ascii downcase
# TODO remove when ruby 2.4 lands
require 'active_support/core_ext/string/multibyte'

View File

@ -14,7 +14,7 @@ module TopicQuerySQL
-"CASE WHEN categories.id = #{SiteSetting.uncategorized_category_id.to_i} THEN '' ELSE categories.name END #{dir}"
end
# If you've clearned the pin, use bumped_at, otherwise put it at the top
# If you've cleared the pin, use bumped_at, otherwise put it at the top
def order_with_pinned_sql
-"CASE
WHEN (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))
@ -23,7 +23,7 @@ module TopicQuerySQL
END DESC"
end
# If you've clearned the pin, use bumped_at, otherwise put it at the top
# If you've cleared the pin, use bumped_at, otherwise put it at the top
def order_nocategory_with_pinned_sql
-"CASE
WHEN topics.pinned_globally

Some files were not shown because too many files have changed in this diff Show More