Fix the journal action to be change when changing event.
parent
7e271b1542
commit
9521e3dae3
|
@ -30,7 +30,7 @@ class EventEdit extends React.Component {
|
|||
collections: Array<EteSync.CollectionInfo>,
|
||||
initialCollection?: string,
|
||||
event?: EventType,
|
||||
onSave: (event: EventType, journalUid: string) => void;
|
||||
onSave: (event: EventType, journalUid: string, originalEvent?: EventType) => void;
|
||||
};
|
||||
|
||||
constructor(props: any) {
|
||||
|
@ -108,7 +108,7 @@ class EventEdit extends React.Component {
|
|||
event.location = this.state.location;
|
||||
event.description = this.state.description;
|
||||
|
||||
this.props.onSave(event, this.state.journalUid);
|
||||
this.props.onSave(event, this.state.journalUid, this.props.event);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -40,7 +40,7 @@ class Pim extends React.Component {
|
|||
this.onEventSave = this.onEventSave.bind(this);
|
||||
}
|
||||
|
||||
onEventSave(event: EventType, journalUid: string) {
|
||||
onEventSave(event: EventType, journalUid: string, originalEvent?: EventType) {
|
||||
const journal = this.props.journals.find((x) => (x.uid === journalUid));
|
||||
|
||||
if (journal === undefined) {
|
||||
|
@ -53,7 +53,9 @@ class Pim extends React.Component {
|
|||
return;
|
||||
}
|
||||
|
||||
let saveEvent = store.dispatch(createJournalEntry(this.props.etesync, journal, entries.value, event.toIcal()));
|
||||
let action = (originalEvent === undefined) ? EteSync.SyncEntryAction.Add : EteSync.SyncEntryAction.Change;
|
||||
let saveEvent = store.dispatch(
|
||||
createJournalEntry(this.props.etesync, journal, entries.value, action, event.toIcal()));
|
||||
(saveEvent as any).then(() => {
|
||||
this.props.history.goBack();
|
||||
});
|
||||
|
|
|
@ -6,10 +6,11 @@ export function createJournalEntry(
|
|||
etesync: CredentialsData,
|
||||
journal: EteSync.Journal,
|
||||
existingEntries: Array<EteSync.Entry>,
|
||||
action: EteSync.SyncEntryAction,
|
||||
content: string) {
|
||||
|
||||
let syncEntry = new EteSync.SyncEntry();
|
||||
syncEntry.action = EteSync.SyncEntryAction.Add;
|
||||
syncEntry.action = action;
|
||||
|
||||
syncEntry.content = content;
|
||||
|
||||
|
|
Loading…
Reference in New Issue