]> Untitled Git - lemmy.git/commitdiff
Adding nsfw image blur. Fixes #438
authorDessalines <tyhou13@gmx.com>
Mon, 20 Jan 2020 19:38:41 +0000 (14:38 -0500)
committerDessalines <tyhou13@gmx.com>
Mon, 20 Jan 2020 19:38:41 +0000 (14:38 -0500)
ui/assets/css/main.css
ui/src/components/post-listing.tsx

index dcc55f194f27dde57aee9b6480502242791aca44..2703d550c57ef96533aed59b81a62cf21d08f352 100644 (file)
@@ -163,3 +163,10 @@ hr {
   flex: 1;
 }
 
+.img-blur {
+  filter: blur(10px);
+  -webkit-filter: blur(10px);
+  -moz-filter: blur(10px);
+  -o-filter: blur(10px);
+  -ms-filter: blur(10px);
+}
index 0ffabf274832e38b6bd2d28e057f38b0b335efd4..b1db26709710f0bbe564d080f58a5d18b4a11a9e 100644 (file)
@@ -160,22 +160,20 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
             </button>
           )}
         </div>
-        {post.url &&
-          isImage(post.url) &&
-          !post.nsfw &&
-          !post.community_nsfw &&
-          !this.state.imageExpanded && (
-            <span
-              title={i18n.t('expand_here')}
-              class="pointer"
-              onClick={linkEvent(this, this.handleImageExpandClick)}
-            >
-              <img
-                class="mx-2 mt-1 float-left img-fluid thumbnail rounded"
-                src={imageThumbnailer(post.url)}
-              />
-            </span>
-          )}
+        {post.url && isImage(post.url) && !this.state.imageExpanded && (
+          <span
+            title={i18n.t('expand_here')}
+            class="pointer"
+            onClick={linkEvent(this, this.handleImageExpandClick)}
+          >
+            <img
+              className={`mx-2 mt-1 float-left img-fluid thumbnail rounded ${(post.nsfw ||
+                post.community_nsfw) &&
+                'img-blur'}`}
+              src={imageThumbnailer(post.url)}
+            />
+          </span>
+        )}
         {post.url && isVideo(post.url) && (
           <video
             playsinline