Merge pull request #154 from lbryio/038-fixes

fix: controlling and channel claim count meta
This commit is contained in:
Sean Yesmunt 2019-06-17 15:37:06 -04:00 committed by GitHub
commit 3ab2eeb8bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 17 deletions

26
dist/bundle.es.js vendored
View file

@ -1997,7 +1997,7 @@ function doResolveUris(uris, returnCachedClaims = false) {
result.stream = uriResolveInfo;
if (uriResolveInfo.signing_channel) {
result.channel = uriResolveInfo.signing_channel;
result.claimsInChannel = uriResolveInfo.signing_channel.meta.claims_in_channel;
result.claimsInChannel = uriResolveInfo.signing_channel.meta && uriResolveInfo.signing_channel.meta.claims_in_channel || 0;
}
}
@ -2117,7 +2117,12 @@ function doFetchClaimsByChannel(uri, page = 1) {
data: { uri, page }
});
lbryProxy.claim_search({ channel: uri, is_controlling: true, page: page || 1, order_by: ['release_time'] }).then(result => {
lbryProxy.claim_search({
channel: uri,
valid_channel_signatures: true,
page: page || 1,
order_by: ['release_time']
}).then(result => {
const { items: claimsInChannel, page: returnedPage } = result;
dispatch({
@ -2738,20 +2743,15 @@ reducers[RESOLVE_URIS_COMPLETED] = (state, action) => {
// $FlowFixMe
Object.entries(resolveInfo).forEach(([uri, { channel, stream }]) => {
if (stream && !channel) {
if (stream) {
byId[stream.claim_id] = stream;
byUri[uri] = stream.claim_id;
} else if (stream && channel) {
byId[stream.claim_id] = stream;
byUri[uri] = stream.claim_id;
}
if (channel) {
byId[channel.claim_id] = channel;
const channelUri = channel.permanent_url;
byUri[channelUri] = channel.claim_id;
} else if (!stream && channel) {
byId[channel.claim_id] = channel;
byUri[uri] = channel.claim_id;
} else {
byUri[stream ? channel.permanent_url : uri] = channel.claim_id;
}
if (!stream && !channel) {
byUri[uri] = null;
}
});

View file

@ -4,13 +4,13 @@ declare type Claim = StreamClaim | ChannelClaim;
declare type ChannelClaim = GenericClaim & {
is_channel_signature_valid?: boolean, // we may have signed channels in the future, fixes some flow issues for now.
signing_channel?: ChannelMetadata,
signing_channel?: ChannelClaim,
value: ChannelMetadata,
};
declare type StreamClaim = GenericClaim & {
is_channel_signature_valid?: boolean,
signing_channel?: ChannelMetadata,
signing_channel?: ChannelClaim,
value: StreamMetadata,
};

View file

@ -64,7 +64,9 @@ export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean =
if (uriResolveInfo.signing_channel) {
result.channel = uriResolveInfo.signing_channel;
result.claimsInChannel =
(uriResolveInfo.meta && uriResolveInfo.meta.claims_in_channel) || 0;
(uriResolveInfo.signing_channel.meta &&
uriResolveInfo.signing_channel.meta.claims_in_channel) ||
0;
}
}
@ -198,7 +200,7 @@ export function doFetchClaimsByChannel(uri: string, page: number = 1) {
Lbry.claim_search({
channel: uri,
is_controlling: true,
valid_channel_signatures: true,
page: page || 1,
order_by: ['release_time'],
}).then((result: ClaimSearchResponse) => {