1
0
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:
Tim Daubenschütz 2016-02-01 14:47:51 +01:00
parent e2a481a3f0
commit b405bc675b
10 changed files with 20 additions and 29 deletions

View File

@ -1,4 +1,4 @@
'use strict'
'use strict';
import React from 'react';

View File

@ -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);
}

View File

@ -1,4 +1,4 @@
'use strict'
'use strict';
import React from 'react';
import Moment from 'moment';

View File

@ -1,4 +1,4 @@
'use strict'
'use strict';
import React from 'react';

View File

@ -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;
},

View File

@ -52,13 +52,11 @@ let IkonotvPieceList = React.createClass({
},
shouldRedirect(pieceCount) {
const {
contractAgreementListNotifications,
const { contractAgreementListNotifications,
currentUser: { email: userEmail },
whitelabel: {
user: whitelabelAdminEmail
}
} = this.state;
} } = this.state;
return contractAgreementListNotifications &&
!contractAgreementListNotifications.length &&

View File

@ -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}

View File

@ -112,8 +112,7 @@ let MarketRegisterPiece = React.createClass({
render() {
const { location } = this.props;
const {
piece,
const { piece,
step,
whitelabel: {
name: whitelabelName = 'Market'

View File

@ -1,4 +1,4 @@
'use strict'
'use strict';
// TODO: Create Unittests that test all functions

View File

@ -1,4 +1,4 @@
'use strict'
'use strict';
import camelCase from 'camelcase';
import decamelize from 'decamelize';