Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Gender-neutral rate limit error message, better addMessage rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Stoiber committed Jan 16, 2019
1 parent 3aee31f commit cfb8af2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/types/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Message = /* GraphQL */ `
extend type Mutation {
addMessage(message: MessageInput!): Message
@rateLimit(max: 20, window: "1m")
@rateLimit(max: 30, window: "1m")
deleteMessage(id: ID!): Boolean
editMessage(input: EditMessageInput!): Message
}
Expand Down
4 changes: 2 additions & 2 deletions api/utils/rate-limit-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default createRateLimitDirective({
identifyContext: ctx => (ctx.user && ctx.user.id) || getClientIp(ctx.request),
store: new RedisStore(createRedis()),
formatError: ({ fieldName, fieldIdentity, max, window }) =>
`Slow down there cowboy! You've called '${fieldName}' ${max} times in the past ${ms(
`Slow down there partner! You've called '${fieldName}' ${max} times in the past ${ms(
window,
{ long: true }
)}, which is too much.`,
)}. Relax for a bit and try again later.`,
});

0 comments on commit cfb8af2

Please sign in to comment.