From 6684bbeaf6df12a8725368bee30f191de285db2d Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 24 Feb 2022 15:31:44 +0000 Subject: [PATCH] Adding nofollow to links. Fixes #542 (#543) * Adding nofollow to links. Fixes #542 * Running prettier. --- src/shared/components/common/markdown-textarea.tsx | 3 ++- src/shared/components/common/pictrs-image.tsx | 5 +++-- src/shared/components/common/sort-select.tsx | 4 ++-- src/shared/components/community/community-link.tsx | 3 ++- src/shared/components/community/community.tsx | 3 ++- src/shared/components/home/home.tsx | 7 ++++--- src/shared/components/home/instances.tsx | 4 ++-- src/shared/components/person/inbox.tsx | 3 ++- src/shared/components/person/person-listing.tsx | 3 ++- src/shared/components/person/profile.tsx | 5 +++-- src/shared/components/person/settings.tsx | 3 ++- src/shared/components/post/metadata-card.tsx | 5 +++-- src/shared/components/post/post-form.tsx | 7 ++++--- src/shared/components/post/post-listing.tsx | 9 +++++---- .../components/private_message/private-message-form.tsx | 3 ++- src/shared/utils.ts | 2 ++ 16 files changed, 42 insertions(+), 27 deletions(-) diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 381ecb4..af284e5 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -10,6 +10,7 @@ import { mdToHtml, pictrsDeleteToast, randomStr, + relTags, setupTippy, setupTribute, toast, @@ -297,7 +298,7 @@ export class MarkdownTextArea extends Component< href={markdownHelpUrl} class="btn btn-sm text-muted font-weight-bold" title={i18n.t("formatting_help")} - rel="noopener" + rel={relTags} > diff --git a/src/shared/components/common/pictrs-image.tsx b/src/shared/components/common/pictrs-image.tsx index 31e3052..4f3ddc0 100644 --- a/src/shared/components/common/pictrs-image.tsx +++ b/src/shared/components/common/pictrs-image.tsx @@ -32,8 +32,9 @@ export class PictrsImage extends Component { loading="lazy" className={classNames({ "img-fluid": !this.props.icon && !this.props.iconOverlay, - "banner": this.props.banner, - "thumbnail rounded": this.props.thumbnail && !this.props.icon && !this.props.banner, + banner: this.props.banner, + "thumbnail rounded": + this.props.thumbnail && !this.props.icon && !this.props.banner, "img-expanded slight-radius": !this.props.thumbnail && !this.props.icon, "img-blur": this.props.thumbnail && this.props.nsfw, diff --git a/src/shared/components/common/sort-select.tsx b/src/shared/components/common/sort-select.tsx index 9504756..1188064 100644 --- a/src/shared/components/common/sort-select.tsx +++ b/src/shared/components/common/sort-select.tsx @@ -1,7 +1,7 @@ import { Component, linkEvent } from "inferno"; import { SortType } from "lemmy-js-client"; import { i18n } from "../../i18next"; -import { randomStr, sortingHelpUrl } from "../../utils"; +import { randomStr, relTags, sortingHelpUrl } from "../../utils"; import { Icon } from "./icon"; interface SortSelectProps { @@ -71,7 +71,7 @@ export class SortSelect extends Component { diff --git a/src/shared/components/community/community-link.tsx b/src/shared/components/community/community-link.tsx index fee38eb..4ea7f8a 100644 --- a/src/shared/components/community/community-link.tsx +++ b/src/shared/components/community/community-link.tsx @@ -1,7 +1,7 @@ import { Component } from "inferno"; import { Link } from "inferno-router"; import { CommunitySafe } from "lemmy-js-client"; -import { hostname, showAvatars } from "../../utils"; +import { hostname, relTags, showAvatars } from "../../utils"; import { PictrsImage } from "../common/pictrs-image"; interface CommunityLinkProps { @@ -48,6 +48,7 @@ export class CommunityLink extends Component { title={apubName} className={`${this.props.muted ? "text-muted" : ""}`} href={link} + rel={relTags} > {this.avatarAndName(displayName)} diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index 7bc0833..da215f4 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -38,6 +38,7 @@ import { getPageFromProps, getSortTypeFromProps, notifyPost, + relTags, restoreScrollPosition, saveCommentRes, saveScrollPosition, @@ -370,7 +371,7 @@ export class Community extends Component { - + diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index 5d430a6..95c34f0 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -43,6 +43,7 @@ import { mdToHtml, notifyPost, numToSI, + relTags, restoreScrollPosition, saveCommentRes, saveScrollPosition, @@ -695,7 +696,7 @@ export class Home extends Component { {this.state.listingType == ListingType.All && ( <> - + @@ -703,7 +704,7 @@ export class Home extends Component { )} {this.state.listingType == ListingType.Local && ( <> - + @@ -712,7 +713,7 @@ export class Home extends Component { {UserService.Instance.myUserInfo && this.state.listingType == ListingType.Subscribed && ( <> - + {