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

feat: map user social meta fields #76

Merged
merged 3 commits into from
Mar 23, 2024

Conversation

colis
Copy link
Contributor

@colis colis commented Mar 19, 2024

What

This PR maps the social meta fields of the User object to the RankMathUserSeo type, i.e.

user(id: "5", idType: DATABASE_ID) {
  seo {
    ... on RankMathUserSeo {
      social {
        additionalProfiles
        facebookProfileUrl
        twitterUserName
      }
    }
  }
}

Why

The Rank Math plugin allows us to add user's Facebook URL, Twitter username and other profiles. Therefore this data needs to be mapped to the GraphQL schema.

How

Testing Instructions

  1. Populate the aforementioned fields on the User profile page
  2. Use the query above in the GraphiQL IDE

Additional Info

Checklist:

  • My code is tested to the best of my abilities.
  • My code follows the WordPress Coding Standards.
  • My code has proper inline documentation.
  • I have added unit tests to verify the code works as intended.
  • The changes in this PR have been noted in CHANGELOG.md

@justlevine justlevine force-pushed the feat/map-user-social-meta-fields branch from 7c46b37 to 68c31b8 Compare March 23, 2024 11:11
Copy link
Member

@justlevine justlevine left a comment

Choose a reason for hiding this comment

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

Code looks great - thanks @colis !

From a schema perspective, I'm wondering if we really want to introduce the RankMathUserSocialMeta interface vs making these fields directly available on RankMathUserSeo.

The latter would make the schema more robust to future changes (i.e. less likely for a change to necessitate something breaking), but I don't want a tech argument to win out if there's a practical use case I'm missing. 🤔

@colis
Copy link
Contributor Author

colis commented Mar 23, 2024

Code looks great - thanks @colis !

From a schema perspective, I'm wondering if we really want to introduce the RankMathUserSocialMeta interface vs making these fields directly available on RankMathUserSeo.

The latter would make the schema more robust to future changes (i.e. less likely for a change to necessitate something breaking), but I don't want a tech argument to win out if there's a practical use case I'm missing. 🤔

yep, that probably makes everything a bit easier 👍

@justlevine justlevine force-pushed the feat/map-user-social-meta-fields branch from 684c094 to fe86a9d Compare March 23, 2024 12:01
@justlevine justlevine mentioned this pull request Mar 23, 2024
5 tasks
@justlevine justlevine force-pushed the feat/map-user-social-meta-fields branch from fe86a9d to 53efda5 Compare March 23, 2024 12:13
@justlevine
Copy link
Member

justlevine commented Mar 23, 2024

(Note to self: schema should resolve directly to the Object type not to the interface type. having to do ... on RankMathUserSeo when we're already at user.seo is stupid. Tracking in #79 )

@justlevine justlevine merged commit 0378633 into AxeWP:develop Mar 23, 2024
23 checks passed
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