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

Comments Loop Block: Tracking issue #34994

Open
7 of 13 tasks
SantosGuillamot opened this issue Sep 21, 2021 · 16 comments
Open
7 of 13 tasks

Comments Loop Block: Tracking issue #34994

SantosGuillamot opened this issue Sep 21, 2021 · 16 comments

Comments

Projects
Comments Loop block
  
Tracking Issues
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants
@SantosGuillamot
Copy link

@SantosGuillamot SantosGuillamot commented Sep 21, 2021

Description

The idea of this issue is to end up with a Comments Loop Block (name may change) that loops over the comments of a given post. This would be similar to the Query Loop used for posts. Users should be able to define and change the layout of the post comments directly from the Gutenberg editor, and both the editor and the frontend should match.

This is how the different comment blocks should look like:

Comments Query Loop

https://excalidraw.com/#json=6537760064143360,EgfZIljXt2SI2DTSFebHQQ

Existing Solution / Workaround

Right now, there are two similar blocks:

  • Post Comments block: This block currently renders the comments.php file of the PHP theme in the frontend and a loop of paragraphs in the editor. This way, the editor and the frontend are different and users aren't able to change the layout unless they change the PHP code.
  • Post Comment block: This block allows users to insert a specific comment by ID in their posts/pages and edit the layout including other blocks like Post Comment Author, Post Comment Content or Post Comment Date. However, it isn't possible to loop through all the comments of a specific post.

Tasks

These are the steps we should follow to finish the tracking issue:

Please note that I'll be adding the relevant issues once they are created.

Out of scope

There are some functionalities that could be nice to work on but that won't be covered in this tracking issue, although they may be addressed later in the future:

  • Comments Form: There is an already working Post Comments Form block, that allows users to leave a reply. Just adding the Reply Link block pointing to this form should be enough for now.
  • Comments Metadata: It could be nice to create a block to show any meta data added for the comments in the future.
  • Comments Status: It could also make sense to create a block to show the status of the comments (approved, pending...), specially when they are submitted.

Questions

  • Once this is done, should we deprecate the existing Post Comments block?
  • As explained previously, there are already working blocks for the Post Comment Author, Post Comment Date, Post Comment Content that are used for the Post Comment Block. I guess we could work on the existing ones right? Or would it be better to create new ones for this purpose?
  • It seems to me that, while working on the Block Elements, we should keep in mind that they should also work fine for the Post Comment Block right?
  • Once the Comments Loop block is finished, should we even deprecate the Post Comment Block and create a setting in the loop to select just an id?
  • I feel that, as already pointed in other issues, it would be better to have two different blocks for the Comment Author and the Comment Author Avatar. However, right now in the posts, the Avatar is just a setting in the Post Author block. Is there any reason to not create two different blocks?
  • Should we create in the future different block elements for the Comments Form block as well to be able to edit its layout?
  • Anything else you think we should address and not covered here?

Of course, any feedback apart from these questions is more than welcome 🙂

Previous work

There has been already some work done related to the Comments Block that was tracked in this issue → #24101

@SantosGuillamot SantosGuillamot self-assigned this Sep 21, 2021
@SantosGuillamot SantosGuillamot added this to To do in Comments Loop block via automation Sep 21, 2021
@SantosGuillamot SantosGuillamot moved this from To do to Tracking Issues in Comments Loop block Sep 21, 2021
@mcsf
Copy link
Contributor

@mcsf mcsf commented Sep 21, 2021

👋 Excited to see these great issues popping up!

We can start with a soft deprecation, i.e. supporting the old block but deprioritising it (e.g. hiding it from the inserter). In other words, we don't need formal deprecation notices yet. The fact that it's a dynamic block means that, later on, we have some flexibility to determine how existing Post Comments blocks should be rendered.

If the old blocks' usesContext: [ 'commentId' ] directive is compatible with the new blocks' intended implementation, I'd say it's worth reusing.

  • It seems to me that, while working on the Block Elements, we should keep in mind that they should also work fine for the Post Comment Block right?

Yes, as I mentioned above — unless supporting both becomes an unreasonable burden!

  • Once the Comments Loop block is finished, should we even deprecate the Post Comment Block and create a setting in the loop to select just an id?

IMO, it depends on what the benefits are, or what the use cases could be for this. It feels lower priority to me.

  • I feel that, as already pointed in other issues, it would be better to have two different blocks for the Comment Author and the Comment Author Avatar. However, right now in the posts, the Avatar is just a setting in the Post Author block. Is there any reason to not create two different blocks?

It's probably the trade-off between the flexibility of more granular blocks (Author + Avatar) vs. the user-friendliness and polish of dedicated multi-functional blocks (Author with integrated Avatar). With the ongoing improvements in layouts and alignments, the balance may soon tip towards granular blocks. I suggest experimenting with both and seeing what feels right. :)

Loading

@jameskoster
Copy link
Contributor

@jameskoster jameskoster commented Sep 22, 2021

@SantosGuillamot One design update we might consider: the new Dimensions and Layout panels will be useful on blocks like Avatar, but potentially all of them.

With the ongoing improvements in layouts and alignments, the balance may soon tip towards granular blocks.

Probably worth getting a theme dev's input here (cc @kjellr), but I suspect that the flexibility afforded by separate blocks for author name and author avatar will be more useful in general.

Loading

@kjellr
Copy link
Contributor

@kjellr kjellr commented Sep 22, 2021

Probably worth getting a theme dev's input here (cc @kjellr), but I suspect that the flexibility afforded by separate blocks for author name and author avatar will be more useful in general.

Yeah, the current iteration of the Post Author block is pretty inflexible and limiting for theme authors. There was a lot of talk about its issues (and the idea of splitting it into sub-blocks) in #24952. This is one of the reasons the block was left out of 5.8.

Loading

@carolinan
Copy link
Contributor

@carolinan carolinan commented Sep 22, 2021

Author with integrated Avatar -sounds like a good default block pattern or a block with inner blocks.
The post author block is really just waiting for a decision to be made, so that work can start.

Loading

@luisherranz
Copy link
Member

@luisherranz luisherranz commented Sep 23, 2021

@SantosGuillamot these three blocks don't have design, so I'm going to label them with Needs Design:

Loading

@SantosGuillamot
Copy link
Author

@SantosGuillamot SantosGuillamot commented Sep 23, 2021

@SantosGuillamot One design update we might consider: the new Dimensions and Layout panels will be useful on blocks like Avatar, but potentially all of them.

I agree it makes sense for most of these blocks 🙂 . I can see that the Dimension panel was integrated in this Pull Request and there is another Pull Request to create a unified Layout panel. Do you know which is the best place to understand both panels better and how to integrate them in the blocks?

Loading

@jameskoster
Copy link
Contributor

@jameskoster jameskoster commented Sep 23, 2021

I believe the Group block has already implemented the Dimensions panel, so that might be a good place to look?

To clarify, it probably only makes sense for the Layout panel to be added to container blocks in this context, IE the comment query loop and the comment template. But obviously we can only do that once the feature has been added – my apologies, I thought it already had been.

Loading

@carolinan
Copy link
Contributor

@carolinan carolinan commented Sep 24, 2021

The post comment block is in the theme category, but the inner blocks are in the design category, is that correct or should they all be in the theme category?

Loading

@jameskoster
Copy link
Contributor

@jameskoster jameskoster commented Sep 24, 2021

Personally I think the inner blocks are more aligned with the other blocks in the theme category.

But without wanting to open a can of worms, could there be an argument for a dedicated "Comments" section? There are quite a few blocks here...

Loading

@mtias
Copy link
Contributor

@mtias mtias commented Sep 28, 2021

As we work through these, I'd like to drop all the "Post" prefixes and just settle on "Comment Content", "Comment Author", etc.

Loading

@michalczaplinski
Copy link
Contributor

@michalczaplinski michalczaplinski commented Sep 29, 2021

Perhaps this is obvious but I'd like to clarify:

If a user submits a new comment, we would still require a full page reload in order to show that new comment, correct? As opposed to creating a sort of "optimistic update" and showing the just-submitted comment without a reload.

Loading

@ntsekouras
Copy link
Contributor

@ntsekouras ntsekouras commented Sep 29, 2021

If a user submits a new comment, we would still require a full page reload in order to show that new comment, correct?

Do you mean like creating a comment in the front-end and show the results in the editor?

Loading

@luisherranz
Copy link
Member

@luisherranz luisherranz commented Sep 29, 2021

If a user submits a new comment, we would still require a full page reload in order to show that new comment, correct?

That's correct Michal.

Do you mean like creating a comment in the front-end and show the results in the editor?

I think he means rendering the comment in the browser after submission.

Loading

@michalczaplinski
Copy link
Contributor

@michalczaplinski michalczaplinski commented Sep 29, 2021

I think he means rendering the comment in the browser after submission.

yup, that's what I meant. Thanks Luis!

Loading

@SantosGuillamot SantosGuillamot changed the title Post Comments Loop Block: Tracking issue Comments Loop Block: Tracking issue Oct 8, 2021
@SantosGuillamot
Copy link
Author

@SantosGuillamot SantosGuillamot commented Oct 15, 2021

There has been some progress during the last weeks and I'd like to make a quick summary update. These are the issues we have worked on, and the status of each of them:

Feel free to add anything that I'm missing, and you can find more information in each Pull Request 🙂

Loading

@SantosGuillamot
Copy link
Author

@SantosGuillamot SantosGuillamot commented Nov 3, 2021

A new update on the Post Comments blocks. This was the progress made during the last couple of weeks:

For now, we will keep working on the aspects left in the Comment Query Loop block and start working on the blocks related to the Comments pagination. Feel free to add anything missing 🙂

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment