From 8e711c6b543f3ce75638d9adcc089d15d5f7e4e3 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Wed, 21 Jun 2023 19:24:01 -0400 Subject: [PATCH 01/21] fix: Fix i18n UserService import issue --- src/shared/i18next.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/i18next.ts b/src/shared/i18next.ts index ff5f77f1..aab43014 100644 --- a/src/shared/i18next.ts +++ b/src/shared/i18next.ts @@ -1,6 +1,6 @@ import { isBrowser } from "@utils/browser"; import i18next, { i18nTyped, Resource } from "i18next"; -import { UserService } from "./services"; +import { UserService } from "./services/UserService"; import { ar } from "./translations/ar"; import { bg } from "./translations/bg"; import { ca } from "./translations/ca"; From bf0f80e798b38ee748c0a98ba844d83eac7057b9 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Wed, 21 Jun 2023 19:40:24 -0400 Subject: [PATCH 02/21] fix: Add post body preview to desktop post listing view --- src/shared/components/post/post-listing.tsx | 76 +++++++++------------ 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 46a31ba6..3c271659 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -360,28 +360,25 @@ export class PostListing extends Component { createdLine() { const post_view = this.postView; return ( -
    -
  • - - - {this.creatorIsMod_ && ( - {i18n.t("mod")} - )} - {this.creatorIsAdmin_ && ( - {i18n.t("admin")} - )} - {post_view.creator.bot_account && ( - - {i18n.t("bot_account").toLowerCase()} - - )} - {this.props.showCommunity && ( - <> - {" "} - {i18n.t("to")} - - )} -
  • + + + {this.creatorIsMod_ && ( + {i18n.t("mod")} + )} + {this.creatorIsAdmin_ && ( + {i18n.t("admin")} + )} + {post_view.creator.bot_account && ( + + {i18n.t("bot_account").toLowerCase()} + + )} + {this.props.showCommunity && ( + <> + {" "} + {i18n.t("to")} + + )} {post_view.post.language_id !== 0 && ( { @@ -390,17 +387,13 @@ export class PostListing extends Component { )?.name } - )} -
  • -
  • - - - -
  • -
+ )}{" "} + •{" "} + + ); } @@ -737,10 +730,8 @@ export class PostListing extends Component { to={`/post/${post_view.post.id}?scrollToComments=true`} data-tippy-content={title} > - - - {post_view.counts.comments} - + + {post_view.counts.comments} {this.unreadCount && ( ({this.unreadCount} {i18n.t("new")}) @@ -1068,7 +1059,7 @@ export class PostListing extends Component { const post_view = this.postView; return ( this.state.showAdvanced && ( - <> +
{this.canMod_ && ( <> {!this.creatorIsMod_ && @@ -1221,7 +1212,7 @@ export class PostListing extends Component { )} )} - +
) ); } @@ -1408,11 +1399,11 @@ export class PostListing extends Component { ); } - showMobilePreview() { + showBodyPreview() { const { body, id } = this.postView.post; return !this.showBody && body ? ( - +
{body}
) : ( @@ -1433,7 +1424,7 @@ export class PostListing extends Component { {this.mobileThumbnail()} {/* Show a preview of the post body */} - {this.showMobilePreview()} + {this.showBodyPreview()} {this.commentsLine(true)} {this.userActionsLine()} @@ -1455,6 +1446,7 @@ export class PostListing extends Component {
{this.postTitleLine()} {this.createdLine()} + {this.showBodyPreview()} {this.commentsLine()} {this.duplicatesLine()} {this.userActionsLine()} From 4a061491c77a0ac784bb9815ff17016e86aa8914 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:04:21 -0400 Subject: [PATCH 03/21] update issue template --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 43 ++++++++++---------- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 47 +++++----------------- .github/ISSUE_TEMPLATE/QUESTION.yml | 17 -------- .github/ISSUE_TEMPLATE/config.yml | 8 ++++ .github/ISSUE_TEMPLATE/hexbear.yml | 11 ----- 5 files changed, 40 insertions(+), 86 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/QUESTION.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/hexbear.yml diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index a43a5a55..72b274e1 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,32 +1,30 @@ -name: "\U0001F41E Bug Report" -description: Create a report to help us improve lemmy-ui -title: "[Bug]: " +name: "Bug report" +description: Create a bug report to help us improve Lemmy-UI! +title: "" labels: ["bug", "triage"] body: - type: markdown attributes: value: | - Found a bug? Please fill out the sections below. 👍 - Thanks for taking the time to fill out this bug report! - For backend issues, use [lemmy](https://github.com/LemmyNet/lemmy/issues/new/choose) + Thanks for taking the time to help improve Lemmy-UI by reporting a bug! - type: checkboxes attributes: label: Requirements - description: Before you create a bug report please do the following. + description: Before you create a bug report, please carefully check the following – options: - - label: Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support + - label: This is a bug report, and if not, I'd post to https://lemmy.ml/c/lemmy_support instead. required: true - - label: Did you check to see if this issue already exists? + - label: I've [checked](https://github.com/LemmyNet/lemmy-ui/issues) to see if this issue already exists. required: true - - label: Is this only a single bug? Do not put multiple bugs in one issue. + - label: It's a single bug. I'm not reporting multiple bugs in one issue. + required: true + - label: It's a frontend issue, not a backend issue; I'd report that to the [backend repo](https://github.com/LemmyNet/lemmy) instead. required: true - - label: Is this a server side (not related to the UI) issue? Use the [Lemmy back end](https://github.com/LemmyNet/lemmy) repo. - required: false - type: textarea id: summary attributes: label: Summary - description: A summary of the bug. + description: Explain the bug and upload images, screenshots or videos if possible. validations: required: true - type: textarea @@ -34,12 +32,14 @@ body: attributes: label: Steps to Reproduce description: | - Describe the steps to reproduce the bug. - The better your description is _(go 'here', click 'there'...)_ the fastest you'll get an _(accurate)_ resolution. + In a numbered list, walk us through the steps needed to reproduce the bug. + The better your description is _(go 'here', click 'there'...)_, the quicker we can fix it. value: | 1. 2. 3. + 4. + 5. validations: required: true - type: textarea @@ -47,20 +47,21 @@ body: attributes: label: Technical Details description: | - - Any browser console errors? + - Describe your environment (OS, browser, model of smartphone, etc) + - If relevant, also share any console errors and/or screenshots here. validations: required: true - type: input id: lemmy-ui-version attributes: - label: Version - description: Which Lemmy UI version do you use? Displayed in the footer. - placeholder: ex. 0.17.4-rc.4 + label: Lemmy Instance Version + description: What's the version of the Lemmy instance where the bug can be reproduced? + placeholder: ex. 0.18-rc.6 validations: required: true - type: input id: lemmy-instance attributes: label: Lemmy Instance URL - description: Which Lemmy instance do you use? The address - placeholder: lemmy.ml, lemmy.world, etc + description: The URL of the Lemmy instance where the bug can be reproduced. + placeholder: https://lemmy.ml diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index 2d656819..7bd7e910 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -1,54 +1,27 @@ -name: "\U0001F680 Feature request" -description: Suggest an idea for improving Lemmy's UI +name: "Feature request" +description: Suggest an idea to improve Lemmy-UI labels: ["enhancement"] body: - type: markdown attributes: value: | - Have a suggestion about Lemmy's UI? - For backend issues, use [lemmy](https://github.com/LemmyNet/lemmy/issues/new/choose) + Thanks for taking the time to help improve Lemmy-UI by suggesting a feature! - type: checkboxes attributes: label: Requirements - description: Before you create a feature request please do the following. + description: Before you create a bug report, please carefully check the following – options: - - label: Is this a feature request? For questions or discussions use https://lemmy.ml/c/lemmy_support + - label: This is a feature request and not a bug report. Otherwise, I'd create a new [bug report](https://github.com/LemmyNet/lemmy-ui/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml&title=%5BBug%5D%3A+) instead. required: true - - label: Did you check to see if this issue already exists? + - label: I've [checked](https://github.com/LemmyNet/lemmy-ui/issues) to see if this request (or a similar one) already exists. required: true - - label: Is this only a feature request? Do not put multiple feature requests in one issue. + - label: It's a single feature. I'm not requesting multiple features in one issue. required: true - - label: Is this a server side (not related to the UI) issue? Use the [Lemmy back end](https://github.com/LemmyNet/lemmy) repo. - required: false - - type: textarea - id: problem - attributes: - label: Is your proposal related to a problem? - description: | - Provide a clear and concise description of what the problem is. - For example, "I'm always frustrated when..." - validations: - required: true - type: textarea id: solution attributes: - label: Describe the solution you'd like. + label: Describe the feature you'd like description: | - Provide a clear and concise description of what you want to happen. + Provide a clear and concise description of the feature. Explain why it's needed. validations: - required: true - - type: textarea - id: alternatives - attributes: - label: Describe alternatives you've considered. - description: | - Let us know about other solutions you've tried or researched. - validations: - required: true - - type: textarea - id: context - attributes: - label: Additional context - description: | - Is there anything else you can add about the proposal? - You might want to link to related issues here, if you haven't already. + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/QUESTION.yml b/.github/ISSUE_TEMPLATE/QUESTION.yml deleted file mode 100644 index 734937e9..00000000 --- a/.github/ISSUE_TEMPLATE/QUESTION.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: "? Question" -description: General questions about Lemmy -title: "Question: " -labels: ["question", "triage"] -body: - - type: markdown - attributes: - value: | - Have a question about Lemmy's UI? - Please check the docs first: https://join-lemmy.org/docs/en/index.html - - type: textarea - id: question - attributes: - label: Question - description: What's the question you have about Lemmy's UI? - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..d59c2b1b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Question + url: https://lemmy.ml/c/lemmy_support + about: Please ask and answer general questions here. + - name: Technical Discussion + url: https://github.com/LemmyNet/lemmy-ui/discussions + about: Please discuss technical topics with other contributors here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/hexbear.yml b/.github/ISSUE_TEMPLATE/hexbear.yml deleted file mode 100644 index 73ef5482..00000000 --- a/.github/ISSUE_TEMPLATE/hexbear.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: "Hexbear" -description: For hexbear issues -labels: ["hexbear", "triage"] -body: - - type: textarea - id: question - attributes: - label: Question - description: What's the question you have about hexbear? - validations: - required: true From 0938deedf0e0b5fb121da36de23687531eb80b31 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:08:21 -0400 Subject: [PATCH 04/21] formatting ISSUE_TEMPLATE --- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 2 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index 7bd7e910..d998a63d 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -24,4 +24,4 @@ body: description: | Provide a clear and concise description of the feature. Explain why it's needed. validations: - required: true \ No newline at end of file + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d59c2b1b..59085700 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,4 +5,4 @@ contact_links: about: Please ask and answer general questions here. - name: Technical Discussion url: https://github.com/LemmyNet/lemmy-ui/discussions - about: Please discuss technical topics with other contributors here. \ No newline at end of file + about: Please discuss technical topics with other contributors here. From dd4b60d22460cda70097a086b852630f2d105083 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:22:29 -0400 Subject: [PATCH 05/21] add emojis back to ISSUE_TEMPLATE --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 2 +- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 72b274e1..aeffa3a6 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,4 +1,4 @@ -name: "Bug report" +name: "\U0001F41E Bug report" description: Create a bug report to help us improve Lemmy-UI! title: "" labels: ["bug", "triage"] diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index d998a63d..77d85d27 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -1,4 +1,4 @@ -name: "Feature request" +name: "\U0001F680 Feature request" description: Suggest an idea to improve Lemmy-UI labels: ["enhancement"] body: From a1fc4bbea9e7eb0118bc97be5f98751beac81c14 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:23:43 -0400 Subject: [PATCH 06/21] make suggested changes --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 2 +- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index aeffa3a6..99d612e7 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -18,7 +18,7 @@ body: required: true - label: It's a single bug. I'm not reporting multiple bugs in one issue. required: true - - label: It's a frontend issue, not a backend issue; I'd report that to the [backend repo](https://github.com/LemmyNet/lemmy) instead. + - label: It's a frontend issue, not a backend issue; Otherwise I will create an issue on the [backend repo](https://github.com/LemmyNet/lemmy) instead. required: true - type: textarea id: summary diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index 77d85d27..ed1d6375 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -11,7 +11,7 @@ body: label: Requirements description: Before you create a bug report, please carefully check the following – options: - - label: This is a feature request and not a bug report. Otherwise, I'd create a new [bug report](https://github.com/LemmyNet/lemmy-ui/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml&title=%5BBug%5D%3A+) instead. + - label: This is a feature request and not a bug report. Otherwise, I will create a new [bug report](https://github.com/LemmyNet/lemmy-ui/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml&title=%5BBug%5D%3A+) instead. required: true - label: I've [checked](https://github.com/LemmyNet/lemmy-ui/issues) to see if this request (or a similar one) already exists. required: true From 5a9d15f8f81307cf401115c215c25e7ba8500622 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:24:12 -0400 Subject: [PATCH 07/21] good catch --- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index ed1d6375..b8ec1b5b 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -9,7 +9,7 @@ body: - type: checkboxes attributes: label: Requirements - description: Before you create a bug report, please carefully check the following – + description: Before you create a feature request, please carefully check the following – options: - label: This is a feature request and not a bug report. Otherwise, I will create a new [bug report](https://github.com/LemmyNet/lemmy-ui/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml&title=%5BBug%5D%3A+) instead. required: true From 6a88e8a24ac63158116eed112e88f675e8128a73 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:24:49 -0400 Subject: [PATCH 08/21] change verbiage --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 99d612e7..c88b22e6 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -12,7 +12,7 @@ body: label: Requirements description: Before you create a bug report, please carefully check the following – options: - - label: This is a bug report, and if not, I'd post to https://lemmy.ml/c/lemmy_support instead. + - label: This is a bug report, and if not, I will post to https://lemmy.ml/c/lemmy_support instead. required: true - label: I've [checked](https://github.com/LemmyNet/lemmy-ui/issues) to see if this issue already exists. required: true From 46323c91730c120205c32c84b0f270db14fd0193 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:01:04 -0400 Subject: [PATCH 09/21] make suggested changes --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 8 ++++---- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index c88b22e6..5561b888 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -12,13 +12,13 @@ body: label: Requirements description: Before you create a bug report, please carefully check the following – options: - - label: This is a bug report, and if not, I will post to https://lemmy.ml/c/lemmy_support instead. + - label: This is a bug report, and if not, please post to https://lemmy.ml/c/lemmy_support instead. required: true - - label: I've [checked](https://github.com/LemmyNet/lemmy-ui/issues) to see if this issue already exists. + - label: Please [check](https://github.com/LemmyNet/lemmy-ui/issues) to see if this issue already exists. required: true - - label: It's a single bug. I'm not reporting multiple bugs in one issue. + - label: It's a single bug. Do not report multiple bugs in one issue. required: true - - label: It's a frontend issue, not a backend issue; Otherwise I will create an issue on the [backend repo](https://github.com/LemmyNet/lemmy) instead. + - label: It's a frontend issue, not a backend issue; Otherwise please create an issue on the [backend repo](https://github.com/LemmyNet/lemmy) instead. required: true - type: textarea id: summary diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index b8ec1b5b..ed5da331 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -11,11 +11,11 @@ body: label: Requirements description: Before you create a feature request, please carefully check the following – options: - - label: This is a feature request and not a bug report. Otherwise, I will create a new [bug report](https://github.com/LemmyNet/lemmy-ui/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml&title=%5BBug%5D%3A+) instead. + - label: This is a feature request and not a bug report. Otherwise, please create a new [bug report](https://github.com/LemmyNet/lemmy-ui/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=BUG_REPORT.yml) instead. required: true - - label: I've [checked](https://github.com/LemmyNet/lemmy-ui/issues) to see if this request (or a similar one) already exists. + - label: Please [check](https://github.com/LemmyNet/lemmy-ui/issues) to see if this request (or a similar one) already exists. required: true - - label: It's a single feature. I'm not requesting multiple features in one issue. + - label: It's a single feature. Please don't request multiple features in one issue. required: true - type: textarea id: solution From 91a07e79fc3f7e345bb59c6471c6bdff3eeeff7b Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:44:15 -0400 Subject: [PATCH 10/21] fix lack of modlog refetch on mount (#1490) Co-authored-by: Dessalines --- src/shared/components/modlog.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index e705bac8..722f6e70 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -686,6 +686,10 @@ export class Modlog extends Component< } } + async componentDidMount() { + await this.refetch(); + } + get combined() { const res = this.state.res; const combined = res.state == "success" ? buildCombined(res.data) : []; From 317c0852500ef8e02b1d597966df96f24a865473 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 18:53:43 -0400 Subject: [PATCH 11/21] remove title attr (#1492) --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 5561b888..f37b108a 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,6 +1,5 @@ name: "\U0001F41E Bug report" description: Create a bug report to help us improve Lemmy-UI! -title: "" labels: ["bug", "triage"] body: - type: markdown From 205cd83b4ace941a1e44e47a8956c3843f4538ff Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:04:15 -0400 Subject: [PATCH 12/21] `ISSUE_TEMPLATE` cleanup (#1493) --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 5 ++--- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index f37b108a..da7fa2bd 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,5 +1,5 @@ name: "\U0001F41E Bug report" -description: Create a bug report to help us improve Lemmy-UI! +description: Report a bug to help us improve Lemmy-UI. labels: ["bug", "triage"] body: - type: markdown @@ -38,7 +38,6 @@ body: 2. 3. 4. - 5. validations: required: true - type: textarea @@ -62,5 +61,5 @@ body: id: lemmy-instance attributes: label: Lemmy Instance URL - description: The URL of the Lemmy instance where the bug can be reproduced. + description: What's the URL of the Lemmy instance where the bug can be reproduced? placeholder: https://lemmy.ml diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index ed5da331..ac7d8dc6 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -1,5 +1,5 @@ name: "\U0001F680 Feature request" -description: Suggest an idea to improve Lemmy-UI +description: Suggest an idea for Lemmy-UI. labels: ["enhancement"] body: - type: markdown From ca6d2fbbfb95151531c655e302b9473af6ce2434 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 20:27:27 -0400 Subject: [PATCH 13/21] remove bullet list items --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 5561b888..4931726e 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -47,8 +47,8 @@ body: attributes: label: Technical Details description: | - - Describe your environment (OS, browser, model of smartphone, etc) - - If relevant, also share any console errors and/or screenshots here. + Describe your environment (OS, browser, model of smartphone, etc) + If relevant, also share any console errors and/or screenshots here. validations: required: true - type: input From fdb370a88d0c785c377174513132e5de2cd65134 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 22 Jun 2023 21:16:51 -0400 Subject: [PATCH 14/21] v0.18.0-rc.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e7a0f1b..aaf623a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lemmy-ui", - "version": "0.18.0-rc.6", + "version": "0.18.0-rc.7", "description": "An isomorphic UI for lemmy", "repository": "https://github.com/LemmyNet/lemmy-ui", "license": "AGPL-3.0", From d127b5626da30d746aaacd37b4a0f7da5fc6ca22 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 22:46:38 -0400 Subject: [PATCH 15/21] Fix inability to go to Home from Settings (#1506) --- src/shared/components/home/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index 4a84664b..bad771fc 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -642,7 +642,7 @@ export class Home extends Component { const siteRes = this.state.siteRes; if (dataType === DataType.Post) { - switch (this.state.postsRes.state) { + switch (this.state.postsRes?.state) { case "loading": return (
From e5e8f29c67b6c154fa46164329a4cb30ee1c82db Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Thu, 22 Jun 2023 22:56:51 -0400 Subject: [PATCH 16/21] Remove `noIndent` prop from comment nodes on person view (#1491) * remove noIdent prop from person details comment nodes * remove noIndent prop from usage in Inbox --- src/shared/components/person/inbox.tsx | 4 ---- src/shared/components/person/person-details.tsx | 1 - 2 files changed, 5 deletions(-) diff --git a/src/shared/components/person/inbox.tsx b/src/shared/components/person/inbox.tsx index 062fc01c..395875be 100644 --- a/src/shared/components/person/inbox.tsx +++ b/src/shared/components/person/inbox.tsx @@ -449,7 +449,6 @@ export class Inbox extends Component { ]} viewType={CommentViewType.Flat} finished={this.state.finished} - noIndent markable showCommunity showContext @@ -489,7 +488,6 @@ export class Inbox extends Component { ]} finished={this.state.finished} viewType={CommentViewType.Flat} - noIndent markable showCommunity showContext @@ -567,7 +565,6 @@ export class Inbox extends Component { nodes={commentsToFlatNodes(replies)} viewType={CommentViewType.Flat} finished={this.state.finished} - noIndent markable showCommunity showContext @@ -617,7 +614,6 @@ export class Inbox extends Component { nodes={[{ comment_view: umv, children: [], depth: 0 }]} viewType={CommentViewType.Flat} finished={this.state.finished} - noIndent markable showCommunity showContext diff --git a/src/shared/components/person/person-details.tsx b/src/shared/components/person/person-details.tsx index 3771b844..b2b74b6e 100644 --- a/src/shared/components/person/person-details.tsx +++ b/src/shared/components/person/person-details.tsx @@ -145,7 +145,6 @@ export class PersonDetails extends Component { finished={this.props.finished} admins={this.props.admins} noBorder - noIndent showCommunity showContext enableDownvotes={this.props.enableDownvotes} From 2c85c87e4494210f55522653deb8e552b84cbc23 Mon Sep 17 00:00:00 2001 From: dudeami0 Date: Thu, 22 Jun 2023 23:30:42 -0400 Subject: [PATCH 17/21] Fix server-side rendering after first load. --- src/shared/components/community/communities.tsx | 3 ++- src/shared/components/community/community.tsx | 3 ++- src/shared/components/home/admin-settings.tsx | 3 ++- src/shared/components/home/home.tsx | 3 ++- src/shared/components/home/instances.tsx | 3 ++- src/shared/components/modlog.tsx | 3 ++- src/shared/components/person/inbox.tsx | 3 ++- src/shared/components/person/profile.tsx | 8 ++++++-- .../components/person/registration-applications.tsx | 3 ++- src/shared/components/person/reports.tsx | 3 ++- src/shared/components/post/create-post.tsx | 3 ++- src/shared/components/post/post.tsx | 2 +- .../components/private_message/create-private-message.tsx | 3 ++- src/shared/components/search.tsx | 8 ++++++-- 14 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/shared/components/community/communities.tsx b/src/shared/components/community/communities.tsx index a84ec055..35e89c36 100644 --- a/src/shared/components/community/communities.tsx +++ b/src/shared/components/community/communities.tsx @@ -5,6 +5,7 @@ import { setIsoData, showLocal, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { getPageFromString, getQueryParams, @@ -67,7 +68,7 @@ export class Communities extends Component { this.handleListingTypeChange = this.handleListingTypeChange.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { listCommunitiesResponse } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index 111b47cd..3e7615a9 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -15,6 +15,7 @@ import { updateCommunityBlock, updatePersonBlock, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { getPageFromString, getQueryParams, @@ -197,7 +198,7 @@ export class Community extends Component< this.handleFeaturePost = this.handleFeaturePost.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { communityRes, commentsRes, postsRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/home/admin-settings.tsx b/src/shared/components/home/admin-settings.tsx index 7ac69fed..6ab5b659 100644 --- a/src/shared/components/home/admin-settings.tsx +++ b/src/shared/components/home/admin-settings.tsx @@ -4,6 +4,7 @@ import { setIsoData, showLocal, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { capitalizeFirstLetter } from "@utils/helpers"; import { RouteDataResponse } from "@utils/types"; import classNames from "classnames"; @@ -74,7 +75,7 @@ export class AdminSettings extends Component { this.handleCreateEmoji = this.handleCreateEmoji.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { bannedRes, instancesRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index bad771fc..da1be70b 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -13,6 +13,7 @@ import { showLocal, updatePersonBlock, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { getPageFromString, getQueryParams, @@ -263,7 +264,7 @@ export class Home extends Component { this.handleFeaturePost = this.handleFeaturePost.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { trendingCommunitiesRes, commentsRes, postsRes } = this.isoData.routeData; diff --git a/src/shared/components/home/instances.tsx b/src/shared/components/home/instances.tsx index b54c96af..9c38cf41 100644 --- a/src/shared/components/home/instances.tsx +++ b/src/shared/components/home/instances.tsx @@ -1,4 +1,5 @@ import { setIsoData } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component } from "inferno"; import { @@ -35,7 +36,7 @@ export class Instances extends Component { super(props, context); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { this.state = { ...this.state, instancesRes: this.isoData.routeData.federatedInstancesResponse, diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index 722f6e70..e8c707ed 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -5,6 +5,7 @@ import { personToChoice, setIsoData, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { debounce, getIdFromString, @@ -660,7 +661,7 @@ export class Modlog extends Component< this.handleModChange = this.handleModChange.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { res, communityRes, modUserResponse, userResponse } = this.isoData.routeData; diff --git a/src/shared/components/person/inbox.tsx b/src/shared/components/person/inbox.tsx index 395875be..3c913701 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 { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; import { @@ -163,7 +164,7 @@ export class Inbox extends Component { this.handleEditMessage = this.handleEditMessage.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { mentionsRes, messagesRes, repliesRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index d0003687..6e0530d9 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -10,7 +10,11 @@ import { setIsoData, updatePersonBlock, } from "@utils/app"; -import { restoreScrollPosition, saveScrollPosition } from "@utils/browser"; +import { + isBrowser, + restoreScrollPosition, + saveScrollPosition, +} from "@utils/browser"; import { capitalizeFirstLetter, futureDaysToUnixTime, @@ -206,7 +210,7 @@ export class Profile extends Component< this.handleFeaturePost = this.handleFeaturePost.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { this.state = { ...this.state, personRes: this.isoData.routeData.personResponse, diff --git a/src/shared/components/person/registration-applications.tsx b/src/shared/components/person/registration-applications.tsx index d9eb6ad0..5e92c073 100644 --- a/src/shared/components/person/registration-applications.tsx +++ b/src/shared/components/person/registration-applications.tsx @@ -3,6 +3,7 @@ import { myAuthRequired, setIsoData, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; import { @@ -58,7 +59,7 @@ export class RegistrationApplications extends Component< this.handleApproveApplication = this.handleApproveApplication.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { this.state = { ...this.state, appsRes: this.isoData.routeData.listRegistrationApplicationsResponse, diff --git a/src/shared/components/person/reports.tsx b/src/shared/components/person/reports.tsx index 8f5eaf36..9d04c8a7 100644 --- a/src/shared/components/person/reports.tsx +++ b/src/shared/components/person/reports.tsx @@ -5,6 +5,7 @@ import { myAuthRequired, setIsoData, } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { amAdmin } from "@utils/roles"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; @@ -108,7 +109,7 @@ export class Reports extends Component { this.handleResolvePrivateMessageReport.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { commentReportsRes, postReportsRes, messageReportsRes } = this.isoData.routeData; diff --git a/src/shared/components/post/create-post.tsx b/src/shared/components/post/create-post.tsx index fe941830..ed686f31 100644 --- a/src/shared/components/post/create-post.tsx +++ b/src/shared/components/post/create-post.tsx @@ -1,4 +1,5 @@ import { enableDownvotes, enableNsfw, myAuth, setIsoData } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { getIdFromString, getQueryParams } from "@utils/helpers"; import type { QueryParams } from "@utils/types"; import { Choice, RouteDataResponse } from "@utils/types"; @@ -69,7 +70,7 @@ export class CreatePost extends Component< this.handleSelectedCommunityChange.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { communityResponse: communityRes, initialCommunitiesRes } = this.isoData.routeData; diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index f0aa3ff5..54823f22 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -174,7 +174,7 @@ export class Post extends Component { this.state = { ...this.state, commentSectionRef: createRef() }; // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { commentsRes, postRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/private_message/create-private-message.tsx b/src/shared/components/private_message/create-private-message.tsx index 8afd3488..89ed7598 100644 --- a/src/shared/components/private_message/create-private-message.tsx +++ b/src/shared/components/private_message/create-private-message.tsx @@ -1,4 +1,5 @@ import { getRecipientIdFromProps, myAuth, setIsoData } from "@utils/app"; +import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component } from "inferno"; import { @@ -44,7 +45,7 @@ export class CreatePrivateMessage extends Component< this.handlePrivateMessageCreate.bind(this); // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { this.state = { ...this.state, recipientRes: this.isoData.routeData.recipientDetailsResponse, diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 473b18c4..3d04c500 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -11,7 +11,11 @@ import { setIsoData, showLocal, } from "@utils/app"; -import { restoreScrollPosition, saveScrollPosition } from "@utils/browser"; +import { + isBrowser, + restoreScrollPosition, + saveScrollPosition, +} from "@utils/browser"; import { capitalizeFirstLetter, debounce, @@ -270,7 +274,7 @@ export class Search extends Component { }; // Only fetch the data if coming from another route - if (FirstLoadService.isFirstLoad) { + if (!isBrowser() || FirstLoadService.isFirstLoad) { const { communityResponse: communityRes, creatorDetailsResponse: creatorDetailsRes, From d706b6ba27866ad8b57d9b48743f04e63ba2dcbe Mon Sep 17 00:00:00 2001 From: dudeami0 Date: Fri, 23 Jun 2023 01:04:03 -0400 Subject: [PATCH 18/21] Moved `!isBrowser()` check to `FirstLoadServer.isFirstLoad` --- src/shared/components/community/communities.tsx | 3 +-- src/shared/components/community/community.tsx | 3 +-- src/shared/components/home/admin-settings.tsx | 3 +-- src/shared/components/home/home.tsx | 3 +-- src/shared/components/home/instances.tsx | 3 +-- src/shared/components/modlog.tsx | 3 +-- src/shared/components/person/inbox.tsx | 3 +-- src/shared/components/person/profile.tsx | 8 ++------ .../components/person/registration-applications.tsx | 3 +-- src/shared/components/person/reports.tsx | 3 +-- src/shared/components/post/create-post.tsx | 3 +-- src/shared/components/post/post.tsx | 2 +- .../components/private_message/create-private-message.tsx | 3 +-- src/shared/components/search.tsx | 8 ++------ src/shared/services/FirstLoadService.ts | 4 +++- 15 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/shared/components/community/communities.tsx b/src/shared/components/community/communities.tsx index 35e89c36..a84ec055 100644 --- a/src/shared/components/community/communities.tsx +++ b/src/shared/components/community/communities.tsx @@ -5,7 +5,6 @@ import { setIsoData, showLocal, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { getPageFromString, getQueryParams, @@ -68,7 +67,7 @@ export class Communities extends Component { this.handleListingTypeChange = this.handleListingTypeChange.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { listCommunitiesResponse } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index 3e7615a9..111b47cd 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -15,7 +15,6 @@ import { updateCommunityBlock, updatePersonBlock, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { getPageFromString, getQueryParams, @@ -198,7 +197,7 @@ export class Community extends Component< this.handleFeaturePost = this.handleFeaturePost.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { communityRes, commentsRes, postsRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/home/admin-settings.tsx b/src/shared/components/home/admin-settings.tsx index 6ab5b659..7ac69fed 100644 --- a/src/shared/components/home/admin-settings.tsx +++ b/src/shared/components/home/admin-settings.tsx @@ -4,7 +4,6 @@ import { setIsoData, showLocal, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { capitalizeFirstLetter } from "@utils/helpers"; import { RouteDataResponse } from "@utils/types"; import classNames from "classnames"; @@ -75,7 +74,7 @@ export class AdminSettings extends Component { this.handleCreateEmoji = this.handleCreateEmoji.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { bannedRes, instancesRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index da1be70b..bad771fc 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -13,7 +13,6 @@ import { showLocal, updatePersonBlock, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { getPageFromString, getQueryParams, @@ -264,7 +263,7 @@ export class Home extends Component { this.handleFeaturePost = this.handleFeaturePost.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { trendingCommunitiesRes, commentsRes, postsRes } = this.isoData.routeData; diff --git a/src/shared/components/home/instances.tsx b/src/shared/components/home/instances.tsx index 9c38cf41..b54c96af 100644 --- a/src/shared/components/home/instances.tsx +++ b/src/shared/components/home/instances.tsx @@ -1,5 +1,4 @@ import { setIsoData } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component } from "inferno"; import { @@ -36,7 +35,7 @@ export class Instances extends Component { super(props, context); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { this.state = { ...this.state, instancesRes: this.isoData.routeData.federatedInstancesResponse, diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index e8c707ed..722f6e70 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -5,7 +5,6 @@ import { personToChoice, setIsoData, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { debounce, getIdFromString, @@ -661,7 +660,7 @@ export class Modlog extends Component< this.handleModChange = this.handleModChange.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { res, communityRes, modUserResponse, userResponse } = this.isoData.routeData; diff --git a/src/shared/components/person/inbox.tsx b/src/shared/components/person/inbox.tsx index 3c913701..395875be 100644 --- a/src/shared/components/person/inbox.tsx +++ b/src/shared/components/person/inbox.tsx @@ -11,7 +11,6 @@ import { setIsoData, updatePersonBlock, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; import { @@ -164,7 +163,7 @@ export class Inbox extends Component { this.handleEditMessage = this.handleEditMessage.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { mentionsRes, messagesRes, repliesRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index 6e0530d9..d0003687 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -10,11 +10,7 @@ import { setIsoData, updatePersonBlock, } from "@utils/app"; -import { - isBrowser, - restoreScrollPosition, - saveScrollPosition, -} from "@utils/browser"; +import { restoreScrollPosition, saveScrollPosition } from "@utils/browser"; import { capitalizeFirstLetter, futureDaysToUnixTime, @@ -210,7 +206,7 @@ export class Profile extends Component< this.handleFeaturePost = this.handleFeaturePost.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { this.state = { ...this.state, personRes: this.isoData.routeData.personResponse, diff --git a/src/shared/components/person/registration-applications.tsx b/src/shared/components/person/registration-applications.tsx index 5e92c073..d9eb6ad0 100644 --- a/src/shared/components/person/registration-applications.tsx +++ b/src/shared/components/person/registration-applications.tsx @@ -3,7 +3,6 @@ import { myAuthRequired, setIsoData, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; import { @@ -59,7 +58,7 @@ export class RegistrationApplications extends Component< this.handleApproveApplication = this.handleApproveApplication.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { this.state = { ...this.state, appsRes: this.isoData.routeData.listRegistrationApplicationsResponse, diff --git a/src/shared/components/person/reports.tsx b/src/shared/components/person/reports.tsx index 9d04c8a7..8f5eaf36 100644 --- a/src/shared/components/person/reports.tsx +++ b/src/shared/components/person/reports.tsx @@ -5,7 +5,6 @@ import { myAuthRequired, setIsoData, } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { amAdmin } from "@utils/roles"; import { RouteDataResponse } from "@utils/types"; import { Component, linkEvent } from "inferno"; @@ -109,7 +108,7 @@ export class Reports extends Component { this.handleResolvePrivateMessageReport.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { commentReportsRes, postReportsRes, messageReportsRes } = this.isoData.routeData; diff --git a/src/shared/components/post/create-post.tsx b/src/shared/components/post/create-post.tsx index ed686f31..fe941830 100644 --- a/src/shared/components/post/create-post.tsx +++ b/src/shared/components/post/create-post.tsx @@ -1,5 +1,4 @@ import { enableDownvotes, enableNsfw, myAuth, setIsoData } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { getIdFromString, getQueryParams } from "@utils/helpers"; import type { QueryParams } from "@utils/types"; import { Choice, RouteDataResponse } from "@utils/types"; @@ -70,7 +69,7 @@ export class CreatePost extends Component< this.handleSelectedCommunityChange.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { communityResponse: communityRes, initialCommunitiesRes } = this.isoData.routeData; diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index 54823f22..f0aa3ff5 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -174,7 +174,7 @@ export class Post extends Component { this.state = { ...this.state, commentSectionRef: createRef() }; // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { commentsRes, postRes } = this.isoData.routeData; this.state = { diff --git a/src/shared/components/private_message/create-private-message.tsx b/src/shared/components/private_message/create-private-message.tsx index 89ed7598..8afd3488 100644 --- a/src/shared/components/private_message/create-private-message.tsx +++ b/src/shared/components/private_message/create-private-message.tsx @@ -1,5 +1,4 @@ import { getRecipientIdFromProps, myAuth, setIsoData } from "@utils/app"; -import { isBrowser } from "@utils/browser"; import { RouteDataResponse } from "@utils/types"; import { Component } from "inferno"; import { @@ -45,7 +44,7 @@ export class CreatePrivateMessage extends Component< this.handlePrivateMessageCreate.bind(this); // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { this.state = { ...this.state, recipientRes: this.isoData.routeData.recipientDetailsResponse, diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 3d04c500..473b18c4 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -11,11 +11,7 @@ import { setIsoData, showLocal, } from "@utils/app"; -import { - isBrowser, - restoreScrollPosition, - saveScrollPosition, -} from "@utils/browser"; +import { restoreScrollPosition, saveScrollPosition } from "@utils/browser"; import { capitalizeFirstLetter, debounce, @@ -274,7 +270,7 @@ export class Search extends Component { }; // Only fetch the data if coming from another route - if (!isBrowser() || FirstLoadService.isFirstLoad) { + if (FirstLoadService.isFirstLoad) { const { communityResponse: communityRes, creatorDetailsResponse: creatorDetailsRes, diff --git a/src/shared/services/FirstLoadService.ts b/src/shared/services/FirstLoadService.ts index b7558eff..926e3acd 100644 --- a/src/shared/services/FirstLoadService.ts +++ b/src/shared/services/FirstLoadService.ts @@ -1,3 +1,5 @@ +import { isBrowser } from "@utils/browser"; + export class FirstLoadService { #isFirstLoad: boolean; static #instance: FirstLoadService; @@ -20,6 +22,6 @@ export class FirstLoadService { } static get isFirstLoad() { - return this.#Instance.isFirstLoad; + return !isBrowser() || this.#Instance.isFirstLoad; } } From 2f5933240084c309e634b6fd9158881f51f4d21a Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 23 Jun 2023 07:06:05 -0400 Subject: [PATCH 19/21] v0.18.0-rc.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aaf623a6..b43a568b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lemmy-ui", - "version": "0.18.0-rc.7", + "version": "0.18.0-rc.8", "description": "An isomorphic UI for lemmy", "repository": "https://github.com/LemmyNet/lemmy-ui", "license": "AGPL-3.0", From 4a7bfe41d9ba053649fd57259fa9b8fba913ea41 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 23 Jun 2023 08:40:00 -0400 Subject: [PATCH 20/21] v0.18.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b43a568b..45d4daf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lemmy-ui", - "version": "0.18.0-rc.8", + "version": "0.18.0", "description": "An isomorphic UI for lemmy", "repository": "https://github.com/LemmyNet/lemmy-ui", "license": "AGPL-3.0", From 955afeac3c084c0db9df426f6e960cf76c0bf2f4 Mon Sep 17 00:00:00 2001 From: dudeami0 Date: Fri, 23 Jun 2023 08:54:55 -0400 Subject: [PATCH 21/21] Fix homepage `scrollTo(0, 0)` failing when document size changes. --- src/shared/components/home/home.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index bad771fc..71e5842e 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -101,6 +101,7 @@ interface HomeState { showTrendingMobile: boolean; showSidebarMobile: boolean; subscribedCollapsed: boolean; + scrolled: boolean; tagline?: string; siteRes: GetSiteResponse; finished: Map; @@ -217,6 +218,7 @@ export class Home extends Component { postsRes: { state: "empty" }, commentsRes: { state: "empty" }, trendingCommunitiesRes: { state: "empty" }, + scrolled: true, siteRes: this.isoData.site_res, showSubscribedMobile: false, showTrendingMobile: false, @@ -620,6 +622,11 @@ export class Home extends Component { search: getQueryString(queryParams), }); + if (!this.state.scrolled) { + this.setState({ scrolled: true }); + setTimeout(() => window.scrollTo(0, 0), 0); + } + await this.fetchData(); } @@ -815,23 +822,23 @@ export class Home extends Component { } handlePageChange(page: number) { + this.setState({ scrolled: false }); this.updateUrl({ page }); - window.scrollTo(0, 0); } handleSortChange(val: SortType) { + this.setState({ scrolled: false }); this.updateUrl({ sort: val, page: 1 }); - window.scrollTo(0, 0); } handleListingTypeChange(val: ListingType) { + this.setState({ scrolled: false }); this.updateUrl({ listingType: val, page: 1 }); - window.scrollTo(0, 0); } handleDataTypeChange(val: DataType) { + this.setState({ scrolled: false }); this.updateUrl({ dataType: val, page: 1 }); - window.scrollTo(0, 0); } async handleAddModToCommunity(form: AddModToCommunity) {