Compare commits
3 commits
master
...
feat-backg
Author | SHA1 | Date | |
---|---|---|---|
|
34b20795e3 | ||
|
d45317807e | ||
|
e83153804d |
2 changed files with 60 additions and 36 deletions
20
dist/bundle.es.js
vendored
20
dist/bundle.es.js
vendored
|
@ -4465,11 +4465,15 @@ function doCollectionPublish(options, localId) {
|
|||
};
|
||||
}
|
||||
|
||||
function doCollectionPublishUpdate(options) {
|
||||
return dispatch => {
|
||||
function doCollectionPublishUpdate(options, isBackgroundUpdate) {
|
||||
return (dispatch, getState) => {
|
||||
// TODO: implement one click update
|
||||
|
||||
const updateParams = {
|
||||
const updateParams = isBackgroundUpdate ? {
|
||||
blocking: true,
|
||||
claim_id: options.claim_id,
|
||||
clear_claims: true
|
||||
} : {
|
||||
bid: creditsToString(options.bid),
|
||||
title: options.title,
|
||||
thumbnail_url: options.thumbnail_url,
|
||||
|
@ -4482,13 +4486,17 @@ function doCollectionPublishUpdate(options) {
|
|||
clear_claims: true
|
||||
};
|
||||
|
||||
if (isBackgroundUpdate && updateParams.claim_id) {
|
||||
const state = getState();
|
||||
updateParams['claims'] = makeSelectClaimIdsForCollectionId(updateParams.claim_id)(state);
|
||||
} else if (options.claims) {
|
||||
updateParams['claims'] = options.claims;
|
||||
}
|
||||
|
||||
if (options.tags) {
|
||||
updateParams['tags'] = options.tags.map(tag => tag.name);
|
||||
}
|
||||
|
||||
if (options.claims) {
|
||||
updateParams['claims'] = options.claims;
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
dispatch({
|
||||
type: COLLECTION_PUBLISH_UPDATE_STARTED
|
||||
|
|
|
@ -19,7 +19,10 @@ import { creditsToString } from 'util/format-credits';
|
|||
import { batchActions } from 'util/batch-actions';
|
||||
import { createNormalizedClaimSearchKey } from 'util/claim';
|
||||
import { PAGE_SIZE } from 'constants/claim';
|
||||
import { selectPendingCollections } from 'redux/selectors/collections';
|
||||
import {
|
||||
selectPendingCollections,
|
||||
makeSelectClaimIdsForCollectionId,
|
||||
} from 'redux/selectors/collections';
|
||||
import {
|
||||
doFetchItemsInCollection,
|
||||
doFetchItemsInCollections,
|
||||
|
@ -76,7 +79,7 @@ export function doResolveUris(
|
|||
const collectionIds: Array<string> = [];
|
||||
|
||||
return Lbry.resolve({ urls: urisToResolve, ...options }).then(
|
||||
async(result: ResolveResponse) => {
|
||||
async (result: ResolveResponse) => {
|
||||
let repostedResults = {};
|
||||
const repostsToResolve = [];
|
||||
const fallbackResolveInfo = {
|
||||
|
@ -648,7 +651,7 @@ export function doClaimSearch(
|
|||
}
|
||||
) {
|
||||
const query = createNormalizedClaimSearchKey(options);
|
||||
return async(dispatch: Dispatch) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.CLAIM_SEARCH_STARTED,
|
||||
data: { query: query },
|
||||
|
@ -828,18 +831,21 @@ export function doCollectionPublish(
|
|||
};
|
||||
}
|
||||
|
||||
export function doCollectionPublishUpdate(options: {
|
||||
bid?: string,
|
||||
blocking?: true,
|
||||
title?: string,
|
||||
thumbnail_url?: string,
|
||||
description?: string,
|
||||
claim_id: string,
|
||||
tags?: Array<Tag>,
|
||||
languages?: Array<string>,
|
||||
claims?: Array<string>,
|
||||
}) {
|
||||
return (dispatch: Dispatch): Promise<any> => {
|
||||
export function doCollectionPublishUpdate(
|
||||
options: {
|
||||
bid?: string,
|
||||
blocking?: true,
|
||||
title?: string,
|
||||
thumbnail_url?: string,
|
||||
description?: string,
|
||||
claim_id: string,
|
||||
tags?: Array<Tag>,
|
||||
languages?: Array<string>,
|
||||
claims?: Array<string>,
|
||||
},
|
||||
isBackgroundUpdate?: boolean
|
||||
) {
|
||||
return (dispatch: Dispatch, getState: GetState): Promise<any> => {
|
||||
// TODO: implement one click update
|
||||
|
||||
const updateParams: {
|
||||
|
@ -853,26 +859,36 @@ export function doCollectionPublishUpdate(options: {
|
|||
languages?: Array<string>,
|
||||
claims?: Array<string>,
|
||||
clear_claims: boolean,
|
||||
} = {
|
||||
bid: creditsToString(options.bid),
|
||||
title: options.title,
|
||||
thumbnail_url: options.thumbnail_url,
|
||||
description: options.description,
|
||||
tags: [],
|
||||
languages: options.languages || [],
|
||||
locations: [],
|
||||
blocking: true,
|
||||
claim_id: options.claim_id,
|
||||
clear_claims: true,
|
||||
};
|
||||
} = isBackgroundUpdate
|
||||
? {
|
||||
blocking: true,
|
||||
claim_id: options.claim_id,
|
||||
clear_claims: true,
|
||||
}
|
||||
: {
|
||||
bid: creditsToString(options.bid),
|
||||
title: options.title,
|
||||
thumbnail_url: options.thumbnail_url,
|
||||
description: options.description,
|
||||
tags: [],
|
||||
languages: options.languages || [],
|
||||
locations: [],
|
||||
blocking: true,
|
||||
claim_id: options.claim_id,
|
||||
clear_claims: true,
|
||||
};
|
||||
|
||||
if (isBackgroundUpdate && updateParams.claim_id) {
|
||||
const state = getState();
|
||||
updateParams['claims'] = makeSelectClaimIdsForCollectionId(updateParams.claim_id)(state);
|
||||
} else if (options.claims) {
|
||||
updateParams['claims'] = options.claims;
|
||||
}
|
||||
|
||||
if (options.tags) {
|
||||
updateParams['tags'] = options.tags.map(tag => tag.name);
|
||||
}
|
||||
|
||||
if (options.claims) {
|
||||
updateParams['claims'] = options.claims;
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
dispatch({
|
||||
type: ACTIONS.COLLECTION_PUBLISH_UPDATE_STARTED,
|
||||
|
|
Loading…
Reference in a new issue