From a92dd541a741f17f9b6dbfe17174a2b6ecbf758a Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 25 Jun 2023 16:21:58 -0400 Subject: [PATCH 01/30] feat(UI): Always put post body behind togggle on post listings (home/community) #1595 --- src/shared/components/post/post-listing.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 76a3e445..c373b673 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -1368,18 +1368,6 @@ export class PostListing extends Component { ); } - showBodyPreview() { - const { body, id } = this.postView.post; - - return !this.showBody && body ? ( - -
{body}
- - ) : ( - <> - ); - } - listing() { return ( <> @@ -1392,9 +1380,6 @@ export class PostListing extends Component { {/* If it has a thumbnail, do a right aligned thumbnail */} {this.mobileThumbnail()} - {/* Show a preview of the post body */} - {this.showBodyPreview()} - {this.commentsLine(true)} {this.userActionsLine()} {this.duplicatesLine()} @@ -1424,7 +1409,6 @@ export class PostListing extends Component {
{this.postTitleLine()} {this.createdLine()} - {this.showBodyPreview()} {this.commentsLine()} {this.duplicatesLine()} {this.userActionsLine()} From 077603b43e502026c01a94293588139bc7e8f074 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 25 Jun 2023 18:43:13 -0400 Subject: [PATCH 02/30] feat: Use plus/minus expand button in title for showing body/preview --- src/shared/components/post/post-listing.tsx | 53 ++++++++++----------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 86787cc4..88153368 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -497,6 +497,25 @@ export class PostListing extends Component { /> ))} + + {/** + * If there is a URL, or if the post has a body and we were told not to + * show the body, show the MetadataCard/body toggle. + */} + {(post.url || (post.body && !this.props.showBody)) && ( + + )} + {post.removed && ( {I18NextService.i18n.t("removed")} @@ -634,27 +653,6 @@ export class PostListing extends Component { ); } - showPreviewButton() { - const post_view = this.postView; - const body = post_view.post.body; - - return ( - - ); - } - postActions() { // Possible enhancement: Priority+ pattern instead of just hard coding which get hidden behind the show more button. // Possible enhancement: Make each button a component. @@ -666,14 +664,7 @@ export class PostListing extends Component { {this.saveButton} {this.crossPostButton} - {/** - * If there is a URL, or if the post has a body and we were told not to - * show the body, show the MetadataCard/body toggle. - */} - {(post.url || (post.body && !this.props.showBody)) && - this.showPreviewButton()} - - {this.showBody && post_view.post.body && this.viewSourceButton} + {this.props.showBody && post_view.post.body && this.viewSourceButton}
+
+
{showScores() ? (
{numToSI(this.props.counts.score)} diff --git a/src/shared/components/home/emojis-form.tsx b/src/shared/components/home/emojis-form.tsx index caf8221c..149ff032 100644 --- a/src/shared/components/home/emojis-form.tsx +++ b/src/shared/components/home/emojis-form.tsx @@ -255,7 +255,7 @@ export class EmojiForm extends Component { >
diff --git a/src/shared/components/home/tagline-form.tsx b/src/shared/components/home/tagline-form.tsx index c79d9554..bdbe1e63 100644 --- a/src/shared/components/home/tagline-form.tsx +++ b/src/shared/components/home/tagline-form.tsx @@ -71,7 +71,7 @@ export class TaglineForm extends Component { data-tippy-content={I18NextService.i18n.t("edit")} aria-label={I18NextService.i18n.t("edit")} > - + diff --git a/src/shared/components/person/cake-day.tsx b/src/shared/components/person/cake-day.tsx index ddb12bea..3eeaf75e 100644 --- a/src/shared/components/person/cake-day.tsx +++ b/src/shared/components/person/cake-day.tsx @@ -10,7 +10,7 @@ export class CakeDay extends Component { render() { return (
diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index 70bada82..714b6bed 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -647,12 +647,12 @@ export class Profile extends Component< value={this.state.banReason} onInput={linkEvent(this, this.handleModBanReasonChange)} /> -
@@ -952,6 +1040,121 @@ export class PostListing extends Component { ); } + get modBanFromCommunityButton() { + return ( + + ); + } + + get modUnbanFromCommunityButton() { + return ( + + ); + } + + get addModToCommunityButton() { + return ( + + ); + } + + get modBanButton() { + return ( + + ); + } + + get modUnbanButton() { + return ( + + ); + } + + get purgePersonButton() { + return ( + + ); + } + + get purgePostButton() { + return ( + + ); + } + + get toggleAdminButton() { + return ( + + ); + } + get modRemoveButton() { const removed = this.postView.post.removed; return ( @@ -981,170 +1184,7 @@ export class PostListing extends Component { // TODO: make nicer const post_view = this.postView; return ( - this.state.showAdvanced && ( -
- {this.canMod_ && ( - <> - {!this.creatorIsMod_ && - (!post_view.creator_banned_from_community ? ( - - ) : ( - - ))} - {!post_view.creator_banned_from_community && ( - - )} - - )} - {/* Community creators and admins can transfer community to another mod */} - {(amCommunityCreator(post_view.creator.id, this.props.moderators) || - this.canAdmin_) && - this.creatorIsMod_ && - (!this.state.showConfirmTransferCommunity ? ( - - ) : ( - <> - - - - - ))} - {/* Admins can ban from all, and appoint other admins */} - {this.canAdmin_ && ( - <> - {!this.creatorIsAdmin_ && ( - <> - {!isBanned(post_view.creator) ? ( - - ) : ( - - )} - - - - )} - {!isBanned(post_view.creator) && post_view.creator.local && ( - - )} - - )} -
- ) + this.state.showAdvanced &&
); } From a4c819cdeb13d5a56b92e34693f195226f765174 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 25 Jun 2023 18:08:26 -0400 Subject: [PATCH 09/30] fix: Move things back to where they were --- src/shared/components/post/post-listing.tsx | 180 ++++++++++---------- 1 file changed, 91 insertions(+), 89 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index ed2658e4..187f69c2 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -688,94 +688,6 @@ export class PostListing extends Component { {(this.canMod_ || this.canAdmin_) && (
  • {this.modRemoveButton}
  • )} - - {this.canMod_ && ( - <> - {!this.creatorIsMod_ && - (!post_view.creator_banned_from_community ? ( -
  • {this.modBanFromCommunityButton}
  • - ) : ( -
  • {this.modUnbanFromCommunityButton}
  • - ))} - {!post_view.creator_banned_from_community && ( -
  • {this.addModToCommunityButton}
  • - )} - - )} - - {/* Community creators and admins can transfer community to another mod */} - {(amCommunityCreator(post_view.creator.id, this.props.moderators) || - this.canAdmin_) && - this.creatorIsMod_ && - (!this.state.showConfirmTransferCommunity ? ( -
  • - -
  • - ) : ( - <> -
  • - -
  • -
  • - -
  • -
  • - -
  • - - ))} - {/* Admins can ban from all, and appoint other admins */} - {this.canAdmin_ && ( - <> - {!this.creatorIsAdmin_ && ( - <> - {!isBanned(post_view.creator) ? ( -
  • {modBanButton}
  • - ) : ( -
  • {modUnbanButton}
  • - )} -
  • {purgePersonButton}
  • -
  • {purgePostButton}
  • - - )} - {!isBanned(post_view.creator) && post_view.creator.local && ( -
  • {toggleAdminButton}
  • - )} - - )}
    @@ -1184,7 +1096,97 @@ export class PostListing extends Component { // TODO: make nicer const post_view = this.postView; return ( - this.state.showAdvanced &&
    + this.state.showAdvanced && ( +
    + {this.canMod_ && ( + <> + {!this.creatorIsMod_ && + (!post_view.creator_banned_from_community ? ( +
  • {this.modBanFromCommunityButton}
  • + ) : ( +
  • {this.modUnbanFromCommunityButton}
  • + ))} + {!post_view.creator_banned_from_community && ( +
  • {this.addModToCommunityButton}
  • + )} + + )} + + {/* Community creators and admins can transfer community to another mod */} + {(amCommunityCreator(post_view.creator.id, this.props.moderators) || + this.canAdmin_) && + this.creatorIsMod_ && + (!this.state.showConfirmTransferCommunity ? ( +
  • + +
  • + ) : ( + <> +
  • + +
  • +
  • + +
  • +
  • + +
  • + + ))} + {/* Admins can ban from all, and appoint other admins */} + {this.canAdmin_ && ( + <> + {!this.creatorIsAdmin_ && ( + <> + {!isBanned(post_view.creator) ? ( +
  • {this.modBanButton}
  • + ) : ( +
  • {this.modUnbanButton}
  • + )} +
  • {this.purgePersonButton}
  • +
  • {this.purgePostButton}
  • + + )} + {!isBanned(post_view.creator) && post_view.creator.local && ( +
  • {this.toggleAdminButton}
  • + )} + + )} +
    + ) ); } From 2547f68a6b4dd01400efe3d358145c7f232276d6 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 25 Jun 2023 18:11:12 -0400 Subject: [PATCH 10/30] fix: Remove extraneous classes --- src/shared/components/post/post-listing.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 187f69c2..000a944b 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -955,7 +955,7 @@ export class PostListing extends Component { get modBanFromCommunityButton() { return ( + ) : ( + <> + + - - ) : ( - <> -
  • - -
  • -
  • - -
  • -
  • - -
  • ))} {/* Admins can ban from all, and appoint other admins */} @@ -1171,18 +1163,16 @@ export class PostListing extends Component { <> {!this.creatorIsAdmin_ && ( <> - {!isBanned(post_view.creator) ? ( -
  • {this.modBanButton}
  • - ) : ( -
  • {this.modUnbanButton}
  • - )} -
  • {this.purgePersonButton}
  • -
  • {this.purgePostButton}
  • + {!isBanned(post_view.creator) + ? this.modBanButton + : this.modUnbanButton} + {this.purgePersonButton} + {this.purgePostButton} )} - {!isBanned(post_view.creator) && post_view.creator.local && ( -
  • {this.toggleAdminButton}
  • - )} + {!isBanned(post_view.creator) && + post_view.creator.local && + this.toggleAdminButton} )}
    From 6e6bbb06c09cb34312ef537e38c7810cf9235793 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Sun, 25 Jun 2023 18:15:59 -0400 Subject: [PATCH 12/30] fix: Restore removed classes --- src/shared/components/post/post-listing.tsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 92550589..8cd8b0c1 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -1101,14 +1101,11 @@ export class PostListing extends Component { {this.canMod_ && ( <> {!this.creatorIsMod_ && - (!post_view.creator_banned_from_community ? ( -
  • {this.modBanFromCommunityButton}
  • - ) : ( -
  • {this.modUnbanFromCommunityButton}
  • - ))} - {!post_view.creator_banned_from_community && ( -
  • {this.addModToCommunityButton}
  • - )} + (!post_view.creator_banned_from_community + ? this.modBanFromCommunityButton + : this.modUnbanFromCommunityButton)} + {!post_view.creator_banned_from_community && + this.addModToCommunityButton} )} @@ -1130,13 +1127,13 @@ export class PostListing extends Component { ) : ( <> + + + + ); + } + + handleEmailInputChange(i: LoginReset, event: any) { + i.setState(s => ((s.form.email = event.target.value.trim()), s)); + } + + async handlePasswordReset(i: LoginReset, event: any) { + event.preventDefault(); + + const email = i.state.form.email; + + if (email && validEmail(email)) { + i.setState(s => ((s.form.loading = true), s)); + + const res = await HttpService.client.passwordReset({ email }); + + if (res.state == "success") { + toast(I18NextService.i18n.t("reset_password_mail_sent")); + i.context.router.history.push("/login"); + } + + i.setState(s => ((s.form.loading = false), s)); + } + } +} diff --git a/src/shared/components/home/login.tsx b/src/shared/components/home/login.tsx index 4dd64665..397288e8 100644 --- a/src/shared/components/home/login.tsx +++ b/src/shared/components/home/login.tsx @@ -1,7 +1,7 @@ import { myAuth, setIsoData } from "@utils/app"; import { isBrowser } from "@utils/browser"; -import { validEmail } from "@utils/helpers"; import { Component, linkEvent } from "inferno"; +import { NavLink } from "inferno-router"; import { GetSiteResponse, LoginResponse } from "lemmy-js-client"; import { I18NextService, UserService } from "../../services"; import { HttpService, RequestState } from "../../services/HttpService"; @@ -105,18 +105,12 @@ export class Login extends Component { required maxLength={60} /> - + {this.state.showTotp && ( @@ -214,15 +208,4 @@ export class Login extends Component { i.state.form.password = event.target.value; i.setState(i.state); } - - async handlePasswordReset(i: Login, event: any) { - event.preventDefault(); - const email = i.state.form.username_or_email; - if (email) { - const res = await HttpService.client.passwordReset({ email }); - if (res.state == "success") { - toast(I18NextService.i18n.t("reset_password_mail_sent")); - } - } - } } diff --git a/src/shared/routes.ts b/src/shared/routes.ts index 6e3ed498..01325afa 100644 --- a/src/shared/routes.ts +++ b/src/shared/routes.ts @@ -7,6 +7,7 @@ import { Home } from "./components/home/home"; import { Instances } from "./components/home/instances"; import { Legal } from "./components/home/legal"; import { Login } from "./components/home/login"; +import { LoginReset } from "./components/home/login-reset"; import { Setup } from "./components/home/setup"; import { Signup } from "./components/home/signup"; import { Modlog } from "./components/modlog"; @@ -38,6 +39,10 @@ export const routes: IRoutePropsWithFetch>[] = [ path: `/login`, component: Login, }, + { + path: `/login_reset`, + component: LoginReset, + }, { path: `/signup`, component: Signup, From 7d63117c286620297260059b237976cfd410442d Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Mon, 26 Jun 2023 15:25:22 -0400 Subject: [PATCH 20/30] capitalize button (#1616) Co-authored-by: Dessalines --- src/shared/components/person/inbox.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shared/components/person/inbox.tsx b/src/shared/components/person/inbox.tsx index 395875be..c414e8be 100644 --- a/src/shared/components/person/inbox.tsx +++ b/src/shared/components/person/inbox.tsx @@ -11,6 +11,7 @@ import { setIsoData, updatePersonBlock, } from "@utils/app"; +import { capitalizeFirstLetter } from "@utils/helpers"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; import { @@ -243,7 +244,9 @@ export class Inbox extends Component { {this.state.markAllAsReadRes.state == "loading" ? ( ) : ( - I18NextService.i18n.t("mark_all_as_read") + capitalizeFirstLetter( + I18NextService.i18n.t("mark_all_as_read") + ) )} )} From 7efc136ff51065a9ccfb025abd0f88af155a2b85 Mon Sep 17 00:00:00 2001 From: dullbananas Date: Mon, 26 Jun 2023 12:57:23 -0700 Subject: [PATCH 21/30] Indicate valid and invalid fields in signup form (#1450) * Use was-validated class in signup form * Update signup.tsx * Update signup.tsx --------- Co-authored-by: SleeplessOne1917 --- src/shared/components/home/signup.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shared/components/home/signup.tsx b/src/shared/components/home/signup.tsx index a2d960dc..516cd43f 100644 --- a/src/shared/components/home/signup.tsx +++ b/src/shared/components/home/signup.tsx @@ -140,7 +140,10 @@ export class Signup extends Component { registerForm() { const siteView = this.state.siteRes.site_view; return ( -
    +
    {this.titleName(siteView)}
    {this.isLemmyMl && ( From 0956863b28ad7f663f4c3fd4467419daae66a71f Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Mon, 26 Jun 2023 16:09:11 -0400 Subject: [PATCH 22/30] remove icon (#1618) Co-authored-by: Dessalines --- src/shared/components/post/post-listing.tsx | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 19523f20..f898e833 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -481,21 +481,6 @@ export class PostListing extends Component { this.postLink )} - {(url && isImage(url)) || - (post.thumbnail_url && ( - - ))} {/** * If there is a URL, or if the post has a body and we were told not to @@ -520,6 +505,7 @@ export class PostListing extends Component { {I18NextService.i18n.t("removed")}
    )} + {post.deleted && ( { )} + {post.locked && ( { )} + {post.featured_community && ( { )} + {post.featured_local && ( { )} + {post.nsfw && ( {I18NextService.i18n.t("nsfw")} From 936eb115bcbd43e3cab1ff2d4a83f8d582660008 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:10:39 -0400 Subject: [PATCH 23/30] fix vote button alignment --- src/shared/components/common/vote-buttons.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/components/common/vote-buttons.tsx b/src/shared/components/common/vote-buttons.tsx index 005db8c0..259d2161 100644 --- a/src/shared/components/common/vote-buttons.tsx +++ b/src/shared/components/common/vote-buttons.tsx @@ -104,7 +104,7 @@ export class VoteButtonsCompact extends Component< render() { return ( -
    + <>
    + ); } } From 1dd83dafdc2d2d7e343dfae9f55439c062480b49 Mon Sep 17 00:00:00 2001 From: Pascal de Vink Date: Mon, 26 Jun 2023 21:45:56 +0100 Subject: [PATCH 24/30] Fix feedback on banning an unbanning When banning or unbanning, the API call was done, but updating the frontend failed. This caused a confusing experience for an admin, until the page was reloaded. --- src/shared/components/person/profile.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index 714b6bed..622e9312 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -205,6 +205,7 @@ export class Profile extends Component< this.handleSavePost = this.handleSavePost.bind(this); this.handlePurgePost = this.handlePurgePost.bind(this); this.handleFeaturePost = this.handleFeaturePost.bind(this); + this.handleModBanSubmit = this.handleModBanSubmit.bind(this); // Only fetch the data if coming from another route if (FirstLoadService.isFirstLoad) { @@ -987,6 +988,7 @@ export class Profile extends Component< s.personRes.data.comments .filter(c => c.creator.id == banRes.data.person_view.person.id) .forEach(c => (c.creator.banned = banRes.data.banned)); + s.personRes.data.person_view.person.banned = banRes.data.banned; } return s; }); From 5c964440daf3c8001e00e11b19396b05d17df8c3 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Mon, 26 Jun 2023 20:12:21 -0400 Subject: [PATCH 25/30] fix: Show metadata preview card on all post pages --- src/shared/components/post/metadata-card.tsx | 86 +++++++++----------- src/shared/components/post/post-listing.tsx | 11 ++- 2 files changed, 47 insertions(+), 50 deletions(-) diff --git a/src/shared/components/post/metadata-card.tsx b/src/shared/components/post/metadata-card.tsx index a1ddca7f..1269c0b7 100644 --- a/src/shared/components/post/metadata-card.tsx +++ b/src/shared/components/post/metadata-card.tsx @@ -8,60 +8,54 @@ interface MetadataCardProps { post: Post; } -interface MetadataCardState { - expanded: boolean; -} - -export class MetadataCard extends Component< - MetadataCardProps, - MetadataCardState -> { +export class MetadataCard extends Component { constructor(props: any, context: any) { super(props, context); } render() { const post = this.props.post; - return ( - <> - {post.embed_title && post.url && ( -
    -
    -
    -
    - {post.name !== post.embed_title && ( - <> -
    - - {post.embed_title} - -
    - - - {new URL(post.url).hostname} - - - - - )} - {post.embed_description && ( -
    - )} -
    + + if (post.embed_title && post.url) { + return ( +
    +
    +
    +
    + {post.name !== post.embed_title && ( + <> +
    + + {post.embed_title} + +
    + + + {new URL(post.url).hostname} + + + + + )} + {post.embed_description && ( +
    + )}
    - )} - - ); +
    + ); + } else { + return <>; + } } } diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index f898e833..2b761c56 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -105,6 +105,9 @@ interface PostListingProps { allLanguages: Language[]; siteLanguages: number[]; showCommunity?: boolean; + /** + * Controls whether to show both the body *and* the metadata preview card + */ showBody?: boolean; hideImage?: boolean; enableDownvotes?: boolean; @@ -200,7 +203,7 @@ export class PostListing extends Component { <> {this.listing()} {this.state.imageExpanded && !this.props.hideImage && this.img} - {post.url && this.state.showBody && post.embed_title && ( + {this.showBody && post.url && post.embed_title && ( )} {this.showBody && this.body()} @@ -483,10 +486,10 @@ export class PostListing extends Component { {/** - * If there is a URL, or if the post has a body and we were told not to - * show the body, show the MetadataCard/body toggle. + * If there is a URL, an embed title, and we were not told to show the + * body by the parent component, show the MetadataCard/body toggle. */} - {(post.url || (post.body && !this.props.showBody)) && ( + {!this.props.showBody && post.url && post.embed_title && ( - )} + {!this.props.showBody && + post.url && + post.embed_title && + this.showPreviewButton()} {post.removed && ( @@ -1380,6 +1371,21 @@ export class PostListing extends Component { ); } + showPreviewButton() { + return ( + + ); + } + listing() { return ( <> From 34188ebd8435406f370cb3f1c829a7b8127f7e08 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Tue, 27 Jun 2023 08:09:55 -0400 Subject: [PATCH 27/30] Fix allowed and blocked instances not being fetched for admin settings (#1627) Co-authored-by: Dessalines --- src/shared/components/home/site-form.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/shared/components/home/site-form.tsx b/src/shared/components/home/site-form.tsx index 382f5650..45857a0d 100644 --- a/src/shared/components/home/site-form.tsx +++ b/src/shared/components/home/site-form.tsx @@ -4,6 +4,7 @@ import { Component, InfernoKeyboardEvent, InfernoMouseEvent, + InfernoNode, linkEvent, } from "inferno"; import { @@ -13,6 +14,7 @@ import { Instance, ListingType, } from "lemmy-js-client"; +import deepEqual from "lodash.isequal"; import { I18NextService } from "../../services"; import { Icon, Spinner } from "../common/icon"; import { ImageUploadForm } from "../common/image-upload-form"; @@ -55,6 +57,7 @@ export class SiteForm extends Component { initSiteForm(): EditSite { const site = this.props.siteRes.site_view.site; const ls = this.props.siteRes.site_view.local_site; + return { name: site.name, sidebar: site.sidebar, @@ -619,6 +622,19 @@ export class SiteForm extends Component { ); } + componentDidUpdate( + prevProps: Readonly<{ children?: InfernoNode } & SiteFormProps> + ) { + if ( + !( + deepEqual(prevProps.allowedInstances, this.props.allowedInstances) || + deepEqual(prevProps.blockedInstances, this.props.blockedInstances) + ) + ) { + this.setState({ siteForm: this.initSiteForm() }); + } + } + federatedInstanceSelect(key: InstanceKey) { const id = `create_site_${key}`; const value = this.state.instance_select[key]; From d8f4cc328eb065392d5f3ad372a1fcbb9573cf1a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 27 Jun 2023 08:10:42 -0400 Subject: [PATCH 28/30] v0.18.1-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 01f5100e..7eab4cbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lemmy-ui", - "version": "0.18.0", + "version": "0.18.1-rc.1", "description": "An isomorphic UI for lemmy", "repository": "https://github.com/LemmyNet/lemmy-ui", "license": "AGPL-3.0", From 20757fa769bf79fb74c43af238d7f982ec227e22 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 27 Jun 2023 08:47:39 -0400 Subject: [PATCH 29/30] Moving webpack-bundle-analyzer require inside mode check to fix docker. --- webpack.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index dcb88c52..4d95a80c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,8 +6,7 @@ const CopyPlugin = require("copy-webpack-plugin"); const RunNodeWebpackPlugin = require("run-node-webpack-plugin"); const merge = require("lodash.merge"); const { ServiceWorkerPlugin } = require("service-worker-webpack"); -const BundleAnalyzerPlugin = - require("webpack-bundle-analyzer").BundleAnalyzerPlugin; + const banner = ` hash:[contentHash], chunkhash:[chunkhash], name:[name], filebase:[base], query:[query], file:[file] Source code: https://github.com/LemmyNet/lemmy-ui @@ -156,6 +155,8 @@ const createClientConfig = (_env, mode) => { }); if (mode === "none") { + const BundleAnalyzerPlugin = + require("webpack-bundle-analyzer").BundleAnalyzerPlugin; config.plugins.push(new BundleAnalyzerPlugin()); } From 934cabcec4e059d283597934685e9b0109a62430 Mon Sep 17 00:00:00 2001 From: Sander Saarend Date: Tue, 27 Jun 2023 17:52:01 +0300 Subject: [PATCH 30/30] Reduce fetchLimit (40 -> 20) (#1638) Co-authored-by: Dessalines --- src/shared/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/config.ts b/src/shared/config.ts index c56c64b0..97b28d25 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -21,7 +21,7 @@ export const markdownFieldCharacterLimit = 50000; export const maxUploadImages = 20; export const concurrentImageUpload = 4; export const updateUnreadCountsInterval = 30000; -export const fetchLimit = 40; +export const fetchLimit = 20; export const relTags = "noopener nofollow"; export const emDash = "\u2014";