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

Add a secretBadges array to the user model #4506

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

nick-funk
Copy link
Contributor

What does this PR do?

Adds a secretBadges array to the user model which is only configurable via Mongo and used for special cases by the organization.

These changes will impact:

  • commenters
  • moderators
  • admins
  • developers

What changes to the GraphQL/Database Schema does this PR introduce?

None

Does this PR introduce any new environment variables or feature flags?

No

If any indexes were added, were they added to INDEXES.md?

N/A

How do I test this PR?

  • use multi-site test with SSO users
  • find an SSO user in Mongo, add a secretBadges array field to their user document and add an entry (they are string values in an array)
  • visit the site and post a comment as that user via SSO
  • see that the user has the "secret badge" you gave them in Mongo
  • see that any other SSO badges also exist

Were any tests migrated to React Testing Library?

No

How do we deploy this PR?

If we want to formally release this, rebase this off of develop (instead of v8.7.1) and merge it as usual into develop.

this is only configurable via Mongo, it is used for special
cases by the organization.
Copy link

netlify bot commented Jan 25, 2024

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit 327df19
🔍 Latest deploy log https://app.netlify.com/sites/gallant-galileo-14878c/deploys/65bbfd51b46fe5000815b7ff

@nick-funk nick-funk changed the title add a secretBadges array to the user model Add a secretBadges array to the user model Jan 25, 2024
Comment on lines +110 to +112
if (!badges && !secretBadges) {
return undefined;
}
Copy link
Contributor Author

@nick-funk nick-funk Jan 25, 2024

Choose a reason for hiding this comment

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

I did this to retain the original behaviour of the badges possibly being undefined (type is string[] | undefined on the User model) and thus making sure we aren't messing things up by returning an empty array when something might expect undefined instead.

I doubt there is any issue with returning an empty array, but why mess with an edge case that might exist when we can easily return what we know works well?

@nick-funk nick-funk marked this pull request as ready for review February 1, 2024 20:21
@kabeaty kabeaty added this pull request to the merge queue Feb 12, 2024
Merged via the queue into develop with commit df45b43 Feb 12, 2024
6 checks passed
@kabeaty kabeaty deleted the custom-8.7.1-sbn-secretBadges branch February 12, 2024 18:37
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.

None yet

2 participants