changes for 38

This commit is contained in:
Sean Yesmunt 2019-06-04 12:06:19 -04:00
parent a01b919c72
commit 1b98a13082
7 changed files with 68 additions and 38 deletions

27
dist/bundle.es.js vendored
View file

@ -1975,13 +1975,22 @@ function doResolveUris(uris, returnCachedClaims = false) {
// Flow has terrible Object.entries support // Flow has terrible Object.entries support
// https://github.com/facebook/flow/issues/2221 // https://github.com/facebook/flow/issues/2221
// $FlowFixMe if (uriResolveInfo) {
if (uriResolveInfo.error) { if (uriResolveInfo.error) {
resolveInfo[uri] = _extends$3({}, fallbackResolveInfo); resolveInfo[uri] = _extends$3({}, fallbackResolveInfo);
} else { } else {
let result = {};
if (uriResolveInfo.value_type === 'channel') {
result.certificate = uriResolveInfo;
// $FlowFixMe // $FlowFixMe
const { claim, certificate, claims_in_channel: claimsInChannel } = uriResolveInfo; result.claimsInChannel = uriResolveInfo.meta.claims_in_channel;
resolveInfo[uri] = { claim, certificate, claimsInChannel }; } else {
result.claim = uriResolveInfo;
}
// $FlowFixMe
resolveInfo[uri] = result;
}
} }
}); });
@ -2095,7 +2104,7 @@ function doFetchClaimsByChannel(uri, page = 1) {
data: { uri, page } data: { uri, page }
}); });
lbryProxy.claim_search({ channel_name: uri, page: page || 1, winning: true }).then(result => { lbryProxy.claim_search({ channel: uri, controlling: true, page: page || 1 }).then(result => {
const { items: claimsInChannel, page: returnedPage } = result; const { items: claimsInChannel, page: returnedPage } = result;
dispatch({ dispatch({
@ -3155,16 +3164,6 @@ reducers$2[LOADING_VIDEO_FAILED] = (state, action) => {
}); });
}; };
reducers$2[FETCH_DATE] = (state, action) => {
const { time } = action.data;
if (time) {
return Object.assign({}, state, {
publishedDate: time
});
}
return null;
};
reducers$2[SET_FILE_LIST_SORT] = (state, action) => { reducers$2[SET_FILE_LIST_SORT] = (state, action) => {
const pageSortStates = { const pageSortStates = {
[PUBLISHED]: 'fileListPublishedSort', [PUBLISHED]: 'fileListPublishedSort',

View file

@ -44,6 +44,20 @@ declare type GenericClaim = {
type: 'claim' | 'update' | 'support', type: 'claim' | 'update' | 'support',
valid_at_height?: number, // BUG: this should always exist https://github.com/lbryio/lbry/issues/1728 valid_at_height?: number, // BUG: this should always exist https://github.com/lbryio/lbry/issues/1728
value_type: 'stream' | 'channel', value_type: 'stream' | 'channel',
meta: {
activation_height: number,
creation_height: number,
creation_timestamp: number,
effective_amount: string,
expiration_height: number,
is_controlling: boolean,
support_amount: string,
trending_global: number,
trending_group: number,
trending_local: number,
trending_mixed: number,
claims_in_channel?: number,
},
}; };
declare type GenericMetadata = { declare type GenericMetadata = {

View file

@ -67,7 +67,9 @@ declare type ResolveResponse = {
// Keys are the url(s) passed to resolve // Keys are the url(s) passed to resolve
[string]: [string]:
| { error: {}, certificate: ChannelClaim, claims_in_channel: number } | { error: {}, certificate: ChannelClaim, claims_in_channel: number }
| { error?: {}, claim: StreamClaim, certificate?: ChannelClaim }, | StreamClaim
| ChannelClaim
| { error?: {} },
}; };
declare type GetResponse = FileListItem; declare type GetResponse = FileListItem;

14
flow-typed/Claim.js vendored
View file

@ -44,6 +44,20 @@ declare type GenericClaim = {
type: 'claim' | 'update' | 'support', type: 'claim' | 'update' | 'support',
valid_at_height?: number, // BUG: this should always exist https://github.com/lbryio/lbry/issues/1728 valid_at_height?: number, // BUG: this should always exist https://github.com/lbryio/lbry/issues/1728
value_type: 'stream' | 'channel', value_type: 'stream' | 'channel',
meta: {
activation_height: number,
creation_height: number,
creation_timestamp: number,
effective_amount: string,
expiration_height: number,
is_controlling: boolean,
support_amount: string,
trending_global: number,
trending_group: number,
trending_local: number,
trending_mixed: number,
claims_in_channel?: number,
},
}; };
declare type GenericMetadata = { declare type GenericMetadata = {

4
flow-typed/Lbry.js vendored
View file

@ -67,7 +67,9 @@ declare type ResolveResponse = {
// Keys are the url(s) passed to resolve // Keys are the url(s) passed to resolve
[string]: [string]:
| { error: {}, certificate: ChannelClaim, claims_in_channel: number } | { error: {}, certificate: ChannelClaim, claims_in_channel: number }
| { error?: {}, claim: StreamClaim, certificate?: ChannelClaim }, | StreamClaim
| ChannelClaim
| { error?: {} },
}; };
declare type GetResponse = FileListItem; declare type GetResponse = FileListItem;

View file

@ -50,13 +50,22 @@ export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean =
// Flow has terrible Object.entries support // Flow has terrible Object.entries support
// https://github.com/facebook/flow/issues/2221 // https://github.com/facebook/flow/issues/2221
// $FlowFixMe if (uriResolveInfo) {
if (uriResolveInfo.error) { if (uriResolveInfo.error) {
resolveInfo[uri] = { ...fallbackResolveInfo }; resolveInfo[uri] = { ...fallbackResolveInfo };
} else { } else {
let result = {};
if (uriResolveInfo.value_type === 'channel') {
result.certificate = uriResolveInfo;
// $FlowFixMe // $FlowFixMe
const { claim, certificate, claims_in_channel: claimsInChannel } = uriResolveInfo; result.claimsInChannel = uriResolveInfo.meta.claims_in_channel;
resolveInfo[uri] = { claim, certificate, claimsInChannel }; } else {
result.claim = uriResolveInfo;
}
// $FlowFixMe
resolveInfo[uri] = result;
}
} }
}); });
@ -182,7 +191,7 @@ export function doFetchClaimsByChannel(uri: string, page: number = 1) {
data: { uri, page }, data: { uri, page },
}); });
Lbry.claim_search({ channel_name: uri, page: page || 1, winning: true }).then( Lbry.claim_search({ channel: uri, controlling: true, page: page || 1 }).then(
(result: ClaimSearchResponse) => { (result: ClaimSearchResponse) => {
const { items: claimsInChannel, page: returnedPage } = result; const { items: claimsInChannel, page: returnedPage } = result;

View file

@ -161,16 +161,6 @@ reducers[ACTIONS.LOADING_VIDEO_FAILED] = (state, action) => {
}); });
}; };
reducers[ACTIONS.FETCH_DATE] = (state, action) => {
const { time } = action.data;
if (time) {
return Object.assign({}, state, {
publishedDate: time,
});
}
return null;
};
reducers[ACTIONS.SET_FILE_LIST_SORT] = (state, action) => { reducers[ACTIONS.SET_FILE_LIST_SORT] = (state, action) => {
const pageSortStates = { const pageSortStates = {
[PAGES.PUBLISHED]: 'fileListPublishedSort', [PAGES.PUBLISHED]: 'fileListPublishedSort',