Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeyDo committed Jun 14, 2021
2 parents ad23adc + a837286 commit 1adebee
Show file tree
Hide file tree
Showing 18 changed files with 340 additions and 198 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ notifications:
email: false
irc:
channels:
- "chat.freenode.net#metabrainz"
- "libera.chat#bookbrainz"
on_success: always
on_failure: always
template:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ directories will exist:

## Contact and updates

Any questions? You can get in contact with the community on [our IRC channel](https://webchat.freenode.net/?channels=#bookbrainz) or [our forums](https://community.metabrainz.org/c/bookbrainz), or send us [an email](mailto:bookbrainz@metabrainz.org)
Any questions? You can get in contact with the community on [our IRC channel](https://kiwiirc.com/nextclient/irc.libera.chat/?#bookbrainz) or [our forums](https://community.metabrainz.org/c/bookbrainz), or send us [an email](mailto:bookbrainz@metabrainz.org)

Breaking changes to the database schema or our API will be announced on
[our blog](https://blog.metabrainz.org/category/bookbrainz/), along with our other major updates,
Expand Down
290 changes: 192 additions & 98 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"bookbrainz-data": "^2.10.0",
"chart.js": "^2.9.4",
"chartjs-adapter-date-fns": "^1.0.0",
"classnames": "^2.2.5",
"classnames": "^2.3.1",
"compression": "^1.7.1",
"connect-redis": "^3.4.2",
"core-js": "^3.8.3",
Expand Down Expand Up @@ -78,24 +78,24 @@
"serve-favicon": "^2.4.3",
"serve-static": "^1.14.1",
"snyk": "^1.385.0",
"superagent": "^5.3.1",
"superagent": "^6.1.0",
"swagger-jsdoc": "^4.0.0",
"swagger-ui-express": "^4.1.4",
"validator": "^9.1.2"
},
"devDependencies": {
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.1",
"@babel/node": "^7.10.1",
"@babel/node": "^7.14.2",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.10.1",
"@babel/plugin-transform-classes": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.1",
"@babel/preset-env": "^7.10.1",
"@babel/preset-react": "^7.10.1",
"@babel/preset-typescript": "^7.12.1",
"@babel/register": "^7.10.1",
"@types/express": "^4.17.8",
"@babel/register": "^7.14.5",
"@types/express": "^4.17.11",
"@types/lodash": "^4.14.164",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/forms/deletion.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class EntityDeletionForm extends React.Component {
</a>
&nbsp;or on our&nbsp;
<a
href="//webchat.freenode.net/?channels=#bookbrainz"
href="//kiwiirc.com/nextclient/irc.libera.chat/?#bookbrainz"
rel="noopener noreferrer"
target="_blank"
>
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function AboutPage() {
className="margin-sides-1 contact-text"
icon={faCircle}
/>
<a className="contact-text" href="//webchat.freenode.net/?channels=#bookbrainz">
<a className="contact-text" href="//kiwiirc.com/nextclient/irc.libera.chat/?#bookbrainz">
<FontAwesomeIcon
className="contact-text"
icon={faCommentDots}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/contribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const {PageHeader} = bootstrap;
* Contribute page
*/
function ContributePage() {
const IRCLink = 'https://webchat.freenode.net/?channels=#bookbrainz';
const IRCLink = 'https://kiwiirc.com/nextclient/irc.libera.chat/?#bookbrainz';
const styleLink =
'https://bookbrainz-user-guide.readthedocs.io/' +
'en/latest/style/introduction/';
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const {PageHeader, ListGroup, ListGroupItem, Grid, Col, Row} = bootstrap;
* @returns {ReactElement} a HTML document to display the Develop page
*/
function HelpPage() {
const IRCLink = 'https://webchat.freenode.net/?channels=#bookbrainz';
const IRCLink = 'https://kiwiirc.com/nextclient/irc.libera.chat/?#bookbrainz';
const styleLink =
'https://bookbrainz-user-guide.readthedocs.io/' +
'en/latest/style/introduction/';
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class IndexPage extends React.Component {
className="margin-sides-1 contact-text"
icon={faCircle}
/>
<a className="contact-text" href="//webchat.freenode.net/?channels=#bookbrainz">
<a className="contact-text" href="//kiwiirc.com/nextclient/irc.libera.chat/?#bookbrainz">
<FontAwesomeIcon
className="contact-text"
icon={faCommentDots}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/parts/editor-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class EditorProfileTab extends React.Component {
<p className="text-center">
{model.achievement.name}
</p>
<p className="text=center">
<p className="text-center">
{model.achievement.description}
</p>
<p className="text-center">
Expand Down
17 changes: 15 additions & 2 deletions src/client/containers/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

import * as bootstrap from 'react-bootstrap';
import {
faChartLine, faGripVertical, faInfo, faListUl, faPlus, faQuestionCircle, faSearch, faSignInAlt, faSignOutAlt, faUserCircle
faChartLine, faGripVertical, faListUl, faPlus, faQuestionCircle,
faSearch, faSignInAlt, faSignOutAlt, faTrophy, faUserCircle
} from '@fortawesome/free-solid-svg-icons';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import Footer from './../components/footer';
Expand Down Expand Up @@ -158,9 +159,21 @@ class Layout extends React.Component {
onMouseDown={this.handleMouseDown}
>
<MenuItem href={`/editor/${user.id}`}>
<FontAwesomeIcon fixedWidth icon={faInfo}/>
<FontAwesomeIcon fixedWidth icon={faUserCircle}/>
{' Profile'}
</MenuItem>
<MenuItem href={`/editor/${user.id}/revisions`}>
<FontAwesomeIcon fixedWidth icon={faListUl}/>
{' Revisions'}
</MenuItem>
<MenuItem href={`/editor/${user.id}/achievements`}>
<FontAwesomeIcon fixedWidth icon={faTrophy}/>
{' Achievements'}
</MenuItem>
<MenuItem href={`/editor/${user.id}/collections`}>
<FontAwesomeIcon fixedWidth icon={faGripVertical}/>
{' Collections'}
</MenuItem>
<MenuItem {...disableSignUp} href="/logout">
<FontAwesomeIcon fixedWidth icon={faSignOutAlt}/>
{' Sign Out'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ class EntitySearchFieldOption extends React.Component {
q: manipulatedQuery,
type: this.props.type
});
const options = response.body.filter(entity => entity.bbid !== this.props.bbid);
return {
options: response.body.map(this.entityToOption)
options: options.map(this.entityToOption)
};
}

Expand All @@ -121,6 +122,7 @@ class EntitySearchFieldOption extends React.Component {

EntitySearchFieldOption.displayName = 'EntitySearchFieldOption';
EntitySearchFieldOption.propTypes = {
bbid: PropTypes.string,
empty: PropTypes.bool,
error: PropTypes.bool,
label: PropTypes.string.isRequired,
Expand All @@ -132,6 +134,7 @@ EntitySearchFieldOption.propTypes = {
]).isRequired
};
EntitySearchFieldOption.defaultProps = {
bbid: null,
empty: true,
error: false,
languageOptions: [],
Expand Down
171 changes: 95 additions & 76 deletions src/client/entity-editor/entity-merge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import _ from 'lodash';
import {connect} from 'react-redux';
import {faAngleDoubleLeft} from '@fortawesome/free-solid-svg-icons';
import {getEntityLink} from '../../server/helpers/utils';
import {submit} from './submission-section/actions';


type OwnProps = {
Expand All @@ -46,17 +47,24 @@ type StateProps = {
identifierSet: any
};

type Props = StateProps & OwnProps;
type DispatchProps = {
onSubmit: () => unknown
};

type Props = StateProps & OwnProps & DispatchProps;

/**
* Container component. Renders all of the sections of the entity editing form.
*
* @param {Object} props - The properties passed to the component.
* @param {React.Node} props.children - The child content to wrap with this
* entity editor form.
* @param {Array} props.mergingEntities - An array of entities that are being merge
* @param {boolean} props.identifierSet - Concatenated identifiers from entities in merging
* @param {boolean} props.identifierTypes - possible identifier types for this entity type
* @param {string} props.subheading - Subheading at the top of the html page
* @param {React.Node} props.children - The child content to wrap with this
* entity editor form.
* @param {Function} props.onSubmit - A function to be called when the
* submit button is clicked.
* @returns {ReactElement} React element containing the rendered EntityMerge.
*/
const EntityMerge = (props: Props) => {
Expand All @@ -65,83 +73,86 @@ const EntityMerge = (props: Props) => {
mergingEntities,
identifierSet,
identifierTypes,
subheading
subheading,
onSubmit
} = props;
const identifiers = _.values(identifierSet.toJS()) || [];
return (
<Panel>
<Panel.Heading>
<Panel.Title componentClass="h2">
<p>{subheading}</p>
<form onSubmit={onSubmit}>
<Panel>
<Panel.Heading>
<Panel.Title componentClass="h2">
<p>{subheading}</p>
<div>
{mergingEntities.map((entity, index) => {
const entityForDisplay = {
link: getEntityLink({bbid: entity.bbid, type: entity.type}),
text: _.get(entity, ['defaultAlias', 'name']),
type: entity.type,
unnamedText: '(unnamed)'
};
const isNotLast = index < mergingEntities.length - 1;
return (
<span key={entity.bbid}>
<Entity {...entityForDisplay}/>
{isNotLast && <FontAwesomeIcon className="margin-sides-d5" icon={faAngleDoubleLeft}/>}
</span>
);
})}
</div>
</Panel.Title>
</Panel.Heading>
<Panel.Body>
<p className="alert alert-info">
You are merging into entity {mergingEntities[0].bbid}. If you want to merge into another entity instead,
you can select the correct entity in the merge queue at the bottom of the page and click
the <i>Merge into selected entity</i> button again.
This will reload the page with the new merge target selected.
</p>
<p className="text-muted">
Select and review the data to merge.
For further modifications, edit the resulting merged entity.
</p>
<div>
{mergingEntities.map((entity, index) => {
const entityForDisplay = {
link: getEntityLink({bbid: entity.bbid, type: entity.type}),
text: _.get(entity, ['defaultAlias', 'name']),
type: entity.type,
unnamedText: '(unnamed)'
};
const isNotLast = index < mergingEntities.length - 1;
return (
<span key={entity.bbid}>
<Entity {...entityForDisplay}/>
{isNotLast && <FontAwesomeIcon className="margin-sides-d5" icon={faAngleDoubleLeft}/>}
</span>
);
})}
<Row>
<Col md={5} mdOffset={1}>
<NameSectionMerge {...props}/>
</Col>
<Col md={5} mdOffset={1}>
<AliasEditorMerge {...props}/>
</Col>
</Row>
<Row>
<Col md={5} mdOffset={1}>
{
React.cloneElement(
React.Children.only(children),
{...props}
)
}
</Col>
</Row>
<Row>
<Col md={8}>
<RelationshipSection {...props}/>
</Col>
<Col md={4}>
<EntityIdentifiers
identifierTypes={identifierTypes}
identifiers={identifiers}
/>
</Col>
</Row>
<AnnotationSection {...props}/>
</div>
</Panel.Title>
</Panel.Heading>
<Panel.Body>
<p className="alert alert-info">
You are merging into entity {mergingEntities[0].bbid}. If you want to merge into another entity instead,
you can select the correct entity in the merge queue at the bottom of the page and click
the <i>Merge into selected entity</i> button again.
This will reload the page with the new merge target selected.
</p>
<p className="text-muted">
Select and review the data to merge.
For further modifications, edit the resulting merged entity.
</p>
<div>
<Row>
<Col md={5} mdOffset={1}>
<NameSectionMerge {...props}/>
</Col>
<Col md={5} mdOffset={1}>
<AliasEditorMerge {...props}/>
</Col>
</Row>
<Row>
<Col md={5} mdOffset={1}>
{
React.cloneElement(
React.Children.only(children),
{...props}
)
}
</Col>
</Row>
<Row>
<Col md={8}>
<RelationshipSection {...props}/>
</Col>
<Col md={4}>
<EntityIdentifiers
identifierTypes={identifierTypes}
identifiers={identifiers}
/>
</Col>
</Row>
<AnnotationSection {...props}/>
</div>
</Panel.Body>
<Panel.Footer>
<div>
<SubmissionSection {...props}/>
</div>
</Panel.Footer>
</Panel>
</Panel.Body>
<Panel.Footer>
<div>
<SubmissionSection {...props}/>
</div>
</Panel.Footer>
</Panel>
</form>
);
};
EntityMerge.displayName = 'EntityMerge';
Expand All @@ -151,5 +162,13 @@ function mapStateToProps(rootState): StateProps {
identifierSet: rootState.get('identifierEditor', {})
};
}
function mapDispatchToProps(dispatch, {submissionUrl}) {
return {
onSubmit: (event:React.FormEvent) => {
event.preventDefault();
dispatch(submit(submissionUrl));
}
};
}

export default connect(mapStateToProps)(EntityMerge);
export default connect(mapStateToProps, mapDispatchToProps)(EntityMerge);
Loading

0 comments on commit 1adebee

Please sign in to comment.