DEV: Move discourse-common/config/environment to discourse/lib (#30738)

This commit is contained in:
David Taylor 2025-01-13 15:29:26 +00:00 committed by GitHub
parent 8535a8595c
commit 98fa42f2e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
97 changed files with 103 additions and 100 deletions

View File

@ -5,11 +5,11 @@ import { next } from "@ember/runloop";
import { isPresent } from "@ember/utils";
import { classNameBindings, classNames } from "@ember-decorators/component";
import discourseComputed from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import { makeArray } from "discourse/lib/helpers";
import ReportLoader from "discourse/lib/reports-loader";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import Report, { DAILY_LIMIT_DAYS, SCHEMA_VERSION } from "admin/models/report";

View File

@ -2,7 +2,7 @@ import Controller from "@ember/controller";
import { action, get } from "@ember/object";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
export default class AdminDashboardReportsController extends Controller {
filter = null;

View File

@ -1,7 +1,7 @@
import { action } from "@ember/object";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
export default class AdminEmailBouncedController extends AdminEmailLogsController {

View File

@ -1,7 +1,7 @@
import { action } from "@ember/object";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
import IncomingEmail from "admin/models/incoming-email";

View File

@ -1,7 +1,7 @@
import { action } from "@ember/object";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
import IncomingEmail from "admin/models/incoming-email";

View File

@ -1,6 +1,6 @@
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
export default class AdminEmailSentController extends AdminEmailLogsController {

View File

@ -1,6 +1,6 @@
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
export default class AdminEmailSkippedController extends AdminEmailLogsController {

View File

@ -3,9 +3,9 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import ScreenedIpAddress from "admin/models/screened-ip-address";

View File

@ -4,8 +4,8 @@ import { or } from "@ember/object/computed";
import { service } from "@ember/service";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
import { clipboardCopy } from "discourse/lib/utilities";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import Permalink from "admin/models/permalink";

View File

@ -4,8 +4,8 @@ import { alias } from "@ember/object/computed";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { debounce } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import SiteSettingFilter from "discourse/lib/site-setting-filter";
import { INPUT_DELAY } from "discourse-common/config/environment";
export default class AdminSiteSettingsController extends Controller {
@service router;

View File

@ -6,7 +6,7 @@ import CanCheckEmailsHelper from "discourse/lib/can-check-emails-helper";
import { computedI18n, setting } from "discourse/lib/computed";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed, { bind } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
import BulkUserDeleteConfirmation from "admin/components/bulk-user-delete-confirmation";
import AdminUser from "admin/models/admin-user";

View File

@ -3,7 +3,7 @@ import EmberObject, { action } from "@ember/object";
import { isEmpty } from "@ember/utils";
import { observes } from "@ember-decorators/object";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
export default class AdminWatchedWordsController extends Controller {
filter = null;

View File

@ -15,9 +15,9 @@ import Application from "@ember/application";
import { VERSION } from "@ember/version";
import require from "require";
import { normalizeEmberEventHandling } from "discourse/lib/ember-events";
import { isTesting } from "discourse/lib/environment";
import { withPluginApi } from "discourse/lib/plugin-api";
import { buildResolver } from "discourse/resolver";
import { isTesting } from "discourse-common/config/environment";
const _pluginCallbacks = [];
let _unhandledThemeErrors = [];

View File

@ -7,8 +7,8 @@ import { buildWaiter } from "@ember/test-waiters";
import { modifier } from "ember-modifier";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import loadAce from "discourse/lib/load-ace-editor";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
const WAITER = buildWaiter("ace-editor");

View File

@ -4,8 +4,8 @@ import { action } from "@ember/object";
import { isEmpty, isPresent } from "@ember/utils";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { debounce } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import { searchForTerm } from "discourse/lib/search";
import { INPUT_DELAY } from "discourse-common/config/environment";
// args:
// topicChangedCallback

View File

@ -6,8 +6,8 @@ import { service } from "@ember/service";
import { classNameBindings } from "@ember-decorators/component";
import { ajax } from "discourse/lib/ajax";
import { debounce } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import LinkLookup from "discourse/lib/link-lookup";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
let _messagesCache = {};

View File

@ -9,8 +9,8 @@ import { lookupCache } from "pretty-text/oneboxer-cache";
import { ajax } from "discourse/lib/ajax";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import putCursorAtEnd from "discourse/lib/put-cursor-at-end";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
@classNames("title-input")

View File

@ -18,6 +18,7 @@ import Toolbar from "discourse/lib/composer/toolbar";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed, { bind } from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
import { isTesting } from "discourse/lib/environment";
import { getRegister } from "discourse/lib/get-owner";
import { hashtagAutocompleteOptions } from "discourse/lib/hashtag-autocomplete";
import { linkSeenHashtagsInContext } from "discourse/lib/hashtag-decorator";
@ -34,7 +35,6 @@ import {
renderUserStatusHtml,
} from "discourse/lib/user-status-on-autocomplete";
import virtualElementFromTextRange from "discourse/lib/virtual-element-from-text-range";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
let _createCallbacks = [];

View File

@ -23,9 +23,9 @@ import {
} from "discourse/lib/body-scroll-lock";
import discourseDebounce from "discourse/lib/debounce";
import { bind } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import { makeArray } from "discourse/lib/helpers";
import { emojiUrlFor } from "discourse/lib/text";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import DiversityMenu from "./diversity-menu";

View File

@ -8,6 +8,7 @@ import { waitForPromise } from "@ember/test-waiters";
import ItsATrap from "@discourse/itsatrap";
import concatClass from "discourse/helpers/concat-class";
import { bind, debounce } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import scrollLock from "discourse/lib/scroll-lock";
import {
@ -16,7 +17,6 @@ import {
} from "discourse/lib/swipe-events";
import { isDocumentRTL } from "discourse/lib/text-direction";
import swipe from "discourse/modifiers/swipe";
import { isTesting } from "discourse-common/config/environment";
import Header from "./header";
let _menuPanelClassesToForceDropdown = [];

View File

@ -4,10 +4,10 @@ import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { waitForPromise } from "@ember/test-waiters";
import { isTesting } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import { isDocumentRTL } from "discourse/lib/text-direction";
import { prefersReducedMotion } from "discourse/lib/utilities";
import { isTesting } from "discourse-common/config/environment";
import closeOnClickOutside from "../../modifiers/close-on-click-outside";
import SidebarHamburgerDropdown from "../sidebar/hamburger-dropdown";

View File

@ -1,10 +1,10 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { isTesting } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import { isDocumentRTL } from "discourse/lib/text-direction";
import { prefersReducedMotion } from "discourse/lib/utilities";
import { isTesting } from "discourse-common/config/environment";
import closeOnClickOutside from "../../modifiers/close-on-click-outside";
import UserMenu from "../user-menu/menu";

View File

@ -4,8 +4,8 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { isTesting } from "discourse/lib/environment";
import { allowsImages } from "discourse/lib/uploads";
import { isTesting } from "discourse-common/config/environment";
export default class AvatarSelectorModal extends Component {
@service currentUser;

View File

@ -7,6 +7,7 @@ import { modifier } from "ember-modifier";
import PostTextSelectionToolbar from "discourse/components/post-text-selection-toolbar";
import discourseDebounce from "discourse/lib/debounce";
import { bind } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import escapeRegExp from "discourse/lib/escape-regexp";
import isElementInViewport from "discourse/lib/is-element-in-viewport";
import toMarkdown from "discourse/lib/to-markdown";
@ -17,7 +18,6 @@ import {
selectedText,
} from "discourse/lib/utilities";
import virtualElementFromTextRange from "discourse/lib/virtual-element-from-text-range";
import { INPUT_DELAY } from "discourse-common/config/environment";
function getQuoteTitle(element) {
const titleEl = element.querySelector(".title");

View File

@ -15,8 +15,8 @@ import dirSpan from "discourse/helpers/dir-span";
import loadingSpinner from "discourse/helpers/loading-spinner";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
import Category from "discourse/models/category";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
class ActionSerializer {

View File

@ -11,7 +11,7 @@ import ConditionalLoadingSpinner from "discourse/components/conditional-loading-
import loadingSpinner from "discourse/helpers/loading-spinner";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
import EditNavigationMenuModal from "./modal";

View File

@ -6,8 +6,8 @@ import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import concatClass from "discourse/helpers/concat-class";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
export default class SoftwareUpdatePrompt extends Component {

View File

@ -5,10 +5,10 @@ import { classNames } from "@ember-decorators/component";
import { on } from "@ember-decorators/object";
import { DELETE_REPLIES_TYPE } from "discourse/components/modal/edit-topic-timer";
import discourseComputed from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { iconHTML } from "discourse/lib/icon-library";
import discourseLater from "discourse/lib/later";
import Category from "discourse/models/category";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
@classNames("topic-timer-info")

View File

@ -5,7 +5,7 @@ import runAfterFramePaint from "discourse/lib/after-frame-paint";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
const HIDE_SIDEBAR_KEY = "sidebar-hidden";

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
export default class GroupsIndexController extends Controller {

View File

@ -22,6 +22,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { BookmarkFormData } from "discourse/lib/bookmark-form-data";
import { resetCachedTopicList } from "discourse/lib/cached-topic-list";
import discourseComputed, { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import discourseLater from "discourse/lib/later";
import { deepMerge } from "discourse/lib/object";
@ -37,7 +38,6 @@ import Composer from "discourse/models/composer";
import Post from "discourse/models/post";
import Topic from "discourse/models/topic";
import TopicTimer from "discourse/models/topic-timer";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
let customPostMessageCallbacks = {};

View File

@ -7,8 +7,8 @@ import CreateInvite from "discourse/components/modal/create-invite";
import CreateInviteBulk from "discourse/components/modal/create-invite-bulk";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed, { debounce } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import Invite from "discourse/models/invite";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
export default class UserInvitedShowController extends Controller {

View File

@ -129,3 +129,6 @@ loaderShim("discourse-common/deprecation-workflow", () =>
importSync("discourse/deprecation-workflow")
);
loaderShim("discourse-common/resolver", () => importSync("discourse/resolver"));
loaderShim("discourse-common/config/environment", () =>
importSync("discourse/lib/environment")
);

View File

@ -1,4 +1,4 @@
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
export function reload() {
if (!isTesting()) {

View File

@ -5,7 +5,7 @@ import { assert, runInDebug } from "@ember/debug";
import { computed, get } from "@ember/object";
import { getOwner } from "@ember/owner";
import { join } from "@ember/runloop";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
function getCurrentRouteInfos(router) {
let routerLib = router._routerMicrolib || router.router;

View File

@ -1,5 +1,5 @@
import { DEBUG } from "@glimmer/env";
import { isDevelopment } from "discourse-common/config/environment";
import { isDevelopment } from "discourse/lib/environment";
const KEY = "discourse__dev_tools";

View File

@ -1,18 +1,18 @@
import { DEBUG } from "@glimmer/env";
import { _backburner } from "@ember/runloop";
import RSVP from "rsvp";
import {
isDevelopment,
isProduction,
isTesting,
setEnvironment,
} from "discourse/lib/environment";
import { setDefaultOwner } from "discourse/lib/get-owner";
import { setupS3CDN, setupURL } from "discourse/lib/get-url";
import { setIconList } from "discourse/lib/icon-library";
import PreloadStore from "discourse/lib/preload-store";
import { setURLContainer } from "discourse/lib/url";
import Session from "discourse/models/session";
import {
isDevelopment,
isProduction,
isTesting,
setEnvironment,
} from "discourse-common/config/environment";
import I18n from "discourse-i18n";
export default {

View File

@ -2,7 +2,7 @@ import * as GlimmerManager from "@glimmer/manager";
import ClassicComponent from "@ember/component";
import deprecated from "discourse/lib/deprecated";
import DiscourseTemplateMap from "discourse/lib/discourse-template-map";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
let THROW_GJS_ERROR = isTesting();

View File

@ -1,8 +1,8 @@
import { later } from "@ember/runloop";
import { extendColorSchemeCookies } from "discourse/lib/color-scheme-picker";
import { isTesting } from "discourse/lib/environment";
import { extendThemeCookie } from "discourse/lib/theme-selector";
import { extendTextSizeCookie } from "discourse/models/user";
import { isTesting } from "discourse-common/config/environment";
const DELAY = isTesting() ? 0 : 5000;

View File

@ -1,9 +1,9 @@
import $ from "jquery";
import { handleLogoff } from "discourse/lib/ajax";
import { isProduction, isTesting } from "discourse/lib/environment";
// Initialize the message bus to receive messages.
import getURL from "discourse/lib/get-url";
import userPresent, { onPresenceChange } from "discourse/lib/user-presence";
import { isProduction, isTesting } from "discourse-common/config/environment";
const LONG_POLL_AFTER_UNSEEN_TIME = 1200000; // 20 minutes

View File

@ -8,13 +8,13 @@ import {
init as initDesktopNotifications,
onNotification as onDesktopNotification,
} from "discourse/lib/desktop-notifications";
import { isTesting } from "discourse/lib/environment";
import {
isPushNotificationsEnabled,
register as registerPushNotifications,
unsubscribe as unsubscribePushNotifications,
} from "discourse/lib/push-notifications";
import Notification from "discourse/models/notification";
import { isTesting } from "discourse-common/config/environment";
class SubscribeUserNotificationsInit {
@service currentUser;

View File

@ -1,12 +1,12 @@
import { run } from "@ember/runloop";
import $ from "jquery";
import { Promise } from "rsvp";
import { isTesting } from "discourse/lib/environment";
import getURL from "discourse/lib/get-url";
import userPresent from "discourse/lib/user-presence";
import Session from "discourse/models/session";
import Site from "discourse/models/site";
import User from "discourse/models/user";
import { isTesting } from "discourse-common/config/environment";
let _trackView = false;
let _topicId = null;

View File

@ -2,12 +2,12 @@ import { cancel } from "@ember/runloop";
import { createPopper } from "@popperjs/core";
import $ from "jquery";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
import { iconHTML } from "discourse/lib/icon-library";
import discourseLater from "discourse/lib/later";
import { isDocumentRTL } from "discourse/lib/text-direction";
import { TextareaAutocompleteHandler } from "discourse/lib/textarea-text-manipulation";
import Site from "discourse/models/site";
import { INPUT_DELAY } from "discourse-common/config/environment";
/**
This is a jQuery plugin to support autocompleting values in our text fields.

View File

@ -4,10 +4,10 @@ import { ajax } from "discourse/lib/ajax";
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
import { SEPARATOR } from "discourse/lib/category-hashtags";
import discourseDebounce from "discourse/lib/debounce";
import { isTesting } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import { TAG_HASHTAG_POSTFIX } from "discourse/lib/tag-hashtags";
import Category from "discourse/models/category";
import { isTesting } from "discourse-common/config/environment";
let cache = {};
let cacheTime;

View File

@ -2,12 +2,12 @@ import jQuery from "jquery";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import deprecated from "discourse/lib/deprecated";
import { isTesting } from "discourse/lib/environment";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import getURL, { samePrefix } from "discourse/lib/get-url";
import { wantsNewWindow } from "discourse/lib/intercept-click";
import DiscourseURL from "discourse/lib/url";
import User from "discourse/models/user";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
export function isValidLink(link) {

View File

@ -1,5 +1,5 @@
import { debounce } from "@ember/runloop";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
/**
Debounce a Javascript function. This means if it's called many times in a time limit it

View File

@ -1,7 +1,7 @@
import EmberObject from "@ember/object";
import Evented from "@ember/object/evented";
import $ from "jquery";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
let _skipUpdate;
let _rootElement;

View File

@ -3,12 +3,12 @@ import { htmlSafe } from "@ember/template";
import { ajax } from "discourse/lib/ajax";
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY, isTesting } from "discourse/lib/environment";
import { getHashtagTypeClasses as getHashtagTypeClassesNew } from "discourse/lib/hashtag-type-registry";
import discourseLater from "discourse/lib/later";
import { findRawTemplate } from "discourse/lib/raw-templates";
import { emojiUnescape } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
import { INPUT_DELAY, isTesting } from "discourse-common/config/environment";
/**
* Sets up a textarea using the jQuery autocomplete plugin, specifically

View File

@ -1,8 +1,8 @@
import { DEBUG } from "@glimmer/env";
import { waitForPromise } from "@ember/test-waiters";
import { isTesting } from "discourse/lib/environment";
import { getURLWithCDN } from "discourse/lib/get-url";
import mergeHTMLPlugin from "discourse/lib/highlight-syntax-merge-html-plugin";
import { isTesting } from "discourse-common/config/environment";
let _moreLanguages = [];
let _plugins = [];

View File

@ -1,8 +1,8 @@
import { h } from "virtual-dom";
import attributeHook from "discourse/lib/attribute-hook";
import deprecated from "discourse/lib/deprecated";
import { isDevelopment } from "discourse/lib/environment";
import escape from "discourse/lib/escape";
import { isDevelopment } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
export const SVG_NAMESPACE = "http://www.w3.org/2000/svg";

View File

@ -1,4 +1,4 @@
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
const TEST_KEY_PREFIX = "__test_";

View File

@ -2,6 +2,7 @@ import { getOwner, setOwner } from "@ember/owner";
import { run, throttle } from "@ember/runloop";
import { ajax } from "discourse/lib/ajax";
import domUtils from "discourse/lib/dom-utils";
import { INPUT_DELAY } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import { headerOffset } from "discourse/lib/offset-calculator";
import {
@ -11,7 +12,6 @@ import {
import DiscourseURL from "discourse/lib/url";
import Composer from "discourse/models/composer";
import { capabilities } from "discourse/services/capabilities";
import { INPUT_DELAY } from "discourse-common/config/environment";
let disabledBindings = [];
export function disableDefaultKeyboardShortcuts(bindings) {

View File

@ -1,5 +1,5 @@
import { later } from "@ember/runloop";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
export default function () {
if (isTesting() && typeof [...arguments].at(-1) === "number") {

View File

@ -1,6 +1,7 @@
import $ from "jquery";
import { spinnerHTML } from "discourse/helpers/loading-spinner";
import deprecated from "discourse/lib/deprecated";
import { isTesting } from "discourse/lib/environment";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import { helperContext } from "discourse/lib/helpers";
import { renderIcon } from "discourse/lib/icon-library";
@ -11,7 +12,6 @@ import {
postRNWebviewMessage,
} from "discourse/lib/utilities";
import User from "discourse/models/user";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
export async function setupLightboxes({ container, selector }) {

View File

@ -1,4 +1,4 @@
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
export const ANIMATION_DURATION =
isTesting() || window.matchMedia("(prefers-reduced-motion: reduce)").matches

View File

@ -1,7 +1,7 @@
import { isEmpty } from "@ember/utils";
import { isTesting } from "discourse/lib/environment";
import getURL from "discourse/lib/get-url";
import { helperContext } from "discourse/lib/helpers";
import { isTesting } from "discourse-common/config/environment";
export default function logout({ redirect } = {}) {
if (isTesting()) {

View File

@ -1,5 +1,5 @@
import $ from "jquery";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
let mobileForced = false;

View File

@ -68,6 +68,7 @@ import { addPopupMenuOption } from "discourse/lib/composer/custom-popup-menu-opt
import deprecated from "discourse/lib/deprecated";
import { registerDesktopNotificationHandler } from "discourse/lib/desktop-notifications";
import { downloadCalendar } from "discourse/lib/download-calendar";
import { isTesting } from "discourse/lib/environment";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import { registerHashtagType } from "discourse/lib/hashtag-type-registry";
import {
@ -159,7 +160,6 @@ import {
queryRegistry,
reopenWidget,
} from "discourse/widgets/widget";
import { isTesting } from "discourse-common/config/environment";
import { addImageWrapperButton } from "discourse-markdown-it/features/image-controls";
import { CUSTOM_USER_SEARCH_OPTIONS } from "select-kit/components/user-chooser";
import { modifySelectKit } from "select-kit/mixins/plugin-api";

View File

@ -1,5 +1,5 @@
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
// common max animation time in ms for swipe events for swipe end
// prefers reduced motion and tests return 0

View File

@ -4,6 +4,7 @@ import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import $ from "jquery";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import escapeRegExp from "discourse/lib/escape-regexp";
import putCursorAtEnd from "discourse/lib/put-cursor-at-end";
import { generateLinkifyFunction } from "discourse/lib/text";
@ -16,7 +17,6 @@ import {
inCodeBlock,
setCaretPosition,
} from "discourse/lib/utilities";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
const INDENT_DIRECTION_LEFT = "left";

View File

@ -1,11 +1,11 @@
import { DEBUG } from "@glimmer/env";
import { capitalize } from "@ember/string";
import { isTesting } from "discourse/lib/environment";
import { consolePrefix } from "discourse/lib/source-identifier";
import {
BEHAVIOR_TRANSFORMERS,
VALUE_TRANSFORMERS,
} from "discourse/lib/transformer/registry";
import { isTesting } from "discourse-common/config/environment";
const CORE_TRANSFORMER = "CORE";
const PLUGIN_TRANSFORMER = "PLUGIN";

View File

@ -1,7 +1,7 @@
import { warn } from "@ember/debug";
import { BasePlugin } from "@uppy/core";
import { Promise } from "rsvp";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
export class UppyPluginBase extends BasePlugin {
constructor(uppy, opts) {

View File

@ -4,13 +4,13 @@ import { setOwner } from "@ember/owner";
import { next, schedule } from "@ember/runloop";
import { isEmpty } from "@ember/utils";
import $ from "jquery";
import { isTesting } from "discourse/lib/environment";
import getURL, { withoutPrefix } from "discourse/lib/get-url";
import LockOn from "discourse/lib/lock-on";
import offsetCalculator from "discourse/lib/offset-calculator";
import { defaultHomepage } from "discourse/lib/utilities";
import Category from "discourse/models/category";
import Session from "discourse/models/session";
import { isTesting } from "discourse-common/config/environment";
const rewrites = [];
export const TOPIC_URL_REGEXP = /\/t\/([^\/]*[^\d\/][^\/]*)\/(\d+)\/?(\d+)?/;

View File

@ -1,4 +1,4 @@
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
const callbacks = [];

View File

@ -4,10 +4,10 @@ import { ajax } from "discourse/lib/ajax";
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
import { camelCaseToSnakeCase } from "discourse/lib/case-converter";
import discourseDebounce from "discourse/lib/debounce";
import { isTesting } from "discourse/lib/environment";
import discourseLater from "discourse/lib/later";
import { userPath } from "discourse/lib/url";
import { emailValid } from "discourse/lib/utilities";
import { isTesting } from "discourse-common/config/environment";
let cache = {},
cacheKey,

View File

@ -1,4 +1,4 @@
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
// return true when the browser viewport is zoomed
export default function isZoomed() {

View File

@ -1,7 +1,7 @@
import EmbroiderRouter from "@embroider/router";
import { isTesting } from "discourse/lib/environment";
import getURL from "discourse/lib/get-url";
import Site from "discourse/models/site";
import { isTesting } from "discourse-common/config/environment";
import applyRouterHomepageOverrides from "./lib/homepage-router-overrides";
class BareRouter extends EmbroiderRouter {

View File

@ -1,6 +1,6 @@
import { scheduleOnce } from "@ember/runloop";
import { isTesting } from "discourse/lib/environment";
import DiscourseURL from "discourse/lib/url";
import { isTesting } from "discourse-common/config/environment";
const context = {
_scrollTop() {

View File

@ -6,6 +6,7 @@ import { htmlSafe } from "@ember/template";
import { isEmpty } from "@ember/utils";
import discourseComputed from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
import { isRailsTesting, isTesting } from "discourse/lib/environment";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import PreloadStore from "discourse/lib/preload-store";
import { needsHbrTopicList } from "discourse/lib/raw-templates";
@ -15,7 +16,6 @@ import Category from "discourse/models/category";
import PostActionType from "discourse/models/post-action-type";
import RestModel from "discourse/models/rest";
import TrustLevel from "discourse/models/trust-level";
import { isRailsTesting, isTesting } from "discourse-common/config/environment";
@singleton
export default class Site extends RestModel {

View File

@ -16,6 +16,7 @@ import { url } from "discourse/lib/computed";
import cookie, { removeCookie } from "discourse/lib/cookie";
import discourseComputed from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
import { isTesting } from "discourse/lib/environment";
import { longDate } from "discourse/lib/formatter";
import { getOwnerWithFallback } from "discourse/lib/get-owner";
import getURL, { getURLWithCDN } from "discourse/lib/get-url";
@ -38,7 +39,6 @@ import UserBadge from "discourse/models/user-badge";
import UserDraftsStream from "discourse/models/user-drafts-stream";
import UserPostsStream from "discourse/models/user-posts-stream";
import UserStream from "discourse/models/user-stream";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
export const SECOND_FACTOR_METHODS = {

View File

@ -2,10 +2,10 @@ import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { isTesting } from "discourse/lib/environment";
import DiscourseURL from "discourse/lib/url";
import Draft from "discourse/models/draft";
import DiscourseRoute from "discourse/routes/discourse";
import { isTesting } from "discourse-common/config/environment";
// This route is used for retrieving a topic based on params
export default class TopicFromParams extends DiscourseRoute {

View File

@ -19,6 +19,7 @@ import { customPopupMenuOptions } from "discourse/lib/composer/custom-popup-menu
import discourseDebounce from "discourse/lib/debounce";
import discourseComputed from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
import { isTesting } from "discourse/lib/environment";
import prepareFormTemplateData, {
getFormTemplateObject,
} from "discourse/lib/form-template-validation";
@ -45,7 +46,6 @@ import Composer, {
SAVE_LABELS,
} from "discourse/models/composer";
import Draft from "discourse/models/draft";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
async function loadDraft(store, opts = {}) {

View File

@ -3,8 +3,8 @@ import { cached } from "@glimmer/tracking";
import Service, { service } from "@ember/service";
import { TrackedMap } from "@ember-compat/tracked-built-ins";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import { isTesting } from "discourse-common/config/environment";
const HISTORY_SIZE = 100;
const HISTORIC_KEY = Symbol("historic");

View File

@ -6,6 +6,7 @@ import Service, { service } from "@ember/service";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import getURL from "discourse/lib/get-url";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import discourseLater from "discourse/lib/later";
@ -14,7 +15,6 @@ import userPresent, {
removeOnPresenceChange,
} from "discourse/lib/user-presence";
import User from "discourse/models/user";
import { isTesting } from "discourse-common/config/environment";
const PRESENCE_INTERVAL_S = 30;
const DEFAULT_PRESENCE_DEBOUNCE_MS = isTesting() ? 0 : 500;

View File

@ -1,8 +1,8 @@
import { next, schedule } from "@ember/runloop";
import Service, { service } from "@ember/service";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import { isTesting } from "discourse-common/config/environment";
const STORE_KEY = Symbol("scroll-location");

View File

@ -2,13 +2,13 @@ import { run } from "@ember/runloop";
import Service, { service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import {
getHighestReadCache,
resetHighestReadCache,
setHighestReadCache,
} from "discourse/lib/topic-list-tracker";
import { isTesting } from "discourse-common/config/environment";
// We use this class to track how long posts in a topic are on the screen.
const PAUSE_UNLESS_SCROLLED = 1000 * 60 * 3;

View File

@ -1,8 +1,8 @@
import Service, { service } from "@ember/service";
import { TrackedSet } from "@ember-compat/tracked-built-ins";
import discourseDebounce from "discourse/lib/debounce";
import { isTesting } from "discourse/lib/environment";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import { isTesting } from "discourse-common/config/environment";
@disableImplicitInjections
export default class UserTips extends Service {

View File

@ -1,8 +1,8 @@
import { cancel, scheduleOnce } from "@ember/runloop";
import { diff, patch } from "virtual-dom";
import DirtyKeys from "discourse/lib/dirty-keys";
import { isTesting } from "discourse/lib/environment";
import { queryRegistry, traverseCustomWidgets } from "discourse/widgets/widget";
import { isTesting } from "discourse-common/config/environment";
export default class WidgetGlue {
constructor(name, register, attrs) {

View File

@ -7,6 +7,7 @@ import { dateNode } from "discourse/helpers/node";
import autoGroupFlairForUser from "discourse/lib/avatar-flair";
import { avatarUrl, translateSize } from "discourse/lib/avatar-utils";
import { registerDeprecationHandler } from "discourse/lib/deprecated";
import { isTesting } from "discourse/lib/environment";
import { relativeAgeMediumSpan } from "discourse/lib/formatter";
import getURL, { getAbsoluteURL, getURLWithCDN } from "discourse/lib/get-url";
import { iconNode } from "discourse/lib/icon-library";
@ -27,7 +28,6 @@ import { postTransformCallbacks } from "discourse/widgets/post-stream";
import RawHtml from "discourse/widgets/raw-html";
import RenderGlimmer from "discourse/widgets/render-glimmer";
import { applyDecorators, createWidget } from "discourse/widgets/widget";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
function transformWithCallbacks(post, topicUrl, store) {

View File

@ -3,6 +3,7 @@ import { getOwner, setOwner } from "@ember/owner";
import { camelize } from "@ember/string";
import { Promise } from "rsvp";
import { h } from "virtual-dom";
import { isProduction } from "discourse/lib/environment";
import { deepMerge } from "discourse/lib/object";
import { consolePrefix } from "discourse/lib/source-identifier";
import DecoratorHelper from "discourse/widgets/decorator-helper";
@ -25,7 +26,6 @@ import {
WidgetTouchMoveHook,
WidgetTouchStartHook,
} from "discourse/widgets/hooks";
import { isProduction } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
const _registry = {};

View File

@ -1,2 +1,2 @@
require("discourse-common/config/environment").setEnvironment("qunit-testing");
require("discourse/lib/environment").setEnvironment("qunit-testing");
require("discourse/tests/test-boot-ember-cli");

View File

@ -1,5 +1,5 @@
import Component from "@glimmer/component";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
export default class DFloatPortal extends Component {
get inline() {

View File

@ -9,7 +9,7 @@ import { and } from "truth-helpers";
import DButton from "discourse/components/d-button";
import DModal from "discourse/components/d-modal";
import concatClass from "discourse/helpers/concat-class";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
import DFloatBody from "float-kit/components/d-float-body";
import { MENU } from "float-kit/lib/constants";
import DMenuInstance from "float-kit/lib/d-menu-instance";

View File

@ -7,9 +7,9 @@ import {
shift,
} from "@floating-ui/dom";
import domFromString from "discourse/lib/dom-from-string";
import { isTesting } from "discourse/lib/environment";
import { iconHTML } from "discourse/lib/icon-library";
import { headerOffset } from "discourse/lib/offset-calculator";
import { isTesting } from "discourse-common/config/environment";
import { FLOAT_UI_PLACEMENTS } from "float-kit/lib/constants";
const centerOffset = offset(({ rects }) => {

View File

@ -2,13 +2,13 @@ import { action, computed } from "@ember/object";
import { classNames } from "@ember-decorators/component";
import $ from "jquery";
import { ajax } from "discourse/lib/ajax";
import { isDevelopment } from "discourse/lib/environment";
import { makeArray } from "discourse/lib/helpers";
import {
convertIconClass,
disableMissingIconWarning,
enableMissingIconWarning,
} from "discourse/lib/icon-library";
import { isDevelopment } from "discourse-common/config/environment";
import FilterForMore from "select-kit/components/filter-for-more";
import MultiSelectComponent from "select-kit/components/multi-select";
import {

View File

@ -14,8 +14,8 @@ import { Promise } from "rsvp";
import discourseDebounce from "discourse/lib/debounce";
import { bind as bindDecorator } from "discourse/lib/decorators";
import deprecated from "discourse/lib/deprecated";
import { INPUT_DELAY } from "discourse/lib/environment";
import { makeArray } from "discourse/lib/helpers";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import {
applyContentPluginApiCallbacks,

View File

@ -10,7 +10,7 @@ import { eq } from "truth-helpers";
import DButton from "discourse/components/d-button";
import FilterInput from "discourse/components/filter-input";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
import List from "discourse/plugins/chat/discourse/components/chat/list";
import ChatModalNewMessage from "discourse/plugins/chat/discourse/components/chat/modal/new-message";

View File

@ -4,8 +4,8 @@ import { action } from "@ember/object";
import { modifier } from "ember-modifier";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
import isElementInViewport from "discourse/lib/is-element-in-viewport";
import { INPUT_DELAY } from "discourse-common/config/environment";
import EmptyState from "./empty-state";
import Item from "./item";

View File

@ -4,7 +4,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
import ChatablesLoader from "./lib/chatables-loader";
import List from "./list";

View File

@ -7,7 +7,7 @@ import { service } from "@ember/service";
import DButton from "discourse/components/d-button";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { INPUT_DELAY } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
import { MODES } from "./constants";
import ChatablesLoader from "./lib/chatables-loader";

View File

@ -8,10 +8,10 @@ import { service } from "@ember/service";
import { modifier } from "ember-modifier";
import FilterInput from "discourse/components/filter-input";
import discourseDebounce from "discourse/lib/debounce";
import { INPUT_DELAY } from "discourse/lib/environment";
import isElementInViewport from "discourse/lib/is-element-in-viewport";
import DiscourseURL, { userPath } from "discourse/lib/url";
import autoFocus from "discourse/modifiers/auto-focus";
import { INPUT_DELAY } from "discourse-common/config/environment";
import icon from "discourse-common/helpers/d-icon";
import { i18n } from "discourse-i18n";
import MessageCreator from "discourse/plugins/chat/discourse/components/chat/message-creator";

View File

@ -6,8 +6,8 @@ import { not, or } from "truth-helpers";
import DButton from "discourse/components/d-button";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bind } from "discourse/lib/decorators";
import { isTesting } from "discourse/lib/environment";
import { clipboardCopyAsync } from "discourse/lib/utilities";
import { isTesting } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import DeleteMessagesConfirm from "discourse/plugins/chat/discourse/components/chat/modal/delete-messages-confirm";
import ChatModalMoveMessageToChannel from "discourse/plugins/chat/discourse/components/chat/modal/move-message-to-channel";

View File

@ -3,7 +3,7 @@ import { action } from "@ember/object";
import { service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import discourseComputed from "discourse/lib/decorators";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";
import { CHAT_SOUNDS } from "discourse/plugins/chat/discourse/services/chat-audio-manager";

View File

@ -1,6 +1,6 @@
import Service from "@ember/service";
import { isTesting } from "discourse/lib/environment";
import { getURLWithCDN } from "discourse/lib/get-url";
import { isTesting } from "discourse-common/config/environment";
export const CHAT_SOUNDS = {
bell: [{ src: "/plugins/chat/audio/bell.mp3", type: "audio/mpeg" }],

View File

@ -4,7 +4,7 @@ import {
alertChannel,
onNotification as onDesktopNotification,
} from "discourse/lib/desktop-notifications";
import { isTesting } from "discourse-common/config/environment";
import { isTesting } from "discourse/lib/environment";
export default class ChatNotificationManager extends Service {
@service chat;

View File

@ -5,9 +5,9 @@ import { schedule } from "@ember/runloop";
import { observes } from "@ember-decorators/object";
import { propertyNotEqual } from "discourse/lib/computed";
import computed, { debounce } from "discourse/lib/decorators";
import { INPUT_DELAY } from "discourse/lib/environment";
import { applyLocalDates } from "discourse/lib/local-dates";
import { cook } from "discourse/lib/text";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { i18n } from "discourse-i18n";
import generateDateMarkup from "discourse/plugins/discourse-local-dates/lib/local-date-markup-generator";