Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize utils.ts into folder, update imports #1332

Merged
merged 34 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0854af3
break out all role utils
alectrocute Jun 16, 2023
976ed12
break out browser and helper methods
alectrocute Jun 16, 2023
9c37cea
Merge branch 'main' into breakout-role-utils
alectrocute Jun 16, 2023
6126900
forgot debounce
alectrocute Jun 16, 2023
05aa483
pull latest main
alectrocute Jun 16, 2023
6c6ddd5
reset, merge issues
alectrocute Jun 16, 2023
9575b32
Merge branch 'breakout-role-utils' of https://github.com/alectrocute/…
alectrocute Jun 16, 2023
3ee47d3
Merge branch 'LemmyNet:main' into breakout-role-utils
alectrocute Jun 16, 2023
e164a3b
attempt to fix crazy merge fiasco
alectrocute Jun 16, 2023
8fcde4b
more cleanup
alectrocute Jun 16, 2023
768ed8e
even more cleanup
alectrocute Jun 16, 2023
fbc1324
more cleanup
alectrocute Jun 16, 2023
b3a25a3
hopefully last merge fiasco cleanup
alectrocute Jun 16, 2023
b0c39ad
and of course, yarn.lock
alectrocute Jun 16, 2023
7f48a38
Merge branch 'main' into breakout-role-utils
alectrocute Jun 17, 2023
571b1fa
remove comments
alectrocute Jun 17, 2023
f8fd90c
fix accidental changes
alectrocute Jun 17, 2023
02ffa85
Merge branch 'main' into breakout-role-utils
dessalines Jun 19, 2023
0c95172
Merge branch 'main' into breakout-role-utils
dessalines Jun 19, 2023
b1b0fdf
fix missing imports
alectrocute Jun 19, 2023
41cc3d3
Merge branch 'main' into breakout-role-utils
SleeplessOne1917 Jun 20, 2023
f53d5db
export default everything, will fix type errors next
alectrocute Jun 20, 2023
b4ac5b9
Merge branch 'breakout-role-utils' of https://github.com/alectrocute/…
alectrocute Jun 20, 2023
69a123b
update imports
alectrocute Jun 20, 2023
79bdb7e
Merge branch 'main' into breakout-role-utils
alectrocute Jun 20, 2023
e4f9c31
make suggested changes
alectrocute Jun 20, 2023
b874eaa
Merge branch 'breakout-role-utils' of https://github.com/alectrocute/…
alectrocute Jun 20, 2023
b8fd516
Merge branch 'main' into breakout-role-utils
alectrocute Jun 20, 2023
2d4c9dd
make suggested changes
alectrocute Jun 20, 2023
697df71
Merge branch 'breakout-role-utils' of https://github.com/alectrocute/…
alectrocute Jun 20, 2023
fe83685
add tsconfigpathsplugin to resolve
alectrocute Jun 20, 2023
cc4ecb5
forgot an import
alectrocute Jun 20, 2023
baf12e6
Merge branch 'main' into breakout-role-utils
alectrocute Jun 20, 2023
4da34c1
Merge branch 'main' into breakout-role-utils
SleeplessOne1917 Jun 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/client/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { hydrate } from "inferno-hydrate";
import { Router } from "inferno-router";
import { App } from "../shared/components/app/app";
import { HistoryService } from "../shared/services/HistoryService";
import { initializeSite } from "../shared/utils";

import "bootstrap/js/dist/collapse";
import "bootstrap/js/dist/dropdown";
import { HistoryService } from "../shared/services/HistoryService";

const site = window.isoData.site_res;
initializeSite(site);
initializeSite(window.isoData.site_res);

const wrapper = (
<Router history={HistoryService.history}>
Expand All @@ -17,6 +16,7 @@ const wrapper = (
);

const root = document.getElementById("root");

if (root) {
hydrate(wrapper, root);
}
8 changes: 4 additions & 4 deletions src/shared/components/app/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import { i18n } from "../../i18next";
import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import {
amAdmin,
canCreateCommunity,
donateLemmyUrl,
isBrowser,
myAuth,
numToSI,
poll,
showAvatars,
toast,
updateUnreadCountsInterval,
} from "../../utils";
import { isBrowser } from "../../utils/browser/is-browser";
dessalines marked this conversation as resolved.
Show resolved Hide resolved
import { poll } from "../../utils/helpers/poll";
import { amAdmin } from "../../utils/roles/am-admin";
import { canCreateCommunity } from "../../utils/roles/can-create-community";
import { Icon } from "../common/icon";
import { PictrsImage } from "../common/pictrs-image";

Expand Down
12 changes: 6 additions & 6 deletions src/shared/components/comment/comment-node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@ import {
} from "../../interfaces";
import { UserService } from "../../services";
import {
amCommunityCreator,
canAdmin,
canMod,
colorList,
commentTreeMaxDepth,
futureDaysToUnixTime,
getCommentParentId,
isAdmin,
isBanned,
isMod,
mdToHtml,
mdToHtmlNoImages,
myAuth,
Expand All @@ -59,6 +53,12 @@ import {
setupTippy,
showScores,
} from "../../utils";
import { amCommunityCreator } from "../../utils/roles/am-community-creator";
import { canAdmin } from "../../utils/roles/can-admin";
import { canMod } from "../../utils/roles/can-mod";
import { isAdmin } from "../../utils/roles/is-admin";
import { isBanned } from "../../utils/roles/is-banned";
import { isMod } from "../../utils/roles/is-mod";
import { Icon, PurgeWarning, Spinner } from "../common/icon";
import { MomentTime } from "../common/moment-time";
import { CommunityLink } from "../community/community-link";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/common/markdown-textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { HttpService, UserService } from "../../services";
import {
concurrentImageUpload,
customEmojisLookup,
isBrowser,
markdownFieldCharacterLimit,
markdownHelpUrl,
maxUploadImages,
Expand All @@ -21,6 +20,7 @@ import {
setupTribute,
toast,
} from "../../utils";
import { isBrowser } from "../../utils/browser/is-browser";
import { EmojiPicker } from "./emoji-picker";
import { Icon, Spinner } from "./icon";
import { LanguageSelect } from "./language-select";
Expand Down
7 changes: 3 additions & 4 deletions src/shared/components/community/communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@ import { InitialFetchRequest } from "../../interfaces";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
QueryParams,
RouteDataResponse,
editCommunity,
getPageFromString,
getQueryParams,
getQueryString,
myAuth,
myAuthRequired,
numToSI,
setIsoData,
showLocal,
} from "../../utils";
import { getQueryParams } from "../../utils/helpers/get-query-params";
import { getQueryString } from "../../utils/helpers/get-query-string";
import type { QueryParams } from "../../utils/types/query-params";
import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon";
import { ListingTypeSelect } from "../common/listing-type-select";
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/community/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
QueryParams,
RouteDataResponse,
commentsToFlatNodes,
communityRSSUrl,
Expand All @@ -75,8 +74,6 @@ import {
getCommentParentId,
getDataTypeString,
getPageFromString,
getQueryParams,
getQueryString,
myAuth,
postToCommentSortType,
relTags,
Expand All @@ -89,6 +86,9 @@ import {
updateCommunityBlock,
updatePersonBlock,
} from "../../utils";
import { getQueryParams } from "../../utils/helpers/get-query-params";
import { getQueryString } from "../../utils/helpers/get-query-string";
import type { QueryParams } from "../../utils/types/query-params";
import { CommentNodes } from "../comment/comment-nodes";
import { BannerIconHeader } from "../common/banner-icon-header";
import { DataTypeSelect } from "../common/data-type-select";
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/community/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import {
import { i18n } from "../../i18next";
import { UserService } from "../../services";
import {
amAdmin,
amMod,
amTopMod,
getUnixTime,
hostname,
mdToHtml,
myAuthRequired,
} from "../../utils";
import { amAdmin } from "../../utils/roles/am-admin";
import { amMod } from "../../utils/roles/am-mod";
import { amTopMod } from "../../utils/roles/am-top-mod";
import { Badges } from "../common/badges";
import { BannerIconHeader } from "../common/banner-icon-header";
import { Icon, PurgeWarning, Spinner } from "../common/icon";
Expand Down
8 changes: 4 additions & 4 deletions src/shared/components/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
canCreateCommunity,
commentsToFlatNodes,
editComment,
editPost,
Expand All @@ -68,13 +67,10 @@ import {
getCommentParentId,
getDataTypeString,
getPageFromString,
getQueryParams,
getQueryString,
getRandomFromList,
mdToHtml,
myAuth,
postToCommentSortType,
QueryParams,
relTags,
restoreScrollPosition,
RouteDataResponse,
Expand All @@ -86,6 +82,10 @@ import {
trendingFetchLimit,
updatePersonBlock,
} from "../../utils";
import { getQueryParams } from "../../utils/helpers/get-query-params";
import { getQueryString } from "../../utils/helpers/get-query-string";
import { canCreateCommunity } from "../../utils/roles/can-create-community";
import type { QueryParams } from "../../utils/types/query-params";
import { CommentNodes } from "../comment/comment-nodes";
import { DataTypeSelect } from "../common/data-type-select";
import { HtmlTags } from "../common/html-tags";
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/home/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
import { i18n } from "../../i18next";
import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { isBrowser, myAuth, setIsoData, toast, validEmail } from "../../utils";
import { myAuth, setIsoData, toast, validEmail } from "../../utils";
import { isBrowser } from "../../utils/browser/is-browser";
import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon";

Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/home/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { i18n } from "../../i18next";
import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import {
isBrowser,
joinLemmyUrl,
mdToHtml,
myAuth,
setIsoData,
toast,
validEmail,
} from "../../utils";
import { isBrowser } from "../../utils/browser/is-browser";
import { HtmlTags } from "../common/html-tags";
import { Icon, Spinner } from "../common/icon";
import { MarkdownTextArea } from "../common/markdown-textarea";
Expand Down
13 changes: 6 additions & 7 deletions src/shared/components/modlog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,21 @@ import { FirstLoadService } from "../services/FirstLoadService";
import { HttpService, RequestState } from "../services/HttpService";
import {
Choice,
QueryParams,
RouteDataResponse,
amAdmin,
amMod,
debounce,
fetchLimit,
fetchUsers,
getIdFromString,
getPageFromString,
getQueryParams,
getQueryString,
getUpdatedSearchId,
myAuth,
personToChoice,
setIsoData,
} from "../utils";
import { debounce } from "../utils/helpers/debounce";
import { getQueryParams } from "../utils/helpers/get-query-params";
import { getQueryString } from "../utils/helpers/get-query-string";
import { amAdmin } from "../utils/roles/am-admin";
import { amMod } from "../utils/roles/am-mod";
import type { QueryParams } from "../utils/types/query-params";
import { HtmlTags } from "./common/html-tags";
import { Icon, Spinner } from "./common/icon";
import { MomentTime } from "./common/moment-time";
Expand Down
13 changes: 6 additions & 7 deletions src/shared/components/person/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ import { UserService } from "../../services";
import { FirstLoadService } from "../../services/FirstLoadService";
import { HttpService, RequestState } from "../../services/HttpService";
import {
QueryParams,
RouteDataResponse,
canMod,
capitalizeFirstLetter,
editComment,
editPost,
Expand All @@ -66,10 +63,6 @@ import {
futureDaysToUnixTime,
getCommentParentId,
getPageFromString,
getQueryParams,
getQueryString,
isAdmin,
isBanned,
mdToHtml,
myAuth,
myAuthRequired,
Expand All @@ -82,6 +75,12 @@ import {
toast,
updatePersonBlock,
} from "../../utils";
import { getQueryParams } from "../../utils/helpers/get-query-params";
import { getQueryString } from "../../utils/helpers/get-query-string";
import { canMod } from "../../utils/roles/can-mod";
import { isAdmin } from "../../utils/roles/is-admin";
import { isBanned } from "../../utils/roles/is-banned";
import type { QueryParams } from "../../utils/types/query-params";
import { BannerIconHeader } from "../common/banner-icon-header";
import { HtmlTags } from "../common/html-tags";
import { Icon, Spinner } from "../common/icon";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/person/reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import { FirstLoadService } from "../../services/FirstLoadService";
import { RequestState } from "../../services/HttpService";
import {
RouteDataResponse,
amAdmin,
editCommentReport,
editPostReport,
editPrivateMessageReport,
fetchLimit,
myAuthRequired,
setIsoData,
} from "../../utils";
import { amAdmin } from "../../utils/roles/am-admin";
import { CommentReport } from "../comment/comment-report";
import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/person/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
Choice,
capitalizeFirstLetter,
communityToChoice,
debounce,
elementUrl,
emDash,
fetchCommunities,
Expand All @@ -36,6 +35,7 @@ import {
updateCommunityBlock,
updatePersonBlock,
} from "../../utils";
import { debounce } from "../../utils/helpers/debounce";
import { HtmlTags } from "../common/html-tags";
import { Icon, Spinner } from "../common/icon";
import { ImageUploadForm } from "../common/image-upload-form";
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/post/create-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import {
} from "../../services/HttpService";
import {
Choice,
QueryParams,
RouteDataResponse,
enableDownvotes,
enableNsfw,
getIdFromString,
getQueryParams,
myAuth,
setIsoData,
} from "../../utils";
import { getQueryParams } from "../../utils/helpers/get-query-params";
import type { QueryParams } from "../../utils/types/query-params";
import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon";
import { PostForm } from "./post-form";
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/post/post-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
archiveTodayUrl,
capitalizeFirstLetter,
communityToChoice,
debounce,
fetchCommunities,
getIdFromString,
ghostArchiveUrl,
Expand All @@ -33,6 +32,7 @@ import {
validURL,
webArchiveUrl,
} from "../../utils";
import { debounce } from "../../utils/helpers/debounce";
import { Icon, Spinner } from "../common/icon";
import { LanguageSelect } from "../common/language-select";
import { MarkdownTextArea } from "../common/markdown-textarea";
Expand Down
20 changes: 10 additions & 10 deletions src/shared/components/post/post-listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,9 @@ import { i18n } from "../../i18next";
import { BanType, PostFormParams, PurgeType, VoteType } from "../../interfaces";
import { UserService } from "../../services";
import {
amAdmin,
amCommunityCreator,
amMod,
canAdmin,
canMod,
canShare,
futureDaysToUnixTime,
hostname,
isAdmin,
isBanned,
isImage,
isMod,
isVideo,
mdNoImages,
mdToHtml,
Expand All @@ -49,9 +40,18 @@ import {
numToSI,
relTags,
setupTippy,
share,
showScores,
} from "../../utils";
import { canShare } from "../../utils/browser/can-share";
import { share } from "../../utils/browser/share";
import { amAdmin } from "../../utils/roles/am-admin";
import { amCommunityCreator } from "../../utils/roles/am-community-creator";
import { amMod } from "../../utils/roles/am-mod";
import { canAdmin } from "../../utils/roles/can-admin";
import { canMod } from "../../utils/roles/can-mod";
import { isAdmin } from "../../utils/roles/is-admin";
import { isBanned } from "../../utils/roles/is-banned";
import { isMod } from "../../utils/roles/is-mod";
import { Icon, PurgeWarning, Spinner } from "../common/icon";
import { MomentTime } from "../common/moment-time";
import { PictrsImage } from "../common/pictrs-image";
Expand Down
Loading