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

Bump react-scripts from 3.4.1 to 4.0.3 + fix associated tech debt #1102

Merged
merged 38 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dbeb394
npm install --save --save-exact react-scripts@4.0.3
0xdevalias Jan 25, 2021
c3bebe8
automatically added when running npm start
0xdevalias Apr 28, 2021
613db96
move public/icons/ -> src/assets/icons/ + fix references + remove unu…
0xdevalias Apr 28, 2021
47e2a80
move NavBar icons to src/assets/icons/ + fix references
0xdevalias Apr 28, 2021
39ee33f
move various images/icons to src/assets/ + fix references
0xdevalias Apr 28, 2021
b73bad0
add @debt comment to de-duplicate DEFAULT_PROFILE_IMAGE, DEFAULT_AVAT…
0xdevalias Apr 28, 2021
57c39a4
remove eslint-config-react-app from package.json as create-react-app …
0xdevalias Apr 28, 2021
8058e9e
remove additional eslint deps from package.json as create-react-app a…
0xdevalias Apr 28, 2021
031b1bd
npm dedup
0xdevalias Apr 28, 2021
4c651ef
ensure our eslint config extends from react-app as create-react-app s…
0xdevalias Apr 28, 2021
21ee8ff
eslint: disable no-redeclare -> enable @typescript-eslint/no-redeclar…
0xdevalias Apr 28, 2021
54c93d2
fix error 'T' is defined but never used @typescript-eslint/no-unuse…
0xdevalias Apr 30, 2021
005ef3f
fix 'checkUserIsOwner' was used before it was defined @typescript-es…
0xdevalias Apr 30, 2021
f8f8a92
fix 'dataOrUpdateKey' was used before it was defined @typescript-esl…
0xdevalias Apr 30, 2021
b40e1f1
fix error 'EditProfileFormValuesType' is defined but never used @ty…
0xdevalias Apr 30, 2021
671a759
fix warning The 'menu' object makes the dependencies of useMemo Hook…
0xdevalias Apr 30, 2021
e1d585d
fix error 'useFirestoreConnect' import from 'react-redux-firebase' …
0xdevalias Apr 30, 2021
6f85a21
fix error 'CSSProperties' is defined but never used @typescript-esl…
0xdevalias Apr 30, 2021
12a2f11
fix warning 'AdminVenuePreview' is already defined @typescript-esli…
0xdevalias Apr 30, 2021
72dd300
fix warning 'RoomInnerForm' is already defined @typescript-eslint/n…
0xdevalias Apr 30, 2021
6dc8c12
fix warning 'TextReactionType' is already defined @typescript-eslin…
0xdevalias Apr 30, 2021
3e3650f
cleanup
0xdevalias Apr 30, 2021
2f9d57d
fix warning 'checkValidServiceWorker' / 'registerValidSW' was used b…
0xdevalias Apr 30, 2021
1096ad8
refactor Audience to accept venue as a prop
0xdevalias May 2, 2021
673dcc8
improve maybeSelector / maybeArraySelector / emptyArraySelector
0xdevalias May 3, 2021
08aa0e1
refactor useConnectRelatedVenues functions to make better use of mayb…
0xdevalias May 3, 2021
7eba538
fix warning The 'venueEvents' logical expression could make the depe…
0xdevalias May 4, 2021
f7379d0
refactor Audience to use usePartygoersbySeat hook
0xdevalias May 4, 2021
325aa1a
refactor Auditorium to extract takeSeat / leaveSeat from main memo
0xdevalias May 4, 2021
780250a
Merge branch 'staging' into devalias/deps-upgrade-react-scripts
0xdevalias May 4, 2021
4a5b3af
fix Jest Validation Error: Directory <rootDir> in the rootDir option …
0xdevalias May 4, 2021
cae1c8a
npm install --save-dev source-map-explorer
0xdevalias May 4, 2021
0640fc0
npm dedup
0xdevalias May 4, 2021
3d343ab
add source-map-explorer analyze script to package.json
0xdevalias May 4, 2021
2cb8936
remove @babel/preset-typescript@7.12.7 as it comes in react-scripts
0xdevalias May 4, 2021
1095327
npm run browserslist:update-db
0xdevalias May 4, 2021
b143afa
add @debt comments for eslint rulesets to enable in future
0xdevalias May 4, 2021
e384d8f
Merge remote-tracking branch 'origin/staging' into devalias/deps-upgr…
0xdevalias May 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
"plugin:react-hooks/recommended"
],
"rules": {
"@typescript-eslint/no-redeclare": "warn",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "error",
// these base rules can report incorrect errors when using TypeScript, see the corresponding @typescript-eslint versions
"no-redeclare": "off",
"no-use-before-define": "off",
"no-restricted-imports": [
"error",
{
Expand Down
108 changes: 54 additions & 54 deletions functions/venue.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,54 @@ const PlacementState = {
Hidden: "HIDDEN",
0xdevalias marked this conversation as resolved.
Show resolved Hide resolved
};

const checkUserIsOwner = async (venueId, uid) => {
await admin
.firestore()
.collection("venues")
.doc(venueId)
.get()
.then(async (doc) => {
if (!doc.exists) {
throw new HttpsError("not-found", `Venue ${venueId} does not exist`);
}
const venue = doc.data();
if (venue.owners && venue.owners.includes(uid)) return;

if (venue.parentId) {
const doc = await admin
.firestore()
.collection("venues")
.doc(venue.parentId)
.get();

if (!doc.exists) {
throw new HttpsError(
"not-found",
`Venue ${venueId} references missing parent ${venue.parentId}`
);
}
const parentVenue = doc.data();
if (!(parentVenue.owners && parentVenue.owners.includes(uid))) {
throw new HttpsError(
"permission-denied",
`User is not an owner of ${venueId} nor parent ${venue.parentId}`
);
}
}

throw new HttpsError(
"permission-denied",
`User is not an owner of ${venueId}`
);
})
.catch((err) => {
throw new HttpsError(
"internal",
`Error occurred obtaining venue ${venueId}: ${err.toString()}`
);
});
};

const checkUserIsAdminOrOwner = async (venueId, uid) => {
try {
return await checkUserIsOwner(venueId, uid);
Expand Down Expand Up @@ -192,53 +240,12 @@ const getVenueId = (name) => {
return name.replace(/\W/g, "").toLowerCase();
};

const checkUserIsOwner = async (venueId, uid) => {
await admin
.firestore()
.collection("venues")
.doc(venueId)
.get()
.then(async (doc) => {
if (!doc.exists) {
throw new HttpsError("not-found", `Venue ${venueId} does not exist`);
}
const venue = doc.data();
if (venue.owners && venue.owners.includes(uid)) return;

if (venue.parentId) {
const doc = await admin
.firestore()
.collection("venues")
.doc(venue.parentId)
.get();

if (!doc.exists) {
throw new HttpsError(
"not-found",
`Venue ${venueId} references missing parent ${venue.parentId}`
);
}
const parentVenue = doc.data();
if (!(parentVenue.owners && parentVenue.owners.includes(uid))) {
throw new HttpsError(
"permission-denied",
`User is not an owner of ${venueId} nor parent ${venue.parentId}`
);
}
}

throw new HttpsError(
"permission-denied",
`User is not an owner of ${venueId}`
);
})
.catch((err) => {
throw new HttpsError(
"internal",
`Error occurred obtaining venue ${venueId}: ${err.toString()}`
);
});
};
const dataOrUpdateKey = (data, updated, key) =>
(data && data[key] && typeof data[key] !== "undefined" && data[key]) ||
(updated &&
updated[key] &&
typeof updated[key] !== "undefined" &&
updated[key]);

/** Add a user to the list of admins
*
Expand Down Expand Up @@ -825,10 +832,3 @@ exports.getOwnerData = functions.https.onCall(async ({ userId }) => {

return user;
});

const dataOrUpdateKey = (data, updated, key) =>
(data && data[key] && typeof data[key] !== "undefined" && data[key]) ||
(updated &&
updated[key] &&
typeof updated[key] !== "undefined" &&
updated[key]);
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
// export default async (): Promise<Config.InitialOptions> => {
module.exports = async () => {
return {
rootDir: "<rootDir>",
rootDir: ".",
roots: ["<rootDir>", "<rootDir>/src"],
verbose: true,
maxWorkers: "50%",

testMatch: [
"{.,src}/**/__tests__/**/*.+(ts|tsx|js)",
"{.,src}/**/?(*.)+(spec|test).+(ts|tsx|js)",
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)",
],

// @debt make these work to actually ignore the paths we want
Expand Down
Loading