Skip to content

Commit

Permalink
Merge pull request #315 from FuelRats/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleClapton authored Mar 10, 2021
2 parents 39906e4 + be7cdec commit c5ff46f
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 29 deletions.
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,32 @@ For detailed rules of this file, see [Changelog Rules](#changelog-rules)


[#303]: https://github.com/fuelRats/fuelrats.com/pull/303
[Unreleased]: https://github.com/FuelRats/fuelrats.com/compare/v2.12.9...HEAD
[Unreleased]: https://github.com/FuelRats/fuelrats.com/compare/v2.12.10...HEAD


## [2.12.10][] - 2021-03-10

### ⚡ Changed
* Removed the asterisk that displays when an input is required. - [#315]
* This will be re-introduced with some better visuals at a later date.


### 🐛 Fixed
* Resolved issue preventing api routes from being correctly routed. - [#314][]
* Resolved issue preventing api routes from being correctly proxied. - [#314][]
* Also take steps to ensure that doesn't happen again.
* Resolved issue prevening donation sessions from being created. - [#315][]
* Resolved a crash on the paperwork page which would occur when changing the platform in certain situations. - [#315][]


[#314]: https://github.com/fuelRats/fuelrats.com/pull/312
[#314]: https://github.com/fuelRats/fuelrats.com/pull/314
[#315]: https://github.com/fuelRats/fuelrats.com/pull/315
[2.12.10]: https://github.com/FuelRats/fuelrats.com/compare/v2.12.9...v2.12.10


## [2.12.9][] - 2021-03-10

### ✨ Added
* Add asterisk icon to inputs when they are required, but empty. - [#312][]
* Added asterisk icon to inputs when they are required, but empty. - [#312][]


### ⚡ Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fuelrats.com",
"version": "2.12.8",
"version": "2.12.10",
"description": "The primary website of The Fuel Rats!",
"main": "dist/server.js",
"license": "BSD-3-Clause",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Fieldsets/InputFieldset/InputFieldset.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const InputFieldset = React.forwardRef((props, forwardRef) => {
onFocus={onFocus} />
{children}
<ValidityIcon
className={{ [styles.hidden]: !value.length }}
hasMessages={messages?.hasMessages}
required={props.required && !value.length}
valid={messages?.valid}
validating={validating} />
<InputSuggestions
Expand Down
15 changes: 3 additions & 12 deletions src/components/Fieldsets/InputFieldset/ValidityIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ function ValidityIcon (props) {
className,
hasMessages,
invalidTitle = 'This input is invalid',
required,
requiredTitle = 'This input is required',
valid,
validating,
validatingTitle = 'validating...',
Expand All @@ -40,19 +38,14 @@ function ValidityIcon (props) {
nextProps.spin = true
nextProps.title = validatingTitle
} else if (!valid) {
if (required) {
nextProps.icon = 'asterisk'
nextProps.title = requiredTitle
} else {
nextProps.icon = 'exclamation-triangle'
nextProps.title = invalidTitle
}
nextProps.icon = 'exclamation-triangle'
nextProps.title = invalidTitle
} else if (hasMessages) {
nextProps.title = validWithMessageTitle
}

return nextProps
}, [hasMessages, invalidTitle, required, requiredTitle, valid, validTitle, validWithMessageTitle, validating, validatingTitle])
}, [hasMessages, invalidTitle, valid, validTitle, validWithMessageTitle, validating, validatingTitle])



Expand Down Expand Up @@ -81,8 +74,6 @@ ValidityIcon.propTypes = {
className: PropTypes.string,
hasMessages: PropTypes.any,
invalidTitle: PropTypes.string,
required: PropTypes.bool,
requiredTitle: PropTypes.string,
valid: PropTypes.any,
validating: PropTypes.any,
validatingTitle: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Fieldsets/SelectFieldset/SelectFieldset.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function SelectFieldset (props) {
<FontAwesomeIcon fixedWidth icon="angle-down" size="lg" />
</div>
<ValidityIcon
required={required && !value.length}
className={{ [inputStyles.hidden]: !value.length }}
valid={validityRef.current}
validating={validating} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/RatTagsInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RatTagsInput extends TagsInput {
})

if (query) {
const response = await fetch(`/api/rats?${queryParams}`)
const response = await fetch(`/api/fr/rats?${queryParams}`)
const { data } = await response.json()

if (!data?.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RescuesTagsInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RescuesTagsInput extends TagsInput {
try {
const token = Cookies.get('access_token')

let response = await fetch(`/api/rescues/${query}`, {
let response = await fetch(`/api/fr/rescues/${query}`, {
headers: new Headers({
Authorization: `Bearer ${token}`,
}),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/paperwork/[rescueId]/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Paperwork extends React.Component {

if (attribute === 'platform' && value !== this.props.rescue) {
changes.firstLimpetId = []
changes.rats = {}
changes.rats = []
}

if (attribute === 'outcome' && value !== 'success') {
Expand Down
2 changes: 2 additions & 0 deletions src/server/router/stripeApi/TrafficControl.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const allowedUnauthenticatedRequestCount = 3
* @class
*/
class TrafficControl {
unauthenticatedRequests = {}
#resetTimer = 0

/**
Expand Down Expand Up @@ -85,6 +86,7 @@ class TrafficControl {
* @private
*/
reset () {
this.unauthenticatedRequests = {}
this.#resetTimer = setTimeout(this.reset.bind(this), this.remainingTimeToNextResetDate)
}
}
Expand Down
16 changes: 9 additions & 7 deletions src/server/router/stripeApi/document.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ const prepareResponse = async (ctx, next) => {
? error
: undefined

const finalError = error instanceof ApiError
? error
: new InternalServerError({
internalError,
})

ctx.status = typeof error?.code === 'number' ? error.code : HttpStatus.INTERNAL_SERVER_ERROR
ctx.body = new ResponseDocument({
ctx,
errors: [
error instanceof ApiError
? error
: new InternalServerError({
internalError,
}),
],
errors: [finalError],
})

console.error(error)
}

ctx.type = 'application/json'
Expand Down

0 comments on commit c5ff46f

Please sign in to comment.