mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Fix PR feedback
This commit is contained in:
parent
e2a481a3f0
commit
b405bc675b
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
@ -67,9 +67,9 @@ let PieceList = React.createClass({
|
||||
orderParams: ['artist_name', 'title'],
|
||||
redirectTo: {
|
||||
pathname: '/register_piece',
|
||||
query: {}
|
||||
query: null
|
||||
},
|
||||
shouldRedirect: () => true
|
||||
shouldRedirect: (pieceCount) => !pieceCount
|
||||
};
|
||||
},
|
||||
|
||||
@ -126,14 +126,14 @@ let PieceList = React.createClass({
|
||||
const { location: { query }, redirectTo, shouldRedirect } = this.props;
|
||||
const { unfilteredPieceListCount } = this.state;
|
||||
|
||||
if (redirectTo && redirectTo.pathname && unfilteredPieceListCount === 0 &&
|
||||
if (redirectTo && redirectTo.pathname &&
|
||||
(typeof shouldRedirect === 'function' && shouldRedirect(unfilteredPieceListCount))) {
|
||||
// FIXME: hack to redirect out of the dispatch cycle
|
||||
window.setTimeout(() => this.history.push({
|
||||
// Occasionally, the back end also sets query parameters for Onion.
|
||||
// We need to consider this by merging all passed query parameters, as we'll
|
||||
// otherwise end up in a 404 screen
|
||||
query: Object.assign(query, redirectTo.query),
|
||||
query: Object.assign({}, query, redirectTo.query),
|
||||
pathname: redirectTo.pathname
|
||||
}), 0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import Moment from 'moment';
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
|
@ -45,12 +45,10 @@ let CylandPieceList = React.createClass({
|
||||
},
|
||||
|
||||
shouldRedirect(pieceCount) {
|
||||
const {
|
||||
currentUser: { email: userEmail },
|
||||
const { currentUser: { email: userEmail },
|
||||
whitelabel: {
|
||||
user: whitelabelAdminEmail
|
||||
}
|
||||
} = this.state;
|
||||
} } = this.state;
|
||||
|
||||
return userEmail !== whitelabelAdminEmail && !pieceCount;
|
||||
},
|
||||
|
@ -52,13 +52,11 @@ let IkonotvPieceList = React.createClass({
|
||||
},
|
||||
|
||||
shouldRedirect(pieceCount) {
|
||||
const {
|
||||
contractAgreementListNotifications,
|
||||
currentUser: { email: userEmail },
|
||||
const { contractAgreementListNotifications,
|
||||
currentUser: { email: userEmail },
|
||||
whitelabel: {
|
||||
user: whitelabelAdminEmail
|
||||
}
|
||||
} = this.state;
|
||||
} } = this.state;
|
||||
|
||||
return contractAgreementListNotifications &&
|
||||
!contractAgreementListNotifications.length &&
|
||||
|
@ -49,10 +49,6 @@ let MarketPieceList = React.createClass({
|
||||
this.setState(state);
|
||||
},
|
||||
|
||||
shouldRedirect(isUserAdmin) {
|
||||
return (pieceCount) => !isUserAdmin && !pieceCount;
|
||||
},
|
||||
|
||||
render() {
|
||||
const { customThumbnailPlaceholder, location } = this.props;
|
||||
const {
|
||||
@ -89,7 +85,7 @@ let MarketPieceList = React.createClass({
|
||||
'slide_num': 0
|
||||
}
|
||||
}}
|
||||
shouldRedirect={this.shouldRedirect(isUserAdmin)}
|
||||
shouldRedirect={(pieceCount) => !isUserAdmin && !pieceCount}
|
||||
bulkModalButtonListType={MarketAclButtonList}
|
||||
customThumbnailPlaceholder={customThumbnailPlaceholder}
|
||||
filterParams={filterParams}
|
||||
|
@ -112,12 +112,11 @@ let MarketRegisterPiece = React.createClass({
|
||||
|
||||
render() {
|
||||
const { location } = this.props;
|
||||
const {
|
||||
piece,
|
||||
step,
|
||||
whitelabel: {
|
||||
name: whitelabelName = 'Market'
|
||||
} } = this.state;
|
||||
const { piece,
|
||||
step,
|
||||
whitelabel: {
|
||||
name: whitelabelName = 'Market'
|
||||
} } = this.state;
|
||||
|
||||
setDocumentTitle(getLangText('Register a new piece'));
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
// TODO: Create Unittests that test all functions
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
import camelCase from 'camelcase';
|
||||
import decamelize from 'decamelize';
|
||||
|
Loading…
Reference in New Issue
Block a user