From 8e711c6b543f3ce75638d9adcc089d15d5f7e4e3 Mon Sep 17 00:00:00 2001 From: Jay Sitter Date: Wed, 21 Jun 2023 19:24:01 -0400 Subject: [PATCH 01/28] 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/28] 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 92482cbe6b1003d4c89ba12b628f163483752acb Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 00:48:09 -0300 Subject: [PATCH 03/28] Add local community link parser plugin for Markdown-It --- src/shared/markdown.ts | 75 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index 8f4d5c23..c837dba6 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -14,6 +14,7 @@ import markdown_it_sub from "markdown-it-sub"; import markdown_it_sup from "markdown-it-sup"; import Renderer from "markdown-it/lib/renderer"; import Token from "markdown-it/lib/token"; +import { getHttpBase } from "./env"; export let Tribute: any; @@ -72,6 +73,76 @@ const html5EmbedConfig = { }, }; +function localCommunityLinkParser(md) { + const pattern = + /(!\b[^@\s]+@[^@\s]+\.[^.\s]+\b)|\/c\/([^@\s]+)(@[^@\s]+\.[^.\s]+\b)?/g; + + md.core.ruler.push("replace-text", state => { + const tokens = state.tokens; + + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].type === "inline") { + const token = tokens[i]; + + const originalContent = token.content; + + let lastIndex = 0; + originalContent.replace( + pattern, + (match, fullDomainMatch, name, domainTld, index) => { + let url; + // ex: !Testing@example.com + if (fullDomainMatch) { + const [name, domain, tld] = fullDomainMatch + .slice(1) + .split("@") + .join(".") + .split("."); + url = `${getHttpBase()}/c/${name}@${domain}.${tld}`; + } else { + // ex: /c/Testing or /c/Testing@example.com + url = `${getHttpBase()}/c/${name}${domainTld || ""}`; + } + + const beforeContent = originalContent.slice(lastIndex, index); + lastIndex = index + match.length; + + const beforeToken = new state.Token("text", "", 0); + beforeToken.content = beforeContent; + + const linkOpenToken = new state.Token("link_open", "a", 1); + linkOpenToken.attrs = [["href", url]]; + + const textToken = new state.Token("text", "", 0); + textToken.content = match; + + const linkCloseToken = new state.Token("link_close", "a", -1); + + const afterContent = originalContent.slice(lastIndex); + const afterToken = new state.Token("text", "", 0); + afterToken.content = afterContent; + + tokens.splice(i, 1); + + tokens.splice( + i, + 0, + beforeToken, + linkOpenToken, + textToken, + linkCloseToken, + afterToken + ); + + // Update i to skip the newly added tokens + i += 4; + } + ); + } + } + }); +} + export function setupMarkdown() { const markdownItConfig: MarkdownIt.Options = { html: false, @@ -88,7 +159,8 @@ export function setupMarkdown() { .use(markdown_it_sup) .use(markdown_it_footnote) .use(markdown_it_html5_embed, html5EmbedConfig) - .use(markdown_it_container, "spoiler", spoilerConfig); + .use(markdown_it_container, "spoiler", spoilerConfig) + .use(localCommunityLinkParser); // .use(markdown_it_emoji, { // defs: emojiDefs, // }); @@ -99,6 +171,7 @@ export function setupMarkdown() { .use(markdown_it_footnote) .use(markdown_it_html5_embed, html5EmbedConfig) .use(markdown_it_container, "spoiler", spoilerConfig) + .use(localCommunityLinkParser) // .use(markdown_it_emoji, { // defs: emojiDefs, // }) From 02717be15c7aa94f6ef5e6fd1ecb97ac61d85ad6 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 01:07:33 -0300 Subject: [PATCH 04/28] Add community link class --- src/shared/markdown.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index c837dba6..6e6b504f 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -111,7 +111,10 @@ function localCommunityLinkParser(md) { beforeToken.content = beforeContent; const linkOpenToken = new state.Token("link_open", "a", 1); - linkOpenToken.attrs = [["href", url]]; + linkOpenToken.attrs = [ + ["href", url], + ["class", "community-link"], + ]; const textToken = new state.Token("text", "", 0); textToken.content = match; From 07235d7a5b3385e45d71102404f515a7bb54fe40 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 13:44:43 -0300 Subject: [PATCH 05/28] Update getHttpBase dependency reference --- src/shared/markdown.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index 6e6b504f..d35b469e 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -8,13 +8,13 @@ import { CustomEmojiView } from "lemmy-js-client"; import { default as MarkdownIt } from "markdown-it"; import markdown_it_container from "markdown-it-container"; // import markdown_it_emoji from "markdown-it-emoji/bare"; +import { getHttpBase } from "@utils/env"; import markdown_it_footnote from "markdown-it-footnote"; import markdown_it_html5_embed from "markdown-it-html5-embed"; import markdown_it_sub from "markdown-it-sub"; import markdown_it_sup from "markdown-it-sup"; import Renderer from "markdown-it/lib/renderer"; import Token from "markdown-it/lib/token"; -import { getHttpBase } from "./env"; export let Tribute: any; From c5779cd9b1e669fe6b8220e5c2dff0c125ed04e9 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 14:28:32 -0300 Subject: [PATCH 06/28] Update community link markdown parsing Remove links without remote servers, add kbin support, add user support --- src/shared/markdown.ts | 114 +++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 61 deletions(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index d35b469e..f56817e6 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -8,7 +8,6 @@ import { CustomEmojiView } from "lemmy-js-client"; import { default as MarkdownIt } from "markdown-it"; import markdown_it_container from "markdown-it-container"; // import markdown_it_emoji from "markdown-it-emoji/bare"; -import { getHttpBase } from "@utils/env"; import markdown_it_footnote from "markdown-it-footnote"; import markdown_it_html5_embed from "markdown-it-html5-embed"; import markdown_it_sub from "markdown-it-sub"; @@ -74,73 +73,66 @@ const html5EmbedConfig = { }; function localCommunityLinkParser(md) { - const pattern = - /(!\b[^@\s]+@[^@\s]+\.[^.\s]+\b)|\/c\/([^@\s]+)(@[^@\s]+\.[^.\s]+\b)?/g; - md.core.ruler.push("replace-text", state => { - const tokens = state.tokens; + /** + * Accepted formats: + * !community@server.com + * /c/community@server.com + * /m/community@server.com + * /u/username@server.com + */ + const pattern = + /(\/[c|m|u]\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|![a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g; - for (let i = 0; i < tokens.length; i++) { - if (tokens[i].type === "inline") { - const token = tokens[i]; + for (let i = 0; i < state.tokens.length; i++) { + if (state.tokens[i].type !== "inline") { + continue; + } + const inlineTokens = state.tokens[i].children; + for (let j = inlineTokens.length - 1; j >= 0; j--) { + if ( + inlineTokens[j].type === "text" && + pattern.test(inlineTokens[j].content) + ) { + const textParts = inlineTokens[j].content.split(pattern); + const newTokens: Token[] = []; - const originalContent = token.content; + for (const part of textParts) { + let linkClass = "community-link"; + if (pattern.test(part)) { + // Rewrite !community@server.com and KBin /m/community@server.com to local urls + let href; + if (part.startsWith("!")) { + href = "/c/" + part.substring(1); + } else if (part.startsWith("/m/")) { + href = "/c/" + part.substring(3); + } else { + href = part; + if (part.startsWith("/u/")) { + linkClass = "user-link"; + } + } - let lastIndex = 0; - originalContent.replace( - pattern, - (match, fullDomainMatch, name, domainTld, index) => { - let url; - // ex: !Testing@example.com - if (fullDomainMatch) { - const [name, domain, tld] = fullDomainMatch - .slice(1) - .split("@") - .join(".") - .split("."); - url = `${getHttpBase()}/c/${name}@${domain}.${tld}`; + const linkOpenToken = new state.Token("link_open", "a", 1); + linkOpenToken.attrs = [ + ["href", href], + ["class", linkClass], + ]; + const textToken = new state.Token("text", "", 0); + textToken.content = part; + const linkCloseToken = new state.Token("link_close", "a", -1); + + newTokens.push(linkOpenToken, textToken, linkCloseToken); } else { - // ex: /c/Testing or /c/Testing@example.com - url = `${getHttpBase()}/c/${name}${domainTld || ""}`; + const textToken = new state.Token("text", "", 0); + textToken.content = part; + newTokens.push(textToken); } - - const beforeContent = originalContent.slice(lastIndex, index); - lastIndex = index + match.length; - - const beforeToken = new state.Token("text", "", 0); - beforeToken.content = beforeContent; - - const linkOpenToken = new state.Token("link_open", "a", 1); - linkOpenToken.attrs = [ - ["href", url], - ["class", "community-link"], - ]; - - const textToken = new state.Token("text", "", 0); - textToken.content = match; - - const linkCloseToken = new state.Token("link_close", "a", -1); - - const afterContent = originalContent.slice(lastIndex); - const afterToken = new state.Token("text", "", 0); - afterToken.content = afterContent; - - tokens.splice(i, 1); - - tokens.splice( - i, - 0, - beforeToken, - linkOpenToken, - textToken, - linkCloseToken, - afterToken - ); - - // Update i to skip the newly added tokens - i += 4; } - ); + + // Replace the original token with the new tokens + inlineTokens.splice(j, 1, ...newTokens); + } } } }); 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 07/28] 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 08/28] 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 fc0c0634269fb57dad2e75f6b5bf5c1aa06fabf8 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 15:17:34 -0300 Subject: [PATCH 09/28] Move regex pattern to config --- src/shared/config.ts | 10 ++++++++++ src/shared/markdown.ts | 17 ++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/shared/config.ts b/src/shared/config.ts index 28e8ce51..6b462244 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -25,4 +25,14 @@ export const fetchLimit = 40; export const relTags = "noopener nofollow"; export const emDash = "\u2014"; +/** + * Accepted formats: + * !community@server.com + * /c/community@server.com + * /m/community@server.com + * /u/username@server.com + */ +export const instanceLinkRegex = + /(\/[c|m|u]\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|![a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g; + export const testHost = "0.0.0.0:8536"; diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index f56817e6..d8ed9d50 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -14,6 +14,7 @@ import markdown_it_sub from "markdown-it-sub"; import markdown_it_sup from "markdown-it-sup"; import Renderer from "markdown-it/lib/renderer"; import Token from "markdown-it/lib/token"; +import { instanceLinkRegex } from "./config"; export let Tribute: any; @@ -74,16 +75,6 @@ const html5EmbedConfig = { function localCommunityLinkParser(md) { md.core.ruler.push("replace-text", state => { - /** - * Accepted formats: - * !community@server.com - * /c/community@server.com - * /m/community@server.com - * /u/username@server.com - */ - const pattern = - /(\/[c|m|u]\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|![a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g; - for (let i = 0; i < state.tokens.length; i++) { if (state.tokens[i].type !== "inline") { continue; @@ -92,14 +83,14 @@ function localCommunityLinkParser(md) { for (let j = inlineTokens.length - 1; j >= 0; j--) { if ( inlineTokens[j].type === "text" && - pattern.test(inlineTokens[j].content) + instanceLinkRegex.test(inlineTokens[j].content) ) { - const textParts = inlineTokens[j].content.split(pattern); + const textParts = inlineTokens[j].content.split(instanceLinkRegex); const newTokens: Token[] = []; for (const part of textParts) { let linkClass = "community-link"; - if (pattern.test(part)) { + if (instanceLinkRegex.test(part)) { // Rewrite !community@server.com and KBin /m/community@server.com to local urls let href; if (part.startsWith("!")) { 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 10/28] 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 11/28] 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 12/28] 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 13/28] 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 73147ae37c5ba930a4915fc704a01bfb2744b173 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 15:33:45 -0300 Subject: [PATCH 14/28] Use shorter regex in community link parser --- src/shared/config.ts | 2 +- src/shared/markdown.ts | 69 +++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/shared/config.ts b/src/shared/config.ts index 6b462244..db7e688a 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -33,6 +33,6 @@ export const emDash = "\u2014"; * /u/username@server.com */ export const instanceLinkRegex = - /(\/[c|m|u]\/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|![a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g; + /(\/[c|m|u]\/|!)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g; export const testHost = "0.0.0.0:8536"; diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index d8ed9d50..faab8756 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -73,7 +73,7 @@ const html5EmbedConfig = { }, }; -function localCommunityLinkParser(md) { +function localCommunityLinkParser(md: MarkdownIt) { md.core.ruler.push("replace-text", state => { for (let i = 0; i < state.tokens.length; i++) { if (state.tokens[i].type !== "inline") { @@ -83,42 +83,49 @@ function localCommunityLinkParser(md) { for (let j = inlineTokens.length - 1; j >= 0; j--) { if ( inlineTokens[j].type === "text" && - instanceLinkRegex.test(inlineTokens[j].content) + new RegExp(instanceLinkRegex).test(inlineTokens[j].content) ) { - const textParts = inlineTokens[j].content.split(instanceLinkRegex); + const text = inlineTokens[j].content; + const matches = Array.from(text.matchAll(instanceLinkRegex)); + + let lastIndex = 0; const newTokens: Token[] = []; - for (const part of textParts) { - let linkClass = "community-link"; - if (instanceLinkRegex.test(part)) { - // Rewrite !community@server.com and KBin /m/community@server.com to local urls - let href; - if (part.startsWith("!")) { - href = "/c/" + part.substring(1); - } else if (part.startsWith("/m/")) { - href = "/c/" + part.substring(3); - } else { - href = part; - if (part.startsWith("/u/")) { - linkClass = "user-link"; - } - } - - const linkOpenToken = new state.Token("link_open", "a", 1); - linkOpenToken.attrs = [ - ["href", href], - ["class", linkClass], - ]; + for (const match: RegExpMatchArray of matches) { + // If there is plain text before the match, add it as a separate token + if (match.index !== undefined && match.index > lastIndex) { const textToken = new state.Token("text", "", 0); - textToken.content = part; - const linkCloseToken = new state.Token("link_close", "a", -1); - - newTokens.push(linkOpenToken, textToken, linkCloseToken); - } else { - const textToken = new state.Token("text", "", 0); - textToken.content = part; + textToken.content = text.slice(lastIndex, match.index); newTokens.push(textToken); } + + // Determine the new href + let href; + if (match[0].startsWith("!")) { + href = "/c/" + match[0].substring(1); + } else if (match[0].startsWith("/m/")) { + href = "/c/" + match[0].substring(3); + } else { + href = match[0]; + } + + const linkOpenToken = new state.Token("link_open", "a", 1); + linkOpenToken.attrs = [["href", href]]; + const textToken = new state.Token("text", "", 0); + textToken.content = match[0]; + const linkCloseToken = new state.Token("link_close", "a", -1); + + newTokens.push(linkOpenToken, textToken, linkCloseToken); + + lastIndex = + (match.index !== undefined ? match.index : 0) + match[0].length; + } + + // If there is plain text after the last match, add it as a separate token + if (lastIndex < text.length) { + const textToken = new state.Token("text", "", 0); + textToken.content = text.slice(lastIndex); + newTokens.push(textToken); } // Replace the original token with the new tokens From d6e9b20a6ce29efdb4efe05014581ab5a4142f3b Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 15:40:06 -0300 Subject: [PATCH 15/28] Add missing classes --- src/shared/markdown.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index faab8756..062b150d 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -91,6 +91,8 @@ function localCommunityLinkParser(md: MarkdownIt) { let lastIndex = 0; const newTokens: Token[] = []; + let linkClass = "community-link"; + for (const match: RegExpMatchArray of matches) { // If there is plain text before the match, add it as a separate token if (match.index !== undefined && match.index > lastIndex) { @@ -109,8 +111,15 @@ function localCommunityLinkParser(md: MarkdownIt) { href = match[0]; } + if (match[0].startsWith("/u/")) { + linkClass = "user-link"; + } + const linkOpenToken = new state.Token("link_open", "a", 1); - linkOpenToken.attrs = [["href", href]]; + linkOpenToken.attrs = [ + ["href", href], + ["class", linkClass], + ]; const textToken = new state.Token("text", "", 0); textToken.content = match[0]; const linkCloseToken = new state.Token("link_close", "a", -1); From 773eef5126c8381b42bf1833dc7f040ad7f20b19 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 15:43:01 -0300 Subject: [PATCH 16/28] Remove pipe from community link regex --- 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 db7e688a..c56c64b0 100644 --- a/src/shared/config.ts +++ b/src/shared/config.ts @@ -33,6 +33,6 @@ export const emDash = "\u2014"; * /u/username@server.com */ export const instanceLinkRegex = - /(\/[c|m|u]\/|!)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g; + /(\/[cmu]\/|!)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g; export const testHost = "0.0.0.0:8536"; From 110be607c5da59b14d285a8a8b597e202fa42473 Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 15:51:25 -0300 Subject: [PATCH 17/28] Typescript linter fixes --- src/shared/markdown.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index 062b150d..ececf479 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -79,7 +79,7 @@ function localCommunityLinkParser(md: MarkdownIt) { if (state.tokens[i].type !== "inline") { continue; } - const inlineTokens = state.tokens[i].children; + const inlineTokens: Token[] = state.tokens[i].children || []; for (let j = inlineTokens.length - 1; j >= 0; j--) { if ( inlineTokens[j].type === "text" && @@ -93,7 +93,7 @@ function localCommunityLinkParser(md: MarkdownIt) { let linkClass = "community-link"; - for (const match: RegExpMatchArray of matches) { + for (const match of matches) { // If there is plain text before the match, add it as a separate token if (match.index !== undefined && match.index > lastIndex) { const textToken = new state.Token("text", "", 0); From 7bd90da1f84bf1cfccfa192e4aebf93549685e4e Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 16:02:27 -0300 Subject: [PATCH 18/28] Rename function to be more generic, since it parses users --- src/shared/markdown.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index ececf479..adee474f 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -73,7 +73,7 @@ const html5EmbedConfig = { }, }; -function localCommunityLinkParser(md: MarkdownIt) { +function localInstanceLinkParser(md: MarkdownIt) { md.core.ruler.push("replace-text", state => { for (let i = 0; i < state.tokens.length; i++) { if (state.tokens[i].type !== "inline") { From d58fd63113bc2933377ec2d90f8091b34b16e74f Mon Sep 17 00:00:00 2001 From: Zetaphor Date: Thu, 22 Jun 2023 16:05:20 -0300 Subject: [PATCH 19/28] Cleanup, only check for /u/ if /c/ and /m/ checks fail --- src/shared/markdown.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/shared/markdown.ts b/src/shared/markdown.ts index adee474f..9f1ec733 100644 --- a/src/shared/markdown.ts +++ b/src/shared/markdown.ts @@ -101,7 +101,6 @@ function localInstanceLinkParser(md: MarkdownIt) { newTokens.push(textToken); } - // Determine the new href let href; if (match[0].startsWith("!")) { href = "/c/" + match[0].substring(1); @@ -109,10 +108,9 @@ function localInstanceLinkParser(md: MarkdownIt) { href = "/c/" + match[0].substring(3); } else { href = match[0]; - } - - if (match[0].startsWith("/u/")) { - linkClass = "user-link"; + if (match[0].startsWith("/u/")) { + linkClass = "user-link"; + } } const linkOpenToken = new state.Token("link_open", "a", 1); @@ -137,7 +135,6 @@ function localInstanceLinkParser(md: MarkdownIt) { newTokens.push(textToken); } - // Replace the original token with the new tokens inlineTokens.splice(j, 1, ...newTokens); } } @@ -162,7 +159,7 @@ export function setupMarkdown() { .use(markdown_it_footnote) .use(markdown_it_html5_embed, html5EmbedConfig) .use(markdown_it_container, "spoiler", spoilerConfig) - .use(localCommunityLinkParser); + .use(localInstanceLinkParser); // .use(markdown_it_emoji, { // defs: emojiDefs, // }); @@ -173,7 +170,7 @@ export function setupMarkdown() { .use(markdown_it_footnote) .use(markdown_it_html5_embed, html5EmbedConfig) .use(markdown_it_container, "spoiler", spoilerConfig) - .use(localCommunityLinkParser) + .use(localInstanceLinkParser) // .use(markdown_it_emoji, { // defs: emojiDefs, // }) From 374132923f7527f50b6b001c5683fafae7d6f917 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 22 Jun 2023 16:15:45 -0400 Subject: [PATCH 20/28] Adding jsit to codeowners. --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 76916e60..ee3d7a54 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @dessalines @SleeplessOne1917 @alectrocute +* @dessalines @SleeplessOne1917 @alectrocute @jsit 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 21/28] 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 22/28] 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 23/28] 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 24/28] `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 25/28] 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 26/28] 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 27/28] 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 28/28] 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}