Compare commits

..

1 commit

Author SHA1 Message Date
zeppi
8dbaf67dce use replace for list updates 2021-09-10 23:36:55 -04:00
4 changed files with 33 additions and 51 deletions

16
dist/bundle.es.js vendored
View file

@ -1040,7 +1040,7 @@ var daemon_settings = /*#__PURE__*/Object.freeze({
const SDK_SYNC_KEYS = [LBRYUM_SERVERS, SHARE_USAGE_DATA]; const SDK_SYNC_KEYS = [LBRYUM_SERVERS, SHARE_USAGE_DATA];
// CLIENT // CLIENT
const CLIENT_SYNC_KEYS = [SHOW_MATURE, HIDE_REPOSTS, SHOW_ANONYMOUS, INSTANT_PURCHASE_ENABLED, INSTANT_PURCHASE_MAX, THEME, AUTOPLAY_MEDIA, AUTOPLAY_NEXT, HIDE_BALANCE, HIDE_SPLASH_ANIMATION, FLOATING_PLAYER, DARK_MODE_TIMES, AUTOMATIC_DARK_MODE_ENABLED, LANGUAGE]; const CLIENT_SYNC_KEYS = [SHOW_MATURE, HIDE_REPOSTS, SHOW_ANONYMOUS, INSTANT_PURCHASE_ENABLED, INSTANT_PURCHASE_MAX, THEME, AUTOPLAY_MEDIA, AUTOPLAY_NEXT, HIDE_BALANCE, HIDE_SPLASH_ANIMATION, FLOATING_PLAYER, DARK_MODE_TIMES, AUTOMATIC_DARK_MODE_ENABLED];
var shared_preferences = /*#__PURE__*/Object.freeze({ var shared_preferences = /*#__PURE__*/Object.freeze({
SDK_SYNC_KEYS: SDK_SYNC_KEYS, SDK_SYNC_KEYS: SDK_SYNC_KEYS,
@ -4535,10 +4535,6 @@ function doCollectionPublishUpdate(options, isBackgroundUpdate) {
updateParams['tags'] = options.tags.map(tag => tag.name); updateParams['tags'] = options.tags.map(tag => tag.name);
} }
if (options.channel_id) {
updateParams['channel_id'] = options.channel_id;
}
return new Promise(resolve => { return new Promise(resolve => {
dispatch({ dispatch({
type: COLLECTION_PUBLISH_UPDATE_STARTED type: COLLECTION_PUBLISH_UPDATE_STARTED
@ -5633,7 +5629,7 @@ const doUpdatePublishForm = publishFormValue => dispatch => dispatch({
data: _extends$7({}, publishFormValue) data: _extends$7({}, publishFormValue)
}); });
const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path, cb) => dispatch => { const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => dispatch => {
const downMessage = __('Thumbnail upload service may be down, try again later.'); const downMessage = __('Thumbnail upload service may be down, try again later.');
let thumbnail, fileExt, fileName, fileType; let thumbnail, fileExt, fileName, fileType;
@ -5667,17 +5663,13 @@ const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path, cb) =>
method: 'POST', method: 'POST',
body: data body: data
}).then(res => res.text()).then(text => text.length ? JSON.parse(text) : {}).then(json => { }).then(res => res.text()).then(text => text.length ? JSON.parse(text) : {}).then(json => {
if (!json.success) return uploadError(json.message || downMessage); return json.success ? dispatch({
if (cb) {
cb(json.data.serveUrl);
}
return dispatch({
type: UPDATE_PUBLISH_FORM, type: UPDATE_PUBLISH_FORM,
data: { data: {
uploadThumbnailStatus: COMPLETE, uploadThumbnailStatus: COMPLETE,
thumbnail: json.data.serveUrl thumbnail: json.data.serveUrl
} }
}); }) : uploadError(json.message || downMessage);
}).catch(err => { }).catch(err => {
let message = err.message; let message = err.message;

View file

@ -28,5 +28,4 @@ export const CLIENT_SYNC_KEYS = [
SETTINGS.FLOATING_PLAYER, SETTINGS.FLOATING_PLAYER,
SETTINGS.DARK_MODE_TIMES, SETTINGS.DARK_MODE_TIMES,
SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, SETTINGS.AUTOMATIC_DARK_MODE_ENABLED,
SETTINGS.LANGUAGE,
]; ];

View file

@ -79,7 +79,7 @@ export function doResolveUris(
const collectionIds: Array<string> = []; const collectionIds: Array<string> = [];
return Lbry.resolve({ urls: urisToResolve, ...options }).then( return Lbry.resolve({ urls: urisToResolve, ...options }).then(
async(result: ResolveResponse) => { async (result: ResolveResponse) => {
let repostedResults = {}; let repostedResults = {};
const repostsToResolve = []; const repostsToResolve = [];
const fallbackResolveInfo = { const fallbackResolveInfo = {
@ -651,7 +651,7 @@ export function doClaimSearch(
} }
) { ) {
const query = createNormalizedClaimSearchKey(options); const query = createNormalizedClaimSearchKey(options);
return async(dispatch: Dispatch) => { return async (dispatch: Dispatch) => {
dispatch({ dispatch({
type: ACTIONS.CLAIM_SEARCH_STARTED, type: ACTIONS.CLAIM_SEARCH_STARTED,
data: { query: query }, data: { query: query },
@ -842,7 +842,6 @@ export function doCollectionPublishUpdate(
tags?: Array<Tag>, tags?: Array<Tag>,
languages?: Array<string>, languages?: Array<string>,
claims?: Array<string>, claims?: Array<string>,
channel_id?: string,
}, },
isBackgroundUpdate?: boolean isBackgroundUpdate?: boolean
) { ) {
@ -854,33 +853,32 @@ export function doCollectionPublishUpdate(
blocking?: true, blocking?: true,
title?: string, title?: string,
thumbnail_url?: string, thumbnail_url?: string,
channel_id?: string,
description?: string, description?: string,
claim_id: string, claim_id: string,
tags?: Array<string>, tags?: Array<string>,
languages?: Array<string>, languages?: Array<string>,
claims?: Array<string>, claims?: Array<string>,
clear_claims: boolean, clear_claims: boolean,
replace?: boolean, replace: boolean,
} = isBackgroundUpdate } = isBackgroundUpdate
? { ? {
blocking: true, blocking: true,
claim_id: options.claim_id, claim_id: options.claim_id,
clear_claims: true, 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,
description: options.description, description: options.description,
tags: [], tags: [],
languages: options.languages || [], languages: options.languages || [],
locations: [], locations: [],
blocking: true, blocking: true,
claim_id: options.claim_id, claim_id: options.claim_id,
clear_claims: true, clear_claims: true,
replace: true, replace: true,
}; };
if (isBackgroundUpdate && updateParams.claim_id) { if (isBackgroundUpdate && updateParams.claim_id) {
const state = getState(); const state = getState();
@ -893,10 +891,6 @@ export function doCollectionPublishUpdate(
updateParams['tags'] = options.tags.map(tag => tag.name); updateParams['tags'] = options.tags.map(tag => tag.name);
} }
if (options.channel_id) {
updateParams['channel_id'] = options.channel_id;
}
return new Promise(resolve => { return new Promise(resolve => {
dispatch({ dispatch({
type: ACTIONS.COLLECTION_PUBLISH_UPDATE_STARTED, type: ACTIONS.COLLECTION_PUBLISH_UPDATE_STARTED,

View file

@ -69,8 +69,7 @@ export const doUploadThumbnail = (
thumbnailBlob?: File, thumbnailBlob?: File,
fsAdapter?: any, fsAdapter?: any,
fs?: any, fs?: any,
path?: any, path?: any
cb?: (string) => void
) => (dispatch: Dispatch) => { ) => (dispatch: Dispatch) => {
const downMessage = __('Thumbnail upload service may be down, try again later.'); const downMessage = __('Thumbnail upload service may be down, try again later.');
let thumbnail, fileExt, fileName, fileType; let thumbnail, fileExt, fileName, fileType;
@ -113,17 +112,15 @@ export const doUploadThumbnail = (
.then(res => res.text()) .then(res => res.text())
.then(text => (text.length ? JSON.parse(text) : {})) .then(text => (text.length ? JSON.parse(text) : {}))
.then(json => { .then(json => {
if (!json.success) return uploadError(json.message || downMessage); return json.success
if (cb) { ? dispatch({
cb(json.data.serveUrl); type: ACTIONS.UPDATE_PUBLISH_FORM,
} data: {
return dispatch({ uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE,
type: ACTIONS.UPDATE_PUBLISH_FORM, thumbnail: json.data.serveUrl,
data: { },
uploadThumbnailStatus: THUMBNAIL_STATUSES.COMPLETE, })
thumbnail: json.data.serveUrl, : uploadError(json.message || downMessage);
},
});
}) })
.catch(err => { .catch(err => {
let message = err.message; let message = err.message;