Refactor and reformat

This commit is contained in:
liamcardenas 2018-03-08 23:46:16 -08:00
parent c8cad17f97
commit a4faab5e86
2 changed files with 15 additions and 7 deletions

View file

@ -15,8 +15,12 @@ class FileList extends React.PureComponent {
this._sortFunctions = {
dateNew: fileInfos =>
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
const height1 = this.props.claimsById[fileInfo1.claim_id] ? this.props.claimsById[fileInfo1.claim_id].height : 0;
const height2 = this.props.claimsById[fileInfo2.claim_id] ? this.props.claimsById[fileInfo2.claim_id].height : 0;
const height1 = this.props.claimsById[fileInfo1.claim_id]
? this.props.claimsById[fileInfo1.claim_id].height
: 0;
const height2 = this.props.claimsById[fileInfo2.claim_id]
? this.props.claimsById[fileInfo2.claim_id].height
: 0;
if (height1 > height2) {
return -1;
} else if (height1 < height2) {
@ -26,8 +30,12 @@ class FileList extends React.PureComponent {
}),
dateOld: fileInfos =>
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
const height1 = this.props.claimsById[fileInfo1.claim_id] ? this.props.claimsById[fileInfo1.claim_id].height : 999999;
const height2 = this.props.claimsById[fileInfo2.claim_id] ? this.props.claimsById[fileInfo2.claim_id].height : 999999;
const height1 = this.props.claimsById[fileInfo1.claim_id]
? this.props.claimsById[fileInfo1.claim_id].height
: 999999;
const height2 = this.props.claimsById[fileInfo2.claim_id]
? this.props.claimsById[fileInfo2.claim_id].height
: 999999;
if (height1 < height2) {
return -1;
} else if (height1 > height2) {

View file

@ -215,7 +215,7 @@ Lbry.getAppVersionInfo = () =>
*/
Lbry.file_list = (params = {}) =>
new Promise((resolve, reject) => {
const { claim_name, channel_name: channelName, outpoint } = params;
const { claim_name: claimName, channel_name: channelName, outpoint } = params;
/**
* If we're searching by outpoint, check first to see if there's a matching pending publish.
@ -234,10 +234,10 @@ Lbry.file_list = (params = {}) =>
'file_list',
params,
fileInfos => {
removePendingPublishIfNeeded({ claim_name, channelName, outpoint });
removePendingPublishIfNeeded({ name: claimName, channelName, outpoint });
// if a naked file_list call, append the pending file infos
if (!claim_name && !channelName && !outpoint) {
if (!claimName && !channelName && !outpoint) {
const dummyFileInfos = Lbry.getPendingPublishes().map(pendingPublishToDummyFileInfo);
resolve([...fileInfos, ...dummyFileInfos]);