Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensured replies remain visible when parent comment is being edited #21756

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sanne-san
Copy link
Member

REF https://linear.app/ghost/issue/PLG-274/prevent-replies-from-being-hidden-when-editing-parent-comment

  • Currently, replies are hidden when the parent comment is being edited. This PR ensures that replies remain visible when the parent comment is being edited.
  • To achieve this, the CommentComponent now checks if the parent comment is being edited. If so, the comment content is swapped by the EditForm, while the comment's avatar, header, menu, and replies remain visible.
  • The Form component now only renders the FormEditor. A FormWrapper component is used to wrap the avatar and comment header.
  • This Form component is used in the EditForm without the FormWrapper, as it is already wrapped in the CommentComponent.
  • The ReplyForm and the MainForm use the FormWrapper.
  • The Avatar component now also accepts a member prop, which is used to display the avatar image. This is because it's no longer used inside the Form component.

REF https://linear.app/ghost/issue/PLG-274/prevent-replies-from-being-hidden-when-editing-parent-comment
- Currently, replies are hidden when the parent comment is being edited. This PR ensures that replies remain visible when the parent comment is being edited.
- To achieve this, the `CommentComponent` now checks if the parent comment is being edited. If so, the comment content is swapped by the EditForm, while the comment's avatar, header, menu, and replies remain visible.
- The Form component now only renders the FormEditor. A FormWrapper component is used to wrap the avatar and comment header.
- This Form component is used in the EditForm without the FormWrapper, as it is already wrapped in the CommentComponent.
- The ReplyForm and the MainForm use the FormWrapper.
- The Avatar component now also accepts a `member` prop, which is used to display the avatar image. This is because it's no longer used inside the Form component.
Comment on lines +196 to +204
mockedApi.addComment({
member: {
id: 'test-id',
uuid: 'test-uuid',
name: 'Test User',
avatar: '',
expertise: ''
}
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was failing, and I didn't understand why – I hadn't touched the avatarSaturation, the only thing that changed is that the Avatar component isn't passed in the Form anymore but in FormWrapper. Cursor suggested this because in FormWrapper, I'm passing member directly as a prop to Avatar, while the test is expecting to find an Avatar that's rendered for a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants