Tasks: renames some vars from event to task

I assume this is just some cruft from a bad copy-paste
master
Andrew P Maney 5 years ago committed by Tom Hacohen
parent 69c38d7e8f
commit f04212a1e6

@ -89,22 +89,22 @@ class TaskEdit extends React.PureComponent<PropsType> {
}; };
if (this.props.item !== undefined) { if (this.props.item !== undefined) {
const event = this.props.item; const task = this.props.item;
this.state.uid = event.uid; this.state.uid = task.uid;
this.state.title = event.title ? event.title : ''; this.state.title = task.title ? task.title : '';
this.state.status = event.status ?? TaskStatusType.NeedsAction; this.state.status = task.status ?? TaskStatusType.NeedsAction;
this.state.priority = event.priority ?? TaskPriorityType.Undefined; this.state.priority = task.priority ?? TaskPriorityType.Undefined;
if (event.startDate) { if (task.startDate) {
this.state.allDay = event.startDate.isDate; this.state.allDay = task.startDate.isDate;
this.state.start = event.startDate.convertToZone(ICAL.Timezone.localTimezone).toJSDate(); this.state.start = task.startDate.convertToZone(ICAL.Timezone.localTimezone).toJSDate();
} }
if (event.dueDate) { if (task.dueDate) {
this.state.due = event.dueDate.convertToZone(ICAL.Timezone.localTimezone).toJSDate(); this.state.due = task.dueDate.convertToZone(ICAL.Timezone.localTimezone).toJSDate();
} }
this.state.location = event.location ? event.location : ''; this.state.location = task.location ? task.location : '';
this.state.description = event.description ? event.description : ''; this.state.description = task.description ? task.description : '';
this.state.timezone = event.timezone; this.state.timezone = task.timezone;
} else { } else {
this.state.uid = uuid.v4(); this.state.uid = uuid.v4();
} }
@ -183,40 +183,40 @@ class TaskEdit extends React.PureComponent<PropsType> {
} }
} }
const event = (this.props.item) ? const task = (this.props.item) ?
this.props.item.clone() this.props.item.clone()
: :
new TaskType(null) new TaskType(null)
; ;
event.uid = this.state.uid; task.uid = this.state.uid;
event.summary = this.state.title; task.summary = this.state.title;
event.status = this.state.status; task.status = this.state.status;
event.priority = this.state.priority; task.priority = this.state.priority;
if (startDate) { if (startDate) {
event.startDate = startDate; task.startDate = startDate;
} }
event.dueDate = dueDate; task.dueDate = dueDate;
event.location = this.state.location; task.location = this.state.location;
event.description = this.state.description; task.description = this.state.description;
if (this.state.timezone) { if (this.state.timezone) {
const timezone = timezoneLoadFromName(this.state.timezone); const timezone = timezoneLoadFromName(this.state.timezone);
if (timezone) { if (timezone) {
if (event.startDate) { if (task.startDate) {
event.startDate = event.startDate.convertToZone(timezone); task.startDate = task.startDate.convertToZone(timezone);
} }
if (event.dueDate) { if (task.dueDate) {
event.dueDate = event.dueDate.convertToZone(timezone); task.dueDate = task.dueDate.convertToZone(timezone);
} }
if (event.completionDate) { if (task.completionDate) {
event.completionDate = event.completionDate.convertToZone(timezone); task.completionDate = task.completionDate.convertToZone(timezone);
} }
} }
} }
event.component.updatePropertyWithValue('last-modified', ICAL.Time.now()); task.component.updatePropertyWithValue('last-modified', ICAL.Time.now());
this.props.onSave(event, this.state.journalUid, this.props.item) this.props.onSave(task, this.state.journalUid, this.props.item)
.then(() => { .then(() => {
this.props.history.goBack(); this.props.history.goBack();
}); });
@ -255,7 +255,7 @@ class TaskEdit extends React.PureComponent<PropsType> {
{recurring && ( {recurring && (
<div> <div>
<span style={{ color: 'red' }}>IMPORTANT: </span> <span style={{ color: 'red' }}>IMPORTANT: </span>
This is a recurring event, for now, only editing the whole series This is a recurring task, for now, only editing the whole series
(by editing the first instance) is supported. (by editing the first instance) is supported.
</div> </div>
)} )}
@ -423,7 +423,7 @@ class TaskEdit extends React.PureComponent<PropsType> {
onOk={() => this.props.onDelete(this.props.item!, this.props.initialCollection!)} onOk={() => this.props.onDelete(this.props.item!, this.props.initialCollection!)}
onCancel={() => this.setState({ showDeleteDialog: false })} onCancel={() => this.setState({ showDeleteDialog: false })}
> >
Are you sure you would like to delete this event? Are you sure you would like to delete this task?
</ConfirmationDialog> </ConfirmationDialog>
</React.Fragment> </React.Fragment>
); );

Loading…
Cancel
Save