cancel editing loses is_public

This commit is contained in:
muerwre 2019-02-14 10:18:04 +07:00
parent 8391408bb3
commit 679c485b89
4 changed files with 8 additions and 7 deletions

View file

@ -98,7 +98,7 @@ class Component extends React.PureComponent<Props, void> {
className={classnames({ primary: changed, disabled: !changed })} className={classnames({ primary: changed, disabled: !changed })}
onClick={this.startSaveMode} onClick={this.startSaveMode}
> >
<span className="desktop-only">СХОРОНИТЬ</span> <span className="desktop-only">СОХРАНИТЬ</span>
<Icon icon="icon-check-1" /> <Icon icon="icon-check-1" />
</button> </button>
</div> </div>

View file

@ -10,6 +10,9 @@
## FEATURES ## FEATURES
todo hide arrows on small zooms
todo hide stickers and route on small zooms (?)
todo selecting logo on crop todo selecting logo on crop
todo save spinner todo save spinner

View file

@ -290,6 +290,7 @@ export class Editor {
setInitialData = () => { setInitialData = () => {
const { path } = getUrlData(); const { path } = getUrlData();
const { id } = this.getUser(); const { id } = this.getUser();
const { is_public } = this.getState();
const { route, stickers, provider } = this.dumpData(); const { route, stickers, provider } = this.dumpData();
this.initialData = { this.initialData = {
@ -301,6 +302,7 @@ export class Editor {
route, route,
stickers, stickers,
provider, provider,
is_public,
}; };
}; };

View file

@ -400,7 +400,7 @@ function* changeProviderSaga({ provider }: ReturnType<typeof ActionCreators.chan
} }
function* locationChangeSaga({ location }: ReturnType<typeof ActionCreators.locationChanged>) { function* locationChangeSaga({ location }: ReturnType<typeof ActionCreators.locationChanged>) {
const { address, ready, user: { id, random_url } } = yield select(getState); const { address, ready, user: { id, random_url }, is_public } = yield select(getState);
if (!ready) return; if (!ready) return;
@ -410,11 +410,9 @@ function* locationChangeSaga({ location }: ReturnType<typeof ActionCreators.loca
const map = yield call(loadMapSaga, path); const map = yield call(loadMapSaga, path);
if (map && map.owner && mode === 'edit' && map.owner.id !== id) { if (map && map.owner && mode === 'edit' && map.owner.id !== id) {
// pushPath(`/${map.random_url}/edit`);
return yield call(replaceAddressIfItsBusy, map.random_url, map.address); return yield call(replaceAddressIfItsBusy, map.random_url, map.address);
} }
} else if (mode === 'edit' && editor.owner.id !== id) { } else if (mode === 'edit' && editor.owner.id !== id) {
// pushPath(`/${random_url}/edit`);
return yield call(replaceAddressIfItsBusy, random_url, address); return yield call(replaceAddressIfItsBusy, random_url, address);
} else { } else {
yield put(setAddressOrigin('')); yield put(setAddressOrigin(''));
@ -553,9 +551,7 @@ function* setUserSaga() {
} }
function* setTitleSaga({ title }: ReturnType<typeof ActionCreators.setTitle>):SagaIterator { function* setTitleSaga({ title }: ReturnType<typeof ActionCreators.setTitle>):SagaIterator {
if (title) { if (title) { document.title = `${title} | Редактор маршрутов`; }
document.title = `${title} | Редактор маршрутов`;
}
} }
export function* userSaga() { export function* userSaga() {