This commit is contained in:
Sean Yesmunt 2019-11-05 13:52:17 -05:00
parent 03d53fb4dd
commit e3d1e87544
5 changed files with 30 additions and 25 deletions

12
dist/bundle.es.js vendored
View file

@ -2881,10 +2881,10 @@ function doFetchChannelListMine(page = 1, pageSize = 99999) {
type: FETCH_CHANNEL_LIST_STARTED
});
const callback = channels => {
const callback = response => {
dispatch({
type: FETCH_CHANNEL_LIST_COMPLETED,
data: { claims: channels.items }
data: { claims: response.items }
});
};
@ -3017,7 +3017,7 @@ const selectFileListDownloadedSort = reselect.createSelector(selectState$3, stat
const selectDownloadedUris = reselect.createSelector(selectFileInfosDownloaded,
// We should use permament_url but it doesn't exist in file_list
info => info.slice().reverse().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
info => info.slice().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
const makeSelectMediaTypeForUri = uri => reselect.createSelector(makeSelectFileInfoForUri(uri), makeSelectContentTypeForUri(uri), (fileInfo, contentType) => {
if (!fileInfo && !contentType) {
@ -3068,7 +3068,11 @@ const makeSelectSearchDownloadUrlsForPage = (query, page = 1) => reselect.create
const start = (Number(page) - 1) * Number(PAGE_SIZE);
const end = Number(page) * Number(PAGE_SIZE);
return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos.slice(start, end).map(fileInfo => buildURI({ streamName: fileInfo.claim_name, channelName: fileInfo.channel_name, channelClaimId: fileInfo.channel_claim_id })) : [];
return matchingFileInfos && matchingFileInfos.length ? matchingFileInfos.slice(start, end).map(fileInfo => buildURI({
streamName: fileInfo.claim_name,
channelName: fileInfo.channel_name,
channelClaimId: fileInfo.channel_claim_id
})) : [];
});
const makeSelectSearchDownloadUrlsCount = query => reselect.createSelector(selectFileInfosDownloaded, fileInfos => {

View file

@ -215,11 +215,11 @@ declare type LbryTypes = {
publish: (params: {}) => Promise<PublishResponse>,
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
claim_list: (params?: {}) => Promise<ClaimListResponse>,
claim_list: (params: {}) => Promise<ClaimListResponse>,
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
channel_import: (params: {}) => Promise<string>,
channel_list: (params?: {}) => Promise<ChannelListResponse>,
channel_list: (params: {}) => Promise<ChannelListResponse>,
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
stream_list: (params: {}) => Promise<StreamListResponse>,
channel_abandon: (params: {}) => Promise<GenericTxResponse>,

4
flow-typed/Lbry.js vendored
View file

@ -215,11 +215,11 @@ declare type LbryTypes = {
publish: (params: {}) => Promise<PublishResponse>,
claim_search: (params: {}) => Promise<ClaimSearchResponse>,
claim_list: (params?: {}) => Promise<ClaimListResponse>,
claim_list: (params: {}) => Promise<ClaimListResponse>,
channel_create: (params: {}) => Promise<ChannelCreateResponse>,
channel_update: (params: {}) => Promise<ChannelUpdateResponse>,
channel_import: (params: {}) => Promise<string>,
channel_list: (params?: {}) => Promise<ChannelListResponse>,
channel_list: (params: {}) => Promise<ChannelListResponse>,
stream_abandon: (params: {}) => Promise<GenericTxResponse>,
stream_list: (params: {}) => Promise<StreamListResponse>,
channel_abandon: (params: {}) => Promise<GenericTxResponse>,

View file

@ -388,10 +388,10 @@ export function doFetchChannelListMine(page: number = 1, pageSize: number = 9999
type: ACTIONS.FETCH_CHANNEL_LIST_STARTED,
});
const callback = (channels: ChannelListResponse) => {
const callback = (response: ChannelListResponse) => {
dispatch({
type: ACTIONS.FETCH_CHANNEL_LIST_COMPLETED,
data: { claims: channels.items },
data: { claims: response.items },
});
};

View file

@ -146,11 +146,7 @@ export const selectFileListDownloadedSort = createSelector(
export const selectDownloadedUris = createSelector(
selectFileInfosDownloaded,
// We should use permament_url but it doesn't exist in file_list
info =>
info
.slice()
.reverse()
.map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
info => info.slice().map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
);
export const makeSelectMediaTypeForUri = uri =>
@ -214,9 +210,11 @@ function filterFileInfos(fileInfos, query) {
const queryMatchRegExp = new RegExp(query, 'i');
return fileInfos.filter(fileInfo => {
const { metadata } = fileInfo;
return (metadata.title && metadata.title.match(queryMatchRegExp)) ||
return (
(metadata.title && metadata.title.match(queryMatchRegExp)) ||
(fileInfo.channel_name && fileInfo.channel_name.match(queryMatchRegExp)) ||
(fileInfo.claim_name && fileInfo.claim_name.match(queryMatchRegExp));
(fileInfo.claim_name && fileInfo.claim_name.match(queryMatchRegExp))
);
});
}
@ -228,22 +226,25 @@ export const makeSelectSearchDownloadUrlsForPage = (query, page = 1) =>
selectFileInfosDownloaded,
fileInfos => {
const matchingFileInfos = filterFileInfos(fileInfos, query);
const start = ((Number(page) - 1) * Number(PAGE_SIZE));
const end = (Number(page) * Number(PAGE_SIZE));
const start = (Number(page) - 1) * Number(PAGE_SIZE);
const end = Number(page) * Number(PAGE_SIZE);
return (matchingFileInfos && matchingFileInfos.length)
return matchingFileInfos && matchingFileInfos.length
? matchingFileInfos.slice(start, end).map(fileInfo =>
buildURI({ streamName: fileInfo.claim_name, channelName: fileInfo.channel_name, channelClaimId: fileInfo.channel_claim_id }))
buildURI({
streamName: fileInfo.claim_name,
channelName: fileInfo.channel_name,
channelClaimId: fileInfo.channel_claim_id,
})
)
: [];
}
);
export const makeSelectSearchDownloadUrlsCount = (query) =>
export const makeSelectSearchDownloadUrlsCount = query =>
createSelector(
selectFileInfosDownloaded,
fileInfos => {
return fileInfos && fileInfos.length
? filterFileInfos(fileInfos, query).length
: 0;
return fileInfos && fileInfos.length ? filterFileInfos(fileInfos, query).length : 0;
}
);