Skip to content

Commit

Permalink
Merge branch 'beta' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyDo committed Apr 19, 2023
2 parents 7651e84 + 1ec0ecf commit a65e957
Show file tree
Hide file tree
Showing 25 changed files with 624 additions and 811 deletions.
14 changes: 3 additions & 11 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
# Cross-platform line endings configuration
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# all text files follow Unix end-of-line convention
* text eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.sh text

# Declare files that will always have CRLF line endings on checkout.
# *.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
# avoid modifying binary files
*.png binary
*.jpg binary
*.svg binary
Expand Down
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<!--
Before making a pull request, please:
1. Read the guidelines for contributing
1. Read the guidelines for contributing: https://github.com/metabrainz/guidelines/blob/master/GitHub.md
2. Verify that your changes match our coding style
3. Fill out the requested information
-->

### Problem
<!-- What are you trying to solve? -->
<!-- What are you trying to solve?
Add the JIRA ticket number if you are working on one -->


### Solution
Expand Down
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Docker: Attach to Node",
"port": 9229,
"localRoot": "${workspaceFolder}/src/server/",
"remoteRoot": "/home/bookbrainz/bookbrainz-site/src/server/",
"restart": true,
"sourceMaps": true,
"smartStep": true,
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
"skipFiles": [
"/home/bookbrainz/bookbrainz-site/node_modules/**/*.js",
"<node_internals>/**"
]
},
{
"type": "node",
"request": "launch",
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ to BookBrainz:
* Use [JSDoc](http://usejsdoc.org/) for commenting code
* Use [TypeScript](https://www.typescriptlang.org/) everywhere - static type checking is useful

## Pull requests

Please read carefully the [MetaBrainz Github guidelines](https://github.com/metabrainz/guidelines/blob/master/GitHub.md)

## Commits

We try to keep our commit messages readable and concise, this is especially important as they can't be rewritten—unlike
Expand Down
2 changes: 1 addition & 1 deletion config/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"connection": {
"host": "postgres",
"database": "bookbrainz",
"user": "postgres",
"user": "bookbrainz",
"password": ""
}
},
Expand Down
2 changes: 1 addition & 1 deletion config/config.local.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"connection": {
"host": "localhost",
"database": "bookbrainz",
"user": "postgres",
"user": "bookbrainz",
"password": ""
}
},
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
"bookbrainz-data": "3.0.0",
"chart.js": "^2.9.4",
"chartjs-adapter-date-fns": "^1.0.0",
"classnames": "^2.3.1",
"classnames": "^2.3.2",
"compression": "^1.7.4",
"connect-redis": "^6.0.0",
"connect-redis": "^7.0.0",
"core-js": "^3.20.3",
"cross-env": "^7.0.3",
"date-fns": "^2.15.0",
"debug": "^4.3.2",
"express": "^4.17.2",
"express": "^4.18.2",
"express-session": "^1.17.1",
"express-slow-down": "^1.3.1",
"http-status": "^1.5.0",
"http-status": "^1.6.2",
"immutable": "^3.8.2",
"influx": "^5.9.3",
"isomorphic-dompurify": "^0.13.0",
Expand All @@ -61,7 +61,7 @@
"mocha-chai-jest-snapshot": "^1.1.4",
"morgan": "^1.10.0",
"nodemailer": "^6.5.0",
"passport": "^0.5.2",
"passport": "^0.6.0",
"passport-musicbrainz-oauth2": "git+https://git@github.com/LordSputnik/passport-musicbrainz-oauth2.git",
"prop-types": "^15.8.1",
"react": "^16.13.1",
Expand All @@ -77,32 +77,32 @@
"react-sortable-hoc": "^2.0.0",
"react-sticky": "^6.0.1",
"react-tooltip": "^4.2.21",
"redis": "^3.1.2",
"redux": "^3.7.2",
"redis": "^4.6.5",
"redux": "^4.2.0",
"redux-debounce": "^1.0.1",
"redux-immutable": "^4.0.0",
"redux-thunk": "^2.2.0",
"serve-favicon": "^2.4.3",
"serve-static": "^1.14.1",
"superagent": "^7.1.1",
"superagent": "^8.0.8",
"swagger-jsdoc": "^6.2.5",
"swagger-ui-express": "^4.3.0",
"swagger-ui-express": "^4.6.0",
"validator": "^13.7.0"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.10.1",
"@babel/core": "^7.20.12",
"@babel/node": "^7.14.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
"@babel/plugin-transform-classes": "^7.16.7",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.10.1",
"@babel/preset-react": "^7.16.7",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.12.1",
"@babel/register": "^7.17.0",
"@faker-js/faker": "^7.2.0",
"@types/express": "^4.17.13",
"@types/express": "^4.17.15",
"@types/lodash": "^4.14.164",
"@types/react-select": "^4.0.18",
"@typescript-eslint/eslint-plugin": "^4.28.3",
Expand All @@ -123,7 +123,7 @@
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^7.30.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.26.1",
"eslint-webpack-plugin": "^2.4.1",
Expand All @@ -138,7 +138,7 @@
"resolve-url-loader": "^5.0.0",
"rewire": "^5.0.0",
"sass": "^1.49.0",
"sass-loader": "^12.4.0",
"sass-loader": "^13.2.0",
"sinon": "^14.0.0",
"typescript": "^4.0.5",
"uuid": "^8.3.2",
Expand Down
6 changes: 3 additions & 3 deletions sql/migrations/2019-01-27/down.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BEGIN;
ALTER TABLE bookbrainz.editor ADD COLUMN birth_date DATE;
COMMIT;
BEGIN;
ALTER TABLE bookbrainz.editor ADD COLUMN birth_date DATE;
COMMIT;
10 changes: 5 additions & 5 deletions sql/migrations/2019-01-27/up.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BEGIN;
-- DROP COLUMN BIRTH DATE FROM EDITOR SCHEMA
ALTER TABLE bookbrainz.editor
DROP COLUMN birth_date;
COMMIT;
BEGIN;
-- DROP COLUMN BIRTH DATE FROM EDITOR SCHEMA
ALTER TABLE bookbrainz.editor
DROP COLUMN birth_date;
COMMIT;
21 changes: 13 additions & 8 deletions src/api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import * as search from '../common/helpers/search';
import BookBrainzData from 'bookbrainz-data';
import Debug from 'debug';
import RedisStore from 'connect-redis';
import {get as _get} from 'lodash';
import appCleanup from '../common/helpers/appCleanup';
import compression from 'compression';
Expand All @@ -30,14 +31,14 @@ import {createClient} from 'redis';
import express from 'express';
import initRoutes from './routes';
import logger from 'morgan';
import redis from 'connect-redis';
import session from 'express-session';


// Initialize application
const app = express();
app.locals.orm = BookBrainzData(config.database);

const debug = Debug('bbapi');

app.set('trust proxy', config.site.proxyTrust);

Expand All @@ -59,16 +60,22 @@ const sessionOptions = {
saveUninitialized: false,
secret: config.session.secret
};

if (process.env.NODE_ENV !== 'test') {
const redisHost = _get(config, 'session.redis.host', 'localhost');
const redisPort = _get(config, 'session.redis.port', 6379);
const redisClient = createClient({
host: _get(config, 'session.redis.host', 'localhost'),
port: _get(config, 'session.redis.port', 6379)
url: `redis://${redisHost}:${redisPort}`
});

const RedisStore = redis(session);
sessionOptions.store = new RedisStore({
// eslint-disable-next-line no-console
redisClient.connect().catch(redisError => { console.error('Redis error:', redisError); });

redisClient.on('error', (err) => debug('Error while closing server connections', err));
const redisStore = new RedisStore({
client: redisClient
});
});
sessionOptions.store = redisStore;
}
app.use(session(sessionOptions));

Expand All @@ -93,8 +100,6 @@ mainRouter.use((req, res) => {
search.init(app.locals.orm, Object.assign({}, config.search));


const debug = Debug('bbapi');

const DEFAULT_API_PORT = 9098;
app.set('port', process.env.PORT || DEFAULT_API_PORT);

Expand Down
18 changes: 9 additions & 9 deletions src/client/components/pages/entities/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ function AuthorDisplayPage({entity, identifierTypes, user}) {
const urlPrefix = getEntityUrl(entity);
return (
<div>
<CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>
<Row className="entity-display-background">
<Col className="entity-display-image-box text-center" lg={2}>
<EntityImage
Expand Down Expand Up @@ -197,6 +188,15 @@ function AuthorDisplayPage({entity, identifierTypes, user}) {
lastModified={entity.revision.revision.createdAt}
user={user}
/>
{!entity.deleted && <CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>}
</div>
);
}
Expand Down
18 changes: 9 additions & 9 deletions src/client/components/pages/entities/edition-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ function EditionGroupDisplayPage({entity, identifierTypes, user}) {

return (
<div>
<CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>
<Row className="entity-display-background">
<Col className="entity-display-image-box text-center" lg={2}>
<EntityImage
Expand Down Expand Up @@ -174,6 +165,15 @@ function EditionGroupDisplayPage({entity, identifierTypes, user}) {
lastModified={entity.revision.revision.createdAt}
user={user}
/>
{!entity.deleted && <CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>}
</div>
);
}
Expand Down
18 changes: 9 additions & 9 deletions src/client/components/pages/entities/series.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ function SeriesDisplayPage({entity, identifierTypes, user}) {
};
return (
<div>
<CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>
<Row className="entity-display-background">
<Col className="entity-display-image-box text-center" lg={2}>
<EntityImage
Expand Down Expand Up @@ -172,6 +163,15 @@ function SeriesDisplayPage({entity, identifierTypes, user}) {
lastModified={entity.revision.revision.createdAt}
user={user}
/>
{!entity.deleted && <CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>}
</div>
);
}
Expand Down
18 changes: 9 additions & 9 deletions src/client/components/pages/entities/work.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ function WorkDisplayPage({entity, identifierTypes, user}) {
const urlPrefix = getEntityUrl(entity);
return (
<div>
<CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>
<Row className="entity-display-background">
<Col className="entity-display-image-box text-center" lg={2}>
<EntityImage
Expand Down Expand Up @@ -168,6 +159,15 @@ function WorkDisplayPage({entity, identifierTypes, user}) {
lastModified={entity.revision.revision.createdAt}
user={user}
/>
{!entity.deleted && <CBReviewModal
entityBBID={entity.bbid}
entityName={entity.defaultAlias.name}
entityType={entity.type}
handleModalToggle={handleModalToggle}
handleUpdateReviews={handleUpdateReviews}
showModal={showCBReviewModal}
userId={user?.id}
/>}
</div>
);
}
Expand Down
Loading

0 comments on commit a65e957

Please sign in to comment.