Commit Graph

7 Commits

Author SHA1 Message Date
Naz
2d5aff434c Added optional max limit override to errorIfIsOverLimit
refs https://github.com/TryGhost/Team/issues/587
refs 73e7319406

- It's a symmetric change to the one introduce in the refenreced commit
- TLDR: allows to check if limit was reached if the user changes the limit
2021-04-01 18:27:29 +13:00
Naz
73e7319406 Added optional max limit override to errorIfWouldGoOverLimit
refs https://github.com/TryGhost/Team/issues/587

- The optional {max} passed as an option allows to override currently configured limit and do a theoretical new limit check. For example:  check if the max limit will be exceeded if the limit changes (user changes plans)
2021-04-01 17:59:52 +13:00
Naz
0838186abd Added JSDoc to MaxLimit constructor
refs https://github.com/TryGhost/Team/issues/587

- Having a JSDoc gives better intellisense when the class is instantiated and provides clues about what each parameter might be used for
2021-04-01 17:29:26 +13:00
Naz
57e24b3677 Added incorrect 'max' usage error to MaxLimit
refs https://github.com/TryGhost/Team/issues/587

- When the 'max' configuration is missing the instance of the class breaks when used unexpectedly. Followed similar approach to currentCountQuery check  by failing fast in the constructor
2021-04-01 17:20:56 +13:00
Hannah Wolfe
47478eb1f9 Added proper number formatting for error messages
refs: https://github.com/TryGhost/Team/issues/510

- We should always format numbers correctly with thousand separators when we're displaying them to users
2021-03-04 18:08:25 +00:00
Hannah Wolfe
feb872eb3e Fixed clobbering the lodash template settings
refs: https://github.com/lodash/lodash/issues/705

- Was seeing unexpected token = errors when using lodash templates in Ghost
- This is because we're setting template settings globally in this dependency and it affects every other user of lodash
- Using runInContext keeps this templateSettings change local to this lib
- Test proves that after requiring limits we can require lodash and have the default values again
2021-03-03 17:54:36 +00:00
Hannah Wolfe
201e133386 Added limit service initial commit
- This provides some basic functionality and error message generation for adding host-based limits in Ghost
- It is a first-pass, needs unit tests etc
2021-03-03 12:19:48 +00:00