-
Notifications
You must be signed in to change notification settings - Fork 466
feat: expose commenter edge fields #3208
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
feat: expose commenter edge fields #3208
Conversation
- refactor WPGraphQL\AdminNotices to be a singleton - instantiate AdminNotices the singleton
…e-admin-notices-a-singleton
- update tests
- expose commentAuthorUrl, commentAuthorEmail and commentAuthor on the Comment model as allowed restricted fields - add name, email, url as edge fields on the CommentToCommenter Connection - test the new edge fields
| }, | ||
| 'comment_author' => function () { | ||
| return ! empty( $this->data->comment_author ) ? absint( $this->data->comment_author ) : null; | ||
| return ! empty( $this->data->comment_author ) ? $this->data->comment_author : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return statements within this method.
| }, | ||
| 'comment_author_url' => function () { | ||
| return ! empty( $this->data->comment_author_url ) ? absint( $this->data->comment_author_url ) : null; | ||
| return ! empty( $this->data->comment_author_url ) ? $this->data->comment_author_url : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return statements within this method.
| return ! empty( $this->data->comment_author_url ) ? $this->data->comment_author_url : null; | ||
| }, | ||
| 'commentAuthor' => function () { | ||
| return ! empty( $this->data->comment_author ) ? $this->data->comment_author : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return statements within this method.
| return ! empty( $this->data->comment_author ) ? $this->data->comment_author : null; | ||
| }, | ||
| 'commentAuthorUrl' => function () { | ||
| return ! empty( $this->data->comment_author_url ) ? $this->data->comment_author_url : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid too many return statements within this method.
- add ipAddress field
|
Code Climate has analyzed commit 22793d1 and detected 8 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
josephfusco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

What does this implement/fix? Explain your changes.
This introduces new fields on the "Edge" on the
CommentToCommenterconnection:This allows for the relational data between a Commenter and the Comment to be queried for, in addition to the Commenter node itself.
Why?
Comment Authors can be represented by both their User object data and conditional data related to a specific comment.
By exposing this edge data, the client application can combine data from the
Usernode and theComment.authoredge fields to provide a UI matching similar UIs as the WordPress Dashboard.For example:
In the WordPress Dashboard, when moderating comments, the Author is represented as a mix of a User and comment-specific data.
With these edge fields, we can now query the User that authored the comment as well as the conditional fields specific to the comment:
With this data queried at the edge between the Comment and the Author, we could create a UI similar to what is displayed in the WP Admin, where we see some information (avatar, etc) from the User node, and some information (commenter's name) in place of the User's information:
Does this close any currently open issues?
closes #3197