🐛 Show hidden comments to admin when there are just hidden comments#22915
Conversation
|
""" WalkthroughThe changes refactor the Assessment against linked issues
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/comments-ui/test/e2e/admin-moderation.test.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-i18next". (The package "eslint-plugin-i18next" was not found when loaded as a Node module from the directory "/apps/comments-ui".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-i18next" was referenced from the config file in "apps/comments-ui/.eslintrc.js". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…idden ref TryGhost#22331 When an admin hid every comment on a post, the public API returned zero comments, so the admin auth frame never loaded and the admin could no longer see, unhide, or delete the hidden comments. Render the auth frame once initialization is done rather than gating it on comment count.
f27cbd5 to
83969cc
Compare
|
@kaueburiti Thanks for this, and sorry for the delay! |
Context
When the admin hides all comments, it becomes impossible to see the hidden comments, so you can't unhide or even delete them.
fixes #22331
The Solution
As described here by @cathysarisky, the major problem was the AuthFrame not being loaded.
But things get a bit complex when you notice that even after loading it, hidden comments still don't show. We got stuck in the loading state. The reason is that because of the way we update the states inside
initSetup, we can never change ourdoneto success, leaving us in an eternal loading state.So, besides loading the AuthFrame, the major work was handling the state update on
initSetupto avoid unnecessary re-renders.Screenshots