Fix crash on repeats of a blocked user's posts #3606

Open
lambadalambda wants to merge 2 commits from fix/missing-emoji-reactions into develop

Blocking a user wiped their statuses from the store, but other users' repeats of them stayed in the timelines. Such a repeat then rendered as a normal status, and EmojiReactions threw this.status.emoji_reactions is undefined (Pleroma sends no emoji_reactions on repeats).

  • wipeUserStatuses also wipes repeats of the wiped statuses.
  • parseStatus defaults emoji_reactions to [], for repeats whose post is missing for other reasons, and for backends without pleroma.

Reproduced on develop against the mock backend (block a user whose post is repeated in Home, switch timelines, scroll to the repeat); fixed on this branch.

Testing: yarn unit-ci (526 passed), yarn ci-biome.

Blocking a user wiped their statuses from the store, but other users' repeats of them stayed in the timelines. Such a repeat then rendered as a normal status, and `EmojiReactions` threw `this.status.emoji_reactions is undefined` (Pleroma sends no `emoji_reactions` on repeats). - `wipeUserStatuses` also wipes repeats of the wiped statuses. - `parseStatus` defaults `emoji_reactions` to `[]`, for repeats whose post is missing for other reasons, and for backends without `pleroma`. Reproduced on develop against the mock backend (block a user whose post is repeated in Home, switch timelines, scroll to the repeat); fixed on this branch. Testing: `yarn unit-ci` (526 passed), `yarn ci-biome`.
fix(normalizer): default emoji_reactions to an empty list
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
f55330a3fb
Author
Owner

/oc review

/oc review
opencode-fix-bot approved these changes 2026-11-06 17:21:23 +00:00
Dismissed
opencode-fix-bot left a comment

opencode-agent:job=173:generation=1

Review verdict

No findings. This pull request is safe to merge.

What was checked

  • Fix (src/services/entity_normalizer/entity_normalizer.service.js): output.emoji_reactions = pleroma?.emoji_reactions ?? [] is now assigned unconditionally, outside the if (data.pleroma) branch. This covers all three reported shapes:
    • Mastodon statuses with no pleroma block at all
    • Pleroma repeats rendered with reblog: null and a pleroma block lacking emoji_reactions
    • Normal statuses where pleroma.emoji_reactions is present (passed through unchanged)
  • Consumers: src/components/emoji_reactions/emoji_reactions.js, src/stores/statuses.js, and src/components/status_action_buttons/action_button_container.js all assume an array (.length, .slice, .find, .findIndex, .push); the [] default keeps every call site safe. Each call creates a fresh array, so there is no shared-mutable-default risk.
  • Recursion: quote and retweet parsing go through parseStatus, so nested statuses inherit the same default.
  • Tests (entity_normalizer.spec.js): new cases cover both the missing-pleroma and missing-emoji_reactions paths plus the passthrough case.
  • Changelog: changelog.d/missing-emoji-reactions.fix follows the repo one-line convention.

Validation performed

  • Full unit suite: 50 files, 525 passed, 2 skipped
  • biome check on both changed source files: clean

Merge readiness

5/5 -- production-ready, no known findings.

opencode-agent:job=173:generation=1 ### Review verdict No findings. This pull request is safe to merge. ### What was checked - **Fix** (`src/services/entity_normalizer/entity_normalizer.service.js`): `output.emoji_reactions = pleroma?.emoji_reactions ?? []` is now assigned unconditionally, outside the `if (data.pleroma)` branch. This covers all three reported shapes: - Mastodon statuses with no `pleroma` block at all - Pleroma repeats rendered with `reblog: null` and a `pleroma` block lacking `emoji_reactions` - Normal statuses where `pleroma.emoji_reactions` is present (passed through unchanged) - **Consumers**: `src/components/emoji_reactions/emoji_reactions.js`, `src/stores/statuses.js`, and `src/components/status_action_buttons/action_button_container.js` all assume an array (`.length`, `.slice`, `.find`, `.findIndex`, `.push`); the `[]` default keeps every call site safe. Each call creates a fresh array, so there is no shared-mutable-default risk. - **Recursion**: quote and retweet parsing go through `parseStatus`, so nested statuses inherit the same default. - **Tests** (`entity_normalizer.spec.js`): new cases cover both the missing-`pleroma` and missing-`emoji_reactions` paths plus the passthrough case. - **Changelog**: `changelog.d/missing-emoji-reactions.fix` follows the repo one-line convention. ### Validation performed - Full unit suite: 50 files, 525 passed, 2 skipped - `biome check` on both changed source files: clean ### Merge readiness **5/5** -- production-ready, no known findings.
fix(statuses): wipe repeats of a blocked user's statuses
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
0d5a336ae1
lambadalambda changed title from Fix crash on statuses without emoji reactions to Fix crash on repeats of a blocked user's posts 2026-11-06 17:30:02 +00:00
Author
Owner

/oc review

/oc review
opencode-fix-bot left a comment

opencode-agent:job=174:generation=1

Review verdict

No findings. This pull request is safe to merge.

What was checked

  • Normalizer fix (src/services/entity_normalizer/entity_normalizer.service.js:289): output.emoji_reactions = pleroma?.emoji_reactions ?? [] is now assigned unconditionally, outside the if (data.pleroma) branch. This covers all three reported shapes: Mastodon statuses with no pleroma block, Pleroma repeats rendered with reblog: null and no emoji_reactions, and normal statuses where the field passes through unchanged. Each call allocates a fresh array, so there is no shared-mutable-default risk. Quote and retweet parsing recurse through parseStatus, so nested statuses inherit the same default.
  • Consumers: src/components/emoji_reactions/emoji_reactions.js and src/components/status_action_buttons/action_button_container.js call array methods (.length, .find, .findIndex) on emoji_reactions; the [] default keeps every call site safe.
  • Block-wipe fix (src/stores/statuses.js:549-571): wipeUserStatuses now also collects other users' repeats whose retweeted_status.id is in the blocked user's set, deletes them from allStatuses, removes each id from its author's statusesPerUser set, and returns the full removed set so blockUser (src/stores/users.js:576-578) also wipes them from timelines and notifications. The new repeats collection is a snapshot, so mutating the live per-user sets inside the loop is safe; every status processed comes from allStatuses, which addNewStatuses always registers in statusesPerUser and conversations, so the per-author and conversation deletions hit existing entries.
  • Tests: new cases in entity_normalizer.spec.js (missing-pleroma, missing-emoji_reactions, passthrough) and statuses.spec.js (wipeUserStatuses also wipes repeats and cleans the repeater's per-user set) directly cover both changes.
  • Changelog: changelog.d/missing-emoji-reactions.fix follows the one-line convention.

Validation performed

  • Full unit suite on the exact head commit: 50 files, 526 passed, 2 skipped
  • biome check on all four changed source/test files: clean

Merge readiness

5/5 -- production-ready, no known findings.

opencode-agent:job=174:generation=1 ### Review verdict No findings. This pull request is safe to merge. ### What was checked - **Normalizer fix** (`src/services/entity_normalizer/entity_normalizer.service.js:289`): `output.emoji_reactions = pleroma?.emoji_reactions ?? []` is now assigned unconditionally, outside the `if (data.pleroma)` branch. This covers all three reported shapes: Mastodon statuses with no `pleroma` block, Pleroma repeats rendered with `reblog: null` and no `emoji_reactions`, and normal statuses where the field passes through unchanged. Each call allocates a fresh array, so there is no shared-mutable-default risk. Quote and retweet parsing recurse through `parseStatus`, so nested statuses inherit the same default. - **Consumers**: `src/components/emoji_reactions/emoji_reactions.js` and `src/components/status_action_buttons/action_button_container.js` call array methods (`.length`, `.find`, `.findIndex`) on `emoji_reactions`; the `[]` default keeps every call site safe. - **Block-wipe fix** (`src/stores/statuses.js:549-571`): `wipeUserStatuses` now also collects other users' repeats whose `retweeted_status.id` is in the blocked user's set, deletes them from `allStatuses`, removes each id from its author's `statusesPerUser` set, and returns the full removed set so `blockUser` (`src/stores/users.js:576-578`) also wipes them from timelines and notifications. The new `repeats` collection is a snapshot, so mutating the live per-user sets inside the loop is safe; every status processed comes from `allStatuses`, which `addNewStatuses` always registers in `statusesPerUser` and `conversations`, so the per-author and conversation deletions hit existing entries. - **Tests**: new cases in `entity_normalizer.spec.js` (missing-`pleroma`, missing-`emoji_reactions`, passthrough) and `statuses.spec.js` (`wipeUserStatuses` also wipes repeats and cleans the repeater's per-user set) directly cover both changes. - **Changelog**: `changelog.d/missing-emoji-reactions.fix` follows the one-line convention. ### Validation performed - Full unit suite on the exact head commit: 50 files, 526 passed, 2 skipped - `biome check` on all four changed source/test files: clean ### Merge readiness **5/5** -- production-ready, no known findings.
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/changelog Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/test-e2e Pipeline was successful
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/missing-emoji-reactions:fix/missing-emoji-reactions
git switch fix/missing-emoji-reactions

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch develop
git merge --no-ff fix/missing-emoji-reactions
git switch fix/missing-emoji-reactions
git rebase develop
git switch develop
git merge --ff-only fix/missing-emoji-reactions
git switch fix/missing-emoji-reactions
git rebase develop
git switch develop
git merge --no-ff fix/missing-emoji-reactions
git switch develop
git merge --squash fix/missing-emoji-reactions
git switch develop
git merge --ff-only fix/missing-emoji-reactions
git switch develop
git merge fix/missing-emoji-reactions
git push origin develop
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!3606
No description provided.