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

[CORL-2905]: add optional count param to active stories script #4342

Merged
merged 2 commits into from
Sep 26, 2023

Conversation

kabeaty
Copy link
Contributor

@kabeaty kabeaty commented Sep 7, 2023

What does this PR do?

These changes add an optional count param to the active stories jsonp script. If the count param is passed in, then that is the number of stories that will be returned. If no count param is passed, the count defaults to 5.

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?

You can either visit in your browser or run curl against these urls to see that you get the expected response:
http://localhost:8080/api/story/active.js?siteID=SITE_ID (should get the default of 5 stories)
http://localhost:8080/api/story/active.js?siteID=SITE_ID&count=10 (should get 10 stories)
http://localhost:8080/api/story/active.js?siteID=SITE_ID&count=2 (should get 2 stories)

Note that if your site has fewer than the requested number of stories, all stories will be returned.

Where any tests migrated to React Testing Library?

How do we deploy this PR?

@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit f27e04b
🔍 Latest deploy log https://app.netlify.com/sites/gallant-galileo-14878c/deploys/64fa287de387ef00082a46bf

Copy link
Contributor

@nick-funk nick-funk left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for adding a limit!

@@ -14,11 +14,13 @@ export type Options = Pick<AppOptions, "mongo">;
const ActiveStoriesQuerySchema = Joi.object().keys({
callback: Joi.string().allow("").optional(),
siteID: Joi.string().required(),
count: Joi.number().optional().max(999),
Copy link
Contributor

Choose a reason for hiding this comment

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

thank you!

@tessalt tessalt merged commit 553f2ff into develop Sep 26, 2023
6 checks passed
@tessalt tessalt deleted the feat/CORL-2905-update-active-stories-script branch September 26, 2023 21:14
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.

4 participants