Merge branch 'main' into breakout-role-utils
authorAlec Armbruster <35377827+alectrocute@users.noreply.github.com>
Sat, 17 Jun 2023 12:44:47 +0000 (08:44 -0400)
committerGitHub <noreply@github.com>
Sat, 17 Jun 2023 12:44:47 +0000 (08:44 -0400)
14 files changed:
1  2 
src/shared/components/app/navbar.tsx
src/shared/components/common/markdown-textarea.tsx
src/shared/components/community/communities.tsx
src/shared/components/community/community.tsx
src/shared/components/community/sidebar.tsx
src/shared/components/home/home.tsx
src/shared/components/modlog.tsx
src/shared/components/person/profile.tsx
src/shared/components/person/reports.tsx
src/shared/components/post/create-post.tsx
src/shared/components/post/post-listing.tsx
src/shared/components/post/post.tsx
src/shared/components/search.tsx
src/shared/utils.ts

Simple merge
index 997fe11ad71dad96de7ecf9b2e893ee5069a1681,720e596fb6a13f0b876cd046c2d2bf9b8fef4b8b..508e5a0d7cc86ac55a808b6913f4601ac6d3debc
@@@ -21,11 -24,8 +21,11 @@@ import 
    hostname,
    mdToHtml,
    myAuthRequired,
-   numToSI,
  } 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";
  import { CommunityForm } from "../community/community-form";
index 9f7c322f720ce07d01f0505312364f4f0576d07c,4d79bc6359e1fc8f069310e3bca173640243284b..54378f340fc4552f1dbd517c2bde9a8cdc01d7dd
@@@ -71,8 -74,10 +71,9 @@@ import 
    mdToHtml,
    myAuth,
    postToCommentSortType,
 -  QueryParams,
    relTags,
    restoreScrollPosition,
+   RouteDataResponse,
    saveScrollPosition,
    setIsoData,
    setupTippy,
Simple merge
index 187fe4c2e0e06d71548793e49df30728e62ec2ce,99a0333645fe4e719b031eefbba68c5e53862780..0be753791d4bb192456a74f5188319d960852041
@@@ -23,6 -23,8 +23,7 @@@ import { HttpService, UserService } fro
  import { FirstLoadService } from "../../services/FirstLoadService";
  import { RequestState } from "../../services/HttpService";
  import {
 -  amAdmin,
+   RouteDataResponse,
    editCommentReport,
    editPostReport,
    editPrivateMessageReport,
index 63ee390f8ad0d85e36b5a040bef25b80c16460a5,278977977bb9a2df8511cb71d942c71dd82461ed..7df628b2b2b0461439eb2846285c993ef6cf5c7d
@@@ -16,6 -17,8 +17,7 @@@ import 
  } from "../../services/HttpService";
  import {
    Choice,
 -  QueryParams,
+   RouteDataResponse,
    enableDownvotes,
    enableNsfw,
    getIdFromString,
Simple merge
index d32e408755de63e2f6b23f98c18a677e4d927b4a,054cab016be94dd34e2b3294a1bd4825590cc75d..e56056acc01baa4abbc9b905b350f9c4acad786f
@@@ -26,6 -26,8 +26,7 @@@ import { FirstLoadService } from "../se
  import { HttpService, RequestState } from "../services/HttpService";
  import {
    Choice,
 -  QueryParams,
+   RouteDataResponse,
    capitalizeFirstLetter,
    commentsToFlatNodes,
    communityToChoice,
index 6f6e61c74e2d95ea75f3123fb4885d21abeced9e,c7fbca6b5654db597b098c452af5dc6ed522273b..be461dcd0145ab3fabdb9405407b210ebc2d5bd3
@@@ -41,11 -43,15 +41,18 @@@ import tippy from "tippy.js"
  import Toastify from "toastify-js";
  import { getHttpBase } from "./env";
  import { i18n } from "./i18next";
- import { CommentNodeI, DataType, IsoData, VoteType } from "./interfaces";
+ import {
+   CommentNodeI,
+   DataType,
+   IsoData,
+   RouteData,
+   VoteType,
+ } from "./interfaces";
  import { HttpService, UserService } from "./services";
 +import { isBrowser } from "./utils/browser/is-browser";
 +import { debounce } from "./utils/helpers/debounce";
 +import { groupBy } from "./utils/helpers/group-by";
+ import { RequestState } from "./services/HttpService";
  
  let Tribute: any;
  if (isBrowser()) {
@@@ -1011,7 -1153,11 +1023,7 @@@ export function siteBannerCss(banner: s
      `;
  }
  
- export function setIsoData(context: any): IsoData {
 -export function isBrowser() {
 -  return typeof window !== "undefined";
 -}
 -
+ export function setIsoData<T extends RouteData>(context: any): IsoData<T> {
    // If its the browser, you need to deserialize the data from the window
    if (isBrowser()) {
      return window.isoData;
@@@ -1264,3 -1486,22 +1276,7 @@@ export function newVote(voteType: VoteT
      return myVote == -1 ? 0 : -1;
    }
  }
 -
 -function sleep(millis: number): Promise<void> {
 -  return new Promise(resolve => setTimeout(resolve, millis));
 -}
 -
 -/**
 - * Polls / repeatedly runs a promise, every X milliseconds
 - */
 -export async function poll(promiseFn: any, millis: number) {
 -  if (window.document.visibilityState !== "hidden") {
 -    await promiseFn();
 -  }
 -  await sleep(millis);
 -  return poll(promiseFn, millis);
 -}
+ export type RouteDataResponse<T extends Record<string, any>> = {
+   [K in keyof T]: RequestState<T[K]>;
+ };