add isBackgroundUpdate to collection update
This commit is contained in:
parent
e4d0662100
commit
8fa92d872d
1 changed files with 26 additions and 15 deletions
|
@ -19,7 +19,7 @@ import { creditsToString } from 'util/format-credits';
|
||||||
import { batchActions } from 'util/batch-actions';
|
import { batchActions } from 'util/batch-actions';
|
||||||
import { createNormalizedClaimSearchKey } from 'util/claim';
|
import { createNormalizedClaimSearchKey } from 'util/claim';
|
||||||
import { PAGE_SIZE } from 'constants/claim';
|
import { PAGE_SIZE } from 'constants/claim';
|
||||||
import { selectPendingCollections } from 'redux/selectors/collections';
|
import { selectPendingCollections, makeSelectEditedCollectionForId } from 'redux/selectors/collections';
|
||||||
import {
|
import {
|
||||||
doFetchItemsInCollection,
|
doFetchItemsInCollection,
|
||||||
doFetchItemsInCollections,
|
doFetchItemsInCollections,
|
||||||
|
@ -838,9 +838,10 @@ export function doCollectionPublishUpdate(options: {
|
||||||
tags?: Array<Tag>,
|
tags?: Array<Tag>,
|
||||||
languages?: Array<string>,
|
languages?: Array<string>,
|
||||||
claims?: Array<string>,
|
claims?: Array<string>,
|
||||||
}) {
|
}, isBackgroundUpdate?: boolean) {
|
||||||
return (dispatch: Dispatch): Promise<any> => {
|
return (dispatch: Dispatch, getState: GetState): Promise<any> => {
|
||||||
// TODO: implement one click update
|
// TODO: implement one click update
|
||||||
|
const state = getState();
|
||||||
|
|
||||||
const updateParams: {
|
const updateParams: {
|
||||||
bid?: string,
|
bid?: string,
|
||||||
|
@ -853,7 +854,13 @@ export function doCollectionPublishUpdate(options: {
|
||||||
languages?: Array<string>,
|
languages?: Array<string>,
|
||||||
claims?: Array<string>,
|
claims?: Array<string>,
|
||||||
clear_claims: boolean,
|
clear_claims: boolean,
|
||||||
} = {
|
} = isBackgroundUpdate
|
||||||
|
? {
|
||||||
|
blocking: true,
|
||||||
|
claim_id: options.claim_id,
|
||||||
|
clear_claims: true,
|
||||||
|
}
|
||||||
|
: {
|
||||||
bid: creditsToString(options.bid),
|
bid: creditsToString(options.bid),
|
||||||
title: options.title,
|
title: options.title,
|
||||||
thumbnail_url: options.thumbnail_url,
|
thumbnail_url: options.thumbnail_url,
|
||||||
|
@ -866,6 +873,10 @@ export function doCollectionPublishUpdate(options: {
|
||||||
clear_claims: true,
|
clear_claims: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (isBackgroundUpdate && updateParams.claim_id) {
|
||||||
|
updateParams.claims = makeSelectEditedCollectionForId(updateParams.claim_id)(state);
|
||||||
|
}
|
||||||
|
|
||||||
if (options.tags) {
|
if (options.tags) {
|
||||||
updateParams['tags'] = options.tags.map(tag => tag.name);
|
updateParams['tags'] = options.tags.map(tag => tag.name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue