about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/preferences/index.ts9
-rw-r--r--src/state/queries/usePostThread/traversal.ts15
-rw-r--r--src/state/queries/usePostThread/views.ts3
3 files changed, 19 insertions, 8 deletions
diff --git a/src/state/queries/preferences/index.ts b/src/state/queries/preferences/index.ts
index 44d63b55c..fd1d70d7d 100644
--- a/src/state/queries/preferences/index.ts
+++ b/src/state/queries/preferences/index.ts
@@ -11,7 +11,7 @@ import {replaceEqualDeep} from '#/lib/functions'
 import {getAge} from '#/lib/strings/time'
 import {logger} from '#/logger'
 import {useAgeAssuranceContext} from '#/state/ageAssurance'
-import {AGE_RESTRICTED_MODERATION_PREFS} from '#/state/ageAssurance/const'
+import {makeAgeRestrictedModerationPrefs} from '#/state/ageAssurance/const'
 import {STALE} from '#/state/queries'
 import {
   DEFAULT_HOME_FEED_PREFS,
@@ -77,7 +77,12 @@ export function usePreferencesQuery() {
       (data: UsePreferencesQueryResponse) => {
         const isUnderage = (data.userAge || 0) < 18
         if (isUnderage || isAgeRestricted) {
-          data.moderationPrefs = AGE_RESTRICTED_MODERATION_PREFS
+          data = {
+            ...data,
+            moderationPrefs: makeAgeRestrictedModerationPrefs(
+              data.moderationPrefs,
+            ),
+          }
         }
         return data
       },
diff --git a/src/state/queries/usePostThread/traversal.ts b/src/state/queries/usePostThread/traversal.ts
index 7d8cd6464..2809d32e9 100644
--- a/src/state/queries/usePostThread/traversal.ts
+++ b/src/state/queries/usePostThread/traversal.ts
@@ -372,16 +372,21 @@ export function sortAndAnnotateThreadItems(
           /*
            * Tree-view only.
            *
-           * If there's an upcoming parent read more, this branch is part of the
-           * last branch of the sub-tree, and the item itself is the last child,
-           * insert the parent "read more".
+           * If there's an upcoming parent read more, this branch is part of a
+           * branch of the sub-tree that is deeper than the
+           * `upcomingParentReadMore`, and the item following the current item
+           * is either undefined or less-or-equal-to the depth of the
+           * `upcomingParentReadMore`, then we know it's time to drop in the
+           * parent read more.
            */
           if (
             view === 'tree' &&
             metadata.upcomingParentReadMore &&
-            metadata.isPartOfLastBranchFromDepth ===
+            metadata.isPartOfLastBranchFromDepth &&
+            metadata.isPartOfLastBranchFromDepth >=
               metadata.upcomingParentReadMore.depth &&
-            metadata.isLastChild
+            (metadata.nextItemDepth === undefined ||
+              metadata.nextItemDepth <= metadata.upcomingParentReadMore.depth)
           ) {
             subset.splice(
               i + 1,
diff --git a/src/state/queries/usePostThread/views.ts b/src/state/queries/usePostThread/views.ts
index 71acfc77b..4e7140eab 100644
--- a/src/state/queries/usePostThread/views.ts
+++ b/src/state/queries/usePostThread/views.ts
@@ -78,7 +78,8 @@ export function threadPost({
   const blurred = modui.blur || modui.filter
   const muted = (modui.blurs[0] || modui.filters[0])?.type === 'muted'
   const hiddenByThreadgate = threadgateHiddenReplies.has(uri)
-  const isBlurred = hiddenByThreadgate || blurred || muted
+  const isOwnPost = value.post.author.did === moderationOpts.userDid
+  const isBlurred = (hiddenByThreadgate || blurred || muted) && !isOwnPost
   return {
     type: 'threadPost',
     key: uri,