Skip to content

feat(publish-quota): per user publishArticle quota#3862

Open
tx0c wants to merge 2 commits intodevelopfrom
feat/publish-quota
Open

feat(publish-quota): per user publishArticle quota#3862
tx0c wants to merge 2 commits intodevelopfrom
feat/publish-quota

Conversation

@tx0c
Copy link
Copy Markdown
Contributor

@tx0c tx0c commented Apr 16, 2024

resolves #3842

@tx0c tx0c self-assigned this Apr 16, 2024
@tx0c tx0c requested a review from a team as a code owner April 16, 2024 20:19
gary02
gary02 previously requested changes Apr 18, 2024

const fieldName = 'publishArticle'
const pass = await checkOperationLimit({
user: viewer.id || viewer.ip,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

viewer.ip will never be used as only logged-in user can publish articles by now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And as opercation limit is checked here, rateLimitDirective (@ratelimit) on publishArticle in schema need to be removed

Comment thread src/common/enums/user.ts
trendy: 'trendy',
} as const

export const PUBLISH_ARTICLE_RATE_LIMIT = isProd ? 1 : 1000
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this rate confirmed with the CC team?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it was the default before:

"hotfix(publish-rate): reduce rate of publishArticle"

This reverts commit 2717c88.

})

if (!pass) {
throw new ActionLimitExceededError(
Copy link
Copy Markdown
Contributor

@robertu7 robertu7 Apr 22, 2024

Choose a reason for hiding this comment

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

add unit test for this mutation changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added in src/types/__test__/1/article.test.ts

@tx0c tx0c force-pushed the feat/publish-quota branch from b8fe719 to 2a89923 Compare May 28, 2024 20:37
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2024

Codecov Report

❌ Patch coverage is 72.88136% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.59%. Comparing base (a4040ba) to head (09410fe).
⚠️ Report is 2010 commits behind head on develop.

Files with missing lines Patch % Lines
src/mutations/user/updateUserPublishRate.ts 41.66% 7 Missing ⚠️
src/common/utils/rateLimit.ts 75.00% 6 Missing ⚠️
...ions/20240531164251_alter_user_add_publish_rate.js 71.42% 2 Missing ⚠️
src/mutations/article/publishArticle.ts 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3862      +/-   ##
===========================================
+ Coverage    58.57%   58.59%   +0.01%     
===========================================
  Files          887      890       +3     
  Lines        17184    17216      +32     
  Branches      3089     3095       +6     
===========================================
+ Hits         10065    10087      +22     
- Misses        7068     7078      +10     
  Partials        51       51              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tx0c tx0c force-pushed the feat/publish-quota branch 2 times, most recently from fd27c9b to c444559 Compare May 29, 2024 22:56
@tx0c
Copy link
Copy Markdown
Contributor Author

tx0c commented May 29, 2024

how about Revert "hotfix(publish-rate): reduce rate of publishArticle"

This reverts commit 2717c88.

Let the graphql directive still handles a 10articles/2hours bottom limit?

@gary02 gary02 dismissed their stale review September 5, 2024 07:30

need to review

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.

per user publishArticle quota

3 participants