prepopulate thumbnail on edit

This commit is contained in:
Sean Yesmunt 2018-06-13 00:19:39 -04:00
parent ae93a0d95d
commit 6f666e757f
2 changed files with 9 additions and 2 deletions

View file

@ -50,6 +50,7 @@ type Props = {
publishing: boolean, publishing: boolean,
balance: number, balance: number,
isStillEditing: boolean, isStillEditing: boolean,
thumbnailUploadStatus: string,
clearPublish: () => void, clearPublish: () => void,
resolveUri: string => void, resolveUri: string => void,
scrollToTop: () => void, scrollToTop: () => void,
@ -73,7 +74,10 @@ class PublishForm extends React.PureComponent<Props> {
} }
componentWillMount() { componentWillMount() {
this.props.resetThumbnailStatus(); const { isStillEditing, thumbnail } = this.props;
if (!isStillEditing || !thumbnail) {
this.props.resetThumbnailStatus();
}
} }
getNewUri(name: string, channel: string) { getNewUri(name: string, channel: string) {

View file

@ -22,8 +22,10 @@ type PromiseAction = Promise<Action>;
type Dispatch = (action: Action | PromiseAction | Array<Action>) => any; type Dispatch = (action: Action | PromiseAction | Array<Action>) => any;
type GetState = () => {}; type GetState = () => {};
export const doClearPublish = () => (dispatch: Dispatch): Action => export const doClearPublish = () => (dispatch: Dispatch): PromiseAction => {
dispatch({ type: ACTIONS.CLEAR_PUBLISH }); dispatch({ type: ACTIONS.CLEAR_PUBLISH });
return dispatch(doResetThumbnailStatus());
};
export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) => ( export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) => (
dispatch: Dispatch dispatch: Dispatch
@ -160,6 +162,7 @@ export const doPrepareEdit = (claim: any, uri: string) => (dispatch: Dispatch) =
thumbnail, thumbnail,
title, title,
uri, uri,
uploadThumbnailStatus: thumbnail ? STATUSES.MANUAL : undefined,
}; };
dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData }); dispatch({ type: ACTIONS.DO_PREPARE_EDIT, data: publishData });