From b1fc470ba0681d383c0e60eef0581551f874696f Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> Date: Fri, 12 Apr 2024 20:46:42 -0400 Subject: [PATCH] Fix blur and adjust user settings --- src/shared/components/common/pictrs-image.tsx | 7 +- src/shared/components/person/settings.tsx | 64 +++++++++++-------- src/shared/utils/helpers/index.ts | 2 + src/shared/utils/helpers/should-blur-nsfw.ts | 12 ++++ 4 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 src/shared/utils/helpers/should-blur-nsfw.ts diff --git a/src/shared/components/common/pictrs-image.tsx b/src/shared/components/common/pictrs-image.tsx index 06495636..e58facd5 100644 --- a/src/shared/components/common/pictrs-image.tsx +++ b/src/shared/components/common/pictrs-image.tsx @@ -1,9 +1,9 @@ import classNames from "classnames"; import { Component } from "inferno"; -import { UserService } from "../../services"; import { setIsoData } from "@utils/app"; import { IsoDataOptionalSite } from "shared/interfaces"; +import { shouldBlurNsfw } from "@utils/helpers"; const iconThumbnailSize = 96; const thumbnailSize = 256; @@ -31,10 +31,7 @@ export class PictrsImage extends Component { const { src, icon, iconOverlay, banner, thumbnail, nsfw, pushup, cardTop } = this.props; - const blurImage = - nsfw && - (!this.isoData.site_res?.site_view.site.content_warning || - UserService.Instance.myUserInfo?.local_user_view.local_user.blur_nsfw); + const blurImage = nsfw && shouldBlurNsfw(this.isoData.site_res); return ( diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index bd1905e3..cdb79b20 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -898,34 +898,42 @@ export class Settings extends Component { /> -
-
- - -
-
-
-
- - -
-
+ {this.state.siteRes.site_view.local_site.enable_nsfw && ( + <> +
+
+ + +
+
+
+
+ + +
+
+ + )}