diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 63c7390..81c0c99 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1120,11 +1120,13 @@ const getSearchQueryString = (query, options = {}) => { if (includeUserOptions) { const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE]; - queryParams.push(`claimType=${claimType}`); + if (claimType) { + queryParams.push(`claimType=${claimType}`); - // If they are only searching for channels, strip out the media info - if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) { - queryParams.push(`mediaType=${[SEARCH_OPTIONS.MEDIA_FILE, SEARCH_OPTIONS.MEDIA_AUDIO, SEARCH_OPTIONS.MEDIA_VIDEO, SEARCH_OPTIONS.MEDIA_TEXT, SEARCH_OPTIONS.MEDIA_IMAGE, SEARCH_OPTIONS.MEDIA_APPLICATION].reduce((acc, currentOption) => options[currentOption] ? `${acc}${currentOption},` : acc, '')}`); + // If they are only searching for channels, strip out the media info + if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) { + queryParams.push(`mediaType=${[SEARCH_OPTIONS.MEDIA_FILE, SEARCH_OPTIONS.MEDIA_AUDIO, SEARCH_OPTIONS.MEDIA_VIDEO, SEARCH_OPTIONS.MEDIA_TEXT, SEARCH_OPTIONS.MEDIA_IMAGE, SEARCH_OPTIONS.MEDIA_APPLICATION].reduce((acc, currentOption) => options[currentOption] ? `${acc}${currentOption},` : acc, '')}`); + } } } @@ -1614,9 +1616,9 @@ var _extends$2 = Object.assign || function (target) { for (var i = 1; i < argume function extractUserState(rawObj) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = rawObj.value; + const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = rawObj.value; - return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}); + return _extends$2({}, subscriptions ? { subscriptions } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, tv_welcome_version ? { tv_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}); } return {}; @@ -1624,10 +1626,10 @@ function extractUserState(rawObj) { function doPopulateSharedUserState(sharedSettings) { return dispatch => { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = extractUserState(sharedSettings); + const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = extractUserState(sharedSettings); dispatch({ type: USER_STATE_POPULATE, - data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P } + data: { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } }); }; } @@ -1687,7 +1689,7 @@ const buildSharedStateMiddleware = (actions, sharedStateFilters, sharedStateCb) } const actionResult = next(action); - // Call `getState` after calling `next` tqo ensure the state has updated in response to the action + // Call `getState` after calling `next` to ensure the state has updated in response to the action const nextState = getState(); const shared = {}; @@ -2395,13 +2397,9 @@ const makeSelectResolvedRecommendedContentForUri = (uri, size) => reselect.creat return; } - const options = { related_to: claim.claim_id, isBackgroundSearch: true }; - if (!isMature) { - options['nsfw'] = false; - } + const options = { related_to: claim.claim_id, size, isBackgroundSearch: false }; const searchQuery = getSearchQueryString(title.replace(/\//, ' '), options); - let results = resolvedResultsByQuery[searchQuery]; if (results) { results = results.filter(result => buildURI({ streamClaimId: result.claimId, streamName: result.name }) !== currentUri); @@ -3255,7 +3253,7 @@ function doRepost(options) { }); dispatch(doFetchClaimListMine(1, 10)); - resolve(repostClaim); + resolve(); } function failure(error) { diff --git a/src/redux/actions/claims.js b/src/redux/actions/claims.js index 752e081..4e12c8d 100644 --- a/src/redux/actions/claims.js +++ b/src/redux/actions/claims.js @@ -485,7 +485,7 @@ export function doRepost(options: StreamRepostOptions) { }); dispatch(doFetchClaimListMine(1, 10)); - resolve(repostClaim); + resolve(); } function failure(error) { diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 28b8d7a..9a1854e 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -10,13 +10,14 @@ type SharedData = { blocked?: Array, settings?: any, app_welcome_version?: number, + tv_welcome_version?: number, sharing_3P?: boolean, }, }; function extractUserState(rawObj: SharedData) { if (rawObj && rawObj.version === '0.1' && rawObj.value) { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = rawObj.value; + const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = rawObj.value; return { ...(subscriptions ? { subscriptions } : {}), @@ -24,6 +25,7 @@ function extractUserState(rawObj: SharedData) { ...(blocked ? { blocked } : {}), ...(settings ? { settings } : {}), ...(app_welcome_version ? { app_welcome_version } : {}), + ...(tv_welcome_version ? { tv_welcome_version } : {}), ...(sharing_3P ? { sharing_3P} : {}), }; } @@ -33,10 +35,10 @@ function extractUserState(rawObj: SharedData) { export function doPopulateSharedUserState(sharedSettings: any) { return (dispatch: Dispatch) => { - const { subscriptions, tags, blocked, settings, app_welcome_version, sharing_3P } = extractUserState(sharedSettings); + const { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P } = extractUserState(sharedSettings); dispatch({ type: ACTIONS.USER_STATE_POPULATE, - data: { subscriptions, tags, blocked, settings, welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P }, + data: { subscriptions, tags, blocked, settings, app_welcome_version, tv_welcome_version, sharing_3P }, }); }; } diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 6f67721..4db130a 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -701,13 +701,9 @@ export const makeSelectResolvedRecommendedContentForUri = (uri: string, size: nu related_to?: string, nsfw?: boolean, isBackgroundSearch?: boolean, - } = { related_to: claim.claim_id, isBackgroundSearch: true }; - if (!isMature) { - options['nsfw'] = false; - } + } = { related_to: claim.claim_id, size, isBackgroundSearch: false }; const searchQuery = getSearchQueryString(title.replace(/\//, ' '), options); - let results = resolvedResultsByQuery[searchQuery]; if (results) { results = results.filter( diff --git a/src/util/query-params.js b/src/util/query-params.js index 80a1d54..bb1d5ec 100644 --- a/src/util/query-params.js +++ b/src/util/query-params.js @@ -48,23 +48,25 @@ export const getSearchQueryString = ( if (includeUserOptions) { const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE]; - queryParams.push(`claimType=${claimType}`); + if (claimType) { + queryParams.push(`claimType=${claimType}`); - // If they are only searching for channels, strip out the media info - if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) { - queryParams.push( - `mediaType=${[ - SEARCH_OPTIONS.MEDIA_FILE, - SEARCH_OPTIONS.MEDIA_AUDIO, - SEARCH_OPTIONS.MEDIA_VIDEO, - SEARCH_OPTIONS.MEDIA_TEXT, - SEARCH_OPTIONS.MEDIA_IMAGE, - SEARCH_OPTIONS.MEDIA_APPLICATION, - ].reduce( - (acc, currentOption) => (options[currentOption] ? `${acc}${currentOption},` : acc), - '' - )}` - ); + // If they are only searching for channels, strip out the media info + if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) { + queryParams.push( + `mediaType=${[ + SEARCH_OPTIONS.MEDIA_FILE, + SEARCH_OPTIONS.MEDIA_AUDIO, + SEARCH_OPTIONS.MEDIA_VIDEO, + SEARCH_OPTIONS.MEDIA_TEXT, + SEARCH_OPTIONS.MEDIA_IMAGE, + SEARCH_OPTIONS.MEDIA_APPLICATION, + ].reduce( + (acc, currentOption) => (options[currentOption] ? `${acc}${currentOption},` : acc), + '' + )}` + ); + } } }