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