Compare commits
3 commits
master
...
disable-an
Author | SHA1 | Date | |
---|---|---|---|
|
ac63db1ddf | ||
|
c3395c9c58 | ||
|
916e5d0efa |
8 changed files with 112 additions and 48 deletions
45
dist/bundle.es.js
vendored
45
dist/bundle.es.js
vendored
|
@ -1614,7 +1614,14 @@ 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,
|
||||
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 } : {});
|
||||
}
|
||||
|
@ -1624,10 +1631,24 @@ 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,
|
||||
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,
|
||||
welcomeVersion: app_welcome_version,
|
||||
allowAnalytics: sharing_3P
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -1687,7 +1708,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 = {};
|
||||
|
||||
|
@ -4367,9 +4388,23 @@ function doCommentCreate(comment = '', claim_id = '', channel, parent_id) {
|
|||
dispatch({
|
||||
type: COMMENT_CREATE_STARTED
|
||||
});
|
||||
|
||||
const myChannels = selectMyChannelClaims(state);
|
||||
const namedChannelClaim = myChannels && myChannels.find(myChannel => myChannel.name === channel);
|
||||
const channel_id = namedChannelClaim ? namedChannelClaim.claim_id : null;
|
||||
const channel_id = namedChannelClaim.claim_id;
|
||||
|
||||
if (channel_id == null) {
|
||||
dispatch({
|
||||
type: COMMENT_CREATE_FAILED,
|
||||
data: {}
|
||||
});
|
||||
dispatch(doToast({
|
||||
message: 'Channel cannot be anonymous, please select a channel and try again.',
|
||||
isError: true
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
return lbryProxy.comment_create({
|
||||
comment: comment,
|
||||
claim_id: claim_id,
|
||||
|
|
|
@ -42,7 +42,7 @@ export function doCommentList(uri: string, page: number = 1, pageSize: number =
|
|||
export function doCommentCreate(
|
||||
comment: string = '',
|
||||
claim_id: string = '',
|
||||
channel: ?string,
|
||||
channel: string,
|
||||
parent_id?: string
|
||||
) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
|
@ -50,10 +50,26 @@ export function doCommentCreate(
|
|||
dispatch({
|
||||
type: ACTIONS.COMMENT_CREATE_STARTED,
|
||||
});
|
||||
|
||||
const myChannels = selectMyChannelClaims(state);
|
||||
const namedChannelClaim =
|
||||
myChannels && myChannels.find(myChannel => myChannel.name === channel);
|
||||
const channel_id = namedChannelClaim ? namedChannelClaim.claim_id : null;
|
||||
const channel_id = namedChannelClaim.claim_id;
|
||||
|
||||
if (channel_id == null) {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_CREATE_FAILED,
|
||||
data: {},
|
||||
});
|
||||
dispatch(
|
||||
doToast({
|
||||
message: 'Channel cannot be anonymous, please select a channel and try again.',
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return Lbry.comment_create({
|
||||
comment: comment,
|
||||
claim_id: claim_id,
|
||||
|
|
|
@ -16,7 +16,14 @@ type SharedData = {
|
|||
|
||||
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,
|
||||
sharing_3P,
|
||||
} = rawObj.value;
|
||||
|
||||
return {
|
||||
...(subscriptions ? { subscriptions } : {}),
|
||||
|
@ -33,10 +40,24 @@ 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,
|
||||
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,
|
||||
welcomeVersion: app_welcome_version,
|
||||
allowAnalytics: sharing_3P,
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -172,21 +172,15 @@ type CustomOptions = {
|
|||
from?: number,
|
||||
related_to?: string,
|
||||
nsfw?: boolean,
|
||||
}
|
||||
};
|
||||
|
||||
export const makeSelectQueryWithOptions = (
|
||||
customQuery: ?string,
|
||||
options: CustomOptions,
|
||||
) =>
|
||||
export const makeSelectQueryWithOptions = (customQuery: ?string, options: CustomOptions) =>
|
||||
createSelector(
|
||||
selectSearchValue,
|
||||
selectSearchOptions,
|
||||
(query, defaultOptions) => {
|
||||
const searchOptions = { ...defaultOptions, ...options };
|
||||
const queryString = getSearchQueryString(
|
||||
customQuery || query,
|
||||
searchOptions,
|
||||
);
|
||||
const queryString = getSearchQueryString(customQuery || query, searchOptions);
|
||||
|
||||
return queryString;
|
||||
}
|
||||
|
|
|
@ -33,10 +33,7 @@ export function toQueryString(params: { [string]: string | number }) {
|
|||
return parts.join('&');
|
||||
}
|
||||
|
||||
export const getSearchQueryString = (
|
||||
query: string,
|
||||
options: any = {},
|
||||
) => {
|
||||
export const getSearchQueryString = (query: string, options: any = {}) => {
|
||||
const encodedQuery = encodeURIComponent(query);
|
||||
const queryParams = [
|
||||
`s=${encodedQuery}`,
|
||||
|
@ -44,7 +41,8 @@ export const getSearchQueryString = (
|
|||
`from=${options.from || DEFAULT_SEARCH_RESULT_FROM}`,
|
||||
];
|
||||
const { isBackgroundSearch } = options;
|
||||
const includeUserOptions = typeof isBackgroundSearch === 'undefined' ? false : !isBackgroundSearch;
|
||||
const includeUserOptions =
|
||||
typeof isBackgroundSearch === 'undefined' ? false : !isBackgroundSearch;
|
||||
|
||||
if (includeUserOptions) {
|
||||
const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE];
|
||||
|
@ -68,7 +66,7 @@ export const getSearchQueryString = (
|
|||
}
|
||||
}
|
||||
|
||||
const additionalOptions = {}
|
||||
const additionalOptions = {};
|
||||
const { related_to } = options;
|
||||
const { nsfw } = options;
|
||||
if (related_to) additionalOptions['related_to'] = related_to;
|
||||
|
|
Loading…
Reference in a new issue