Move more modules from flavours/glitch/utils to flavours/glitch

This commit is contained in:
Claire 2022-10-11 11:39:52 +02:00
parent 2535ec4fcb
commit b75bf336bd
42 changed files with 36 additions and 36 deletions

View File

@ -3,7 +3,7 @@ import { CancelToken, isCancel } from 'axios';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import { search as emojiSearch } from 'flavours/glitch/utils/emoji/emoji_mart_search_light'; import { search as emojiSearch } from 'flavours/glitch/utils/emoji/emoji_mart_search_light';
import { useEmoji } from './emojis'; import { useEmoji } from './emojis';
import { tagHistory } from 'flavours/glitch/utils/settings'; import { tagHistory } from '../settings';
import { recoverHashtags } from 'flavours/glitch/utils/hashtag'; import { recoverHashtags } from 'flavours/glitch/utils/hashtag';
import resizeImage from 'flavours/glitch/utils/resize_image'; import resizeImage from 'flavours/glitch/utils/resize_image';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer';

View File

@ -1,6 +1,6 @@
import api from '../api'; import api from '../api';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from '../compare_id';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST'; export const MARKERS_FETCH_REQUEST = 'MARKERS_FETCH_REQUEST';

View File

@ -13,7 +13,7 @@ import { defineMessages } from 'react-intl';
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import { unescapeHTML } from 'flavours/glitch/utils/html'; import { unescapeHTML } from 'flavours/glitch/utils/html';
import { usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state'; import { usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from 'flavours/glitch/compare_id';
import { requestNotificationPermission } from 'flavours/glitch/utils/notifications'; import { requestNotificationPermission } from 'flavours/glitch/utils/notifications';
export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE';

View File

@ -1,5 +1,5 @@
import api from '../../api'; import api from '../../api';
import { pushNotificationsSetting } from 'flavours/glitch/utils/settings'; import { pushNotificationsSetting } from '../../settings';
import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; import { setBrowserSupport, setSubscription, clearSubscription } from './setter';
// Taken from https://www.npmjs.com/package/web-push // Taken from https://www.npmjs.com/package/web-push

View File

@ -1,6 +1,6 @@
// @ts-check // @ts-check
import { connectStream } from 'flavours/glitch/utils/stream'; import { connectStream } from '../stream';
import { import {
updateTimeline, updateTimeline,
deleteFromTimelines, deleteFromTimelines,

View File

@ -2,7 +2,7 @@ import { importFetchedStatus, importFetchedStatuses } from './importer';
import { submitMarkers } from './markers'; import { submitMarkers } from './markers';
import api, { getLinks } from 'flavours/glitch/api'; import api, { getLinks } from 'flavours/glitch/api';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from 'flavours/glitch/compare_id';
import { me, usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state'; import { me, usePendingItems as preferPendingItems } from 'flavours/glitch/initial_state';
import { toServerSideType } from 'flavours/glitch/utils/filters'; import { toServerSideType } from 'flavours/glitch/utils/filters';

View File

@ -5,7 +5,7 @@ import includes from 'array-includes';
import assign from 'object-assign'; import assign from 'object-assign';
import values from 'object.values'; import values from 'object.values';
import isNaN from 'is-nan'; import isNaN from 'is-nan';
import { decode as decodeBase64 } from './base64'; import { decode as decodeBase64 } from './utils/base64';
import promiseFinally from 'promise.prototype.finally'; import promiseFinally from 'promise.prototype.finally';
if (!Array.prototype.includes) { if (!Array.prototype.includes) {

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { supportsPassiveEvents } from 'detect-passive-events'; import { supportsPassiveEvents } from 'detect-passive-events';
import { scrollTop } from 'flavours/glitch/utils/scroll'; import { scrollTop } from '../scroll';
export default class Column extends React.PureComponent { export default class Column extends React.PureComponent {

View File

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import { is } from 'immutable'; import { is } from 'immutable';
import IconButton from './icon_button'; import IconButton from './icon_button';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { isIOS } from 'flavours/glitch/utils/is_mobile'; import { isIOS } from '../is_mobile';
import classNames from 'classnames'; import classNames from 'classnames';
import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
import { debounce } from 'lodash'; import { debounce } from 'lodash';

View File

@ -2,7 +2,7 @@ import { openDropdownMenu, closeDropdownMenu } from 'flavours/glitch/actions/dro
import { openModal, closeModal } from 'flavours/glitch/actions/modal'; import { openModal, closeModal } from 'flavours/glitch/actions/modal';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import DropdownMenu from 'flavours/glitch/components/dropdown_menu'; import DropdownMenu from 'flavours/glitch/components/dropdown_menu';
import { isUserTouching } from 'flavours/glitch/utils/is_mobile'; import { isUserTouching } from '../is_mobile';
const mapStateToProps = state => ({ const mapStateToProps = state => ({
dropdownPlacement: state.getIn(['dropdown_menu', 'placement']), dropdownPlacement: state.getIn(['dropdown_menu', 'placement']),

View File

@ -2,7 +2,7 @@ import Blurhash from 'flavours/glitch/components/blurhash';
import classNames from 'classnames'; import classNames from 'classnames';
import Icon from 'flavours/glitch/components/icon'; import Icon from 'flavours/glitch/components/icon';
import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state'; import { autoPlayGif, displayMedia, useBlurhash } from 'flavours/glitch/initial_state';
import { isIOS } from 'flavours/glitch/utils/is_mobile'; import { isIOS } from 'flavours/glitch/is_mobile';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';

View File

@ -9,7 +9,7 @@ import EmojiPicker from 'flavours/glitch/features/emoji_picker';
import PollFormContainer from '../containers/poll_form_container'; import PollFormContainer from '../containers/poll_form_container';
import UploadFormContainer from '../containers/upload_form_container'; import UploadFormContainer from '../containers/upload_form_container';
import WarningContainer from '../containers/warning_container'; import WarningContainer from '../containers/warning_container';
import { isMobile } from 'flavours/glitch/utils/is_mobile'; import { isMobile } from 'flavours/glitch/is_mobile';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { countableText } from '../util/counter'; import { countableText } from '../util/counter';
import OptionsContainer from '../containers/options_container'; import OptionsContainer from '../containers/options_container';

View File

@ -9,7 +9,7 @@ import IconButton from 'flavours/glitch/components/icon_button';
import DropdownMenu from './dropdown_menu'; import DropdownMenu from './dropdown_menu';
// Utils. // Utils.
import { isUserTouching } from 'flavours/glitch/utils/is_mobile'; import { isUserTouching } from 'flavours/glitch/is_mobile';
import { assignHandlers } from 'flavours/glitch/utils/react_helpers'; import { assignHandlers } from 'flavours/glitch/utils/react_helpers';
// The component. // The component.

View File

@ -6,7 +6,7 @@ import spring from 'react-motion/lib/spring';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import Icon from 'flavours/glitch/components/icon'; import Icon from 'flavours/glitch/components/icon';
import { isUserTouching } from 'flavours/glitch/utils/is_mobile'; import { isUserTouching } from 'flavours/glitch/is_mobile';
export default class Upload extends ImmutablePureComponent { export default class Upload extends ImmutablePureComponent {

View File

@ -26,7 +26,7 @@ import { debounce } from 'lodash';
import ScrollableList from 'flavours/glitch/components/scrollable_list'; import ScrollableList from 'flavours/glitch/components/scrollable_list';
import LoadGap from 'flavours/glitch/components/load_gap'; import LoadGap from 'flavours/glitch/components/load_gap';
import Icon from 'flavours/glitch/components/icon'; import Icon from 'flavours/glitch/components/icon';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from 'flavours/glitch/compare_id';
import NotificationsPermissionBanner from './components/notifications_permission_banner'; import NotificationsPermissionBanner from './components/notifications_permission_banner';
import NotSignedInIndicator from 'flavours/glitch/components/not_signed_in_indicator'; import NotSignedInIndicator from 'flavours/glitch/components/not_signed_in_indicator';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';

View File

@ -2,8 +2,8 @@ import React from 'react';
import ColumnHeader from './column_header'; import ColumnHeader from './column_header';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { scrollTop } from 'flavours/glitch/utils/scroll'; import { scrollTop } from 'flavours/glitch/scroll';
import { isMobile } from 'flavours/glitch/utils/is_mobile'; import { isMobile } from 'flavours/glitch/is_mobile';
export default class Column extends React.PureComponent { export default class Column extends React.PureComponent {

View File

@ -32,7 +32,7 @@ import ComposePanel from './compose_panel';
import NavigationPanel from './navigation_panel'; import NavigationPanel from './navigation_panel';
import { supportsPassiveEvents } from 'detect-passive-events'; import { supportsPassiveEvents } from 'detect-passive-events';
import { scrollRight } from 'flavours/glitch/utils/scroll'; import { scrollRight } from 'flavours/glitch/scroll';
const componentMap = { const componentMap = {
'COMPOSE': Compose, 'COMPOSE': Compose,

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { NavLink, withRouter } from 'react-router-dom'; import { NavLink, withRouter } from 'react-router-dom';
import { FormattedMessage, injectIntl } from 'react-intl'; import { FormattedMessage, injectIntl } from 'react-intl';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { isUserTouching } from 'flavours/glitch/utils/is_mobile'; import { isUserTouching } from 'flavours/glitch/is_mobile';
import Icon from 'flavours/glitch/components/icon'; import Icon from 'flavours/glitch/components/icon';
import NotificationsCounterIcon from './notifications_counter_icon'; import NotificationsCounterIcon from './notifications_counter_icon';

View File

@ -5,7 +5,7 @@ import LoadingBarContainer from './containers/loading_bar_container';
import ModalContainer from './containers/modal_container'; import ModalContainer from './containers/modal_container';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Redirect, withRouter } from 'react-router-dom'; import { Redirect, withRouter } from 'react-router-dom';
import { layoutFromWindow } from 'flavours/glitch/utils/is_mobile'; import { layoutFromWindow } from 'flavours/glitch/is_mobile';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { uploadCompose, resetCompose, changeComposeSpoilerness } from 'flavours/glitch/actions/compose'; import { uploadCompose, resetCompose, changeComposeSpoilerness } from 'flavours/glitch/actions/compose';
import { expandHomeTimeline } from 'flavours/glitch/actions/timelines'; import { expandHomeTimeline } from 'flavours/glitch/actions/timelines';

View File

@ -4,7 +4,7 @@ import { setupBrowserNotifications } from 'flavours/glitch/actions/notifications
import Mastodon, { store } from 'flavours/glitch/containers/mastodon'; import Mastodon, { store } from 'flavours/glitch/containers/mastodon';
import ready from 'flavours/glitch/ready'; import ready from 'flavours/glitch/ready';
const perf = require('flavours/glitch/utils/performance'); const perf = require('flavours/glitch/performance');
/** /**
* @returns {Promise<void>} * @returns {Promise<void>}

View File

@ -1,5 +1,5 @@
import 'packs/public-path'; import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/utils/load_polyfills'; import loadPolyfills from 'flavours/glitch/load_polyfills';
function loaded() { function loaded() {
const TimelineContainer = require('flavours/glitch/containers/timeline_container').default; const TimelineContainer = require('flavours/glitch/containers/timeline_container').default;

View File

@ -1,8 +1,8 @@
import 'packs/public-path'; import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/utils/load_polyfills'; import loadPolyfills from 'flavours/glitch/load_polyfills';
loadPolyfills().then(async () => { loadPolyfills().then(async () => {
const { default: main } = await import('flavours/glitch/utils/main'); const { default: main } = await import('flavours/glitch/main');
return main(); return main();
}).catch(e => { }).catch(e => {

View File

@ -1,7 +1,7 @@
import 'packs/public-path'; import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/utils/load_polyfills'; import loadPolyfills from 'flavours/glitch/load_polyfills';
import ready from 'flavours/glitch/ready'; import ready from 'flavours/glitch/ready';
import loadKeyboardExtensions from 'flavours/glitch/utils/load_keyboard_extensions'; import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions';
function main() { function main() {
const IntlMessageFormat = require('intl-messageformat').default; const IntlMessageFormat = require('intl-messageformat').default;

View File

@ -1,7 +1,7 @@
import 'packs/public-path'; import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/utils/load_polyfills'; import loadPolyfills from 'flavours/glitch/load_polyfills';
import ready from 'flavours/glitch/ready'; import ready from 'flavours/glitch/ready';
import loadKeyboardExtensions from 'flavours/glitch/utils/load_keyboard_extensions'; import loadKeyboardExtensions from 'flavours/glitch/load_keyboard_extensions';
import 'cocoon-js-vanilla'; import 'cocoon-js-vanilla';
function main() { function main() {

View File

@ -1,5 +1,5 @@
import 'packs/public-path'; import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/utils/load_polyfills'; import loadPolyfills from 'flavours/glitch/load_polyfills';
function loaded() { function loaded() {
const ComposeContainer = require('flavours/glitch/containers/compose_container').default; const ComposeContainer = require('flavours/glitch/containers/compose_container').default;

View File

@ -53,7 +53,7 @@ import { TIMELINE_DELETE } from 'flavours/glitch/actions/timelines';
import { STORE_HYDRATE } from 'flavours/glitch/actions/store'; import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
import { REDRAFT } from 'flavours/glitch/actions/statuses'; import { REDRAFT } from 'flavours/glitch/actions/statuses';
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
import uuid from 'flavours/glitch/utils/uuid'; import uuid from '../uuid';
import { privacyPreference } from 'flavours/glitch/utils/privacy_preference'; import { privacyPreference } from 'flavours/glitch/utils/privacy_preference';
import { me, defaultContentType } from 'flavours/glitch/initial_state'; import { me, defaultContentType } from 'flavours/glitch/initial_state';
import { overwrite } from 'flavours/glitch/utils/js_helpers'; import { overwrite } from 'flavours/glitch/utils/js_helpers';

View File

@ -5,7 +5,7 @@ import {
import { CONTEXT_FETCH_SUCCESS } from 'flavours/glitch/actions/statuses'; import { CONTEXT_FETCH_SUCCESS } from 'flavours/glitch/actions/statuses';
import { TIMELINE_DELETE, TIMELINE_UPDATE } from 'flavours/glitch/actions/timelines'; import { TIMELINE_DELETE, TIMELINE_UPDATE } from 'flavours/glitch/actions/timelines';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from '../compare_id';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
inReplyTos: ImmutableMap(), inReplyTos: ImmutableMap(),

View File

@ -11,7 +11,7 @@ import {
} from '../actions/conversations'; } from '../actions/conversations';
import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'flavours/glitch/actions/accounts'; import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'flavours/glitch/actions/accounts';
import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks'; import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from '../compare_id';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
items: ImmutableList(), items: ImmutableList(),

View File

@ -1,7 +1,7 @@
import { STORE_HYDRATE } from 'flavours/glitch/actions/store'; import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
import { APP_LAYOUT_CHANGE } from 'flavours/glitch/actions/app'; import { APP_LAYOUT_CHANGE } from 'flavours/glitch/actions/app';
import { Map as ImmutableMap } from 'immutable'; import { Map as ImmutableMap } from 'immutable';
import { layoutFromWindow } from 'flavours/glitch/utils/is_mobile'; import { layoutFromWindow } from 'flavours/glitch/is_mobile';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
streaming_api_base_url: null, streaming_api_base_url: null,

View File

@ -32,7 +32,7 @@ import {
import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks'; import { DOMAIN_BLOCK_SUCCESS } from 'flavours/glitch/actions/domain_blocks';
import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from 'flavours/glitch/actions/timelines'; import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from 'flavours/glitch/actions/timelines';
import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable'; import { fromJS, Map as ImmutableMap, List as ImmutableList } from 'immutable';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from '../compare_id';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
pendingItems: ImmutableList(), pendingItems: ImmutableList(),

View File

@ -6,7 +6,7 @@ import { EMOJI_USE } from 'flavours/glitch/actions/emojis';
import { LANGUAGE_USE } from 'flavours/glitch/actions/languages'; import { LANGUAGE_USE } from 'flavours/glitch/actions/languages';
import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists'; import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists';
import { Map as ImmutableMap, fromJS } from 'immutable'; import { Map as ImmutableMap, fromJS } from 'immutable';
import uuid from 'flavours/glitch/utils/uuid'; import uuid from '../uuid';
const initialState = ImmutableMap({ const initialState = ImmutableMap({
saved: true, saved: true,

View File

@ -17,7 +17,7 @@ import {
ACCOUNT_UNFOLLOW_SUCCESS, ACCOUNT_UNFOLLOW_SUCCESS,
} from 'flavours/glitch/actions/accounts'; } from 'flavours/glitch/actions/accounts';
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable'; import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
import compareId from 'flavours/glitch/utils/compare_id'; import compareId from '../compare_id';
const initialState = ImmutableMap(); const initialState = ImmutableMap();