mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 03:20:59 +01:00
e4c6ae5345
Summary: Ref T11809. - Allow users to remove the "Until" date from recurring events. - When removing "Until", show a sensible string ("...set this event to repeat forever.") - When users go through the "Make Recurring" workflow, don't require them to explicitly select "Recurring: Recurring" from the dropdown. This intent is clear from clicking "Make Recurring". - When editing "All Future Events", don't literally apply date changes to them, since that doesn't make sense. We update the template, then reschedule any events which haven't been edited already. I think this is what users probably mean if they make this edit. - When creating an event with a non-default icon, don't show "alice changed the icon from Default to Party.". - Hide the "recurring mode" transaction, which had no string ("alice edited this Event.") and was redundant anyway. - Also, add a little piece of developer text to make hunting these things down easier. Test Plan: Edited various events, parents, children, made events recur, set until, unset until, viewed transactions, rescheduled parents, rescheduled children. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11809 Differential Revision: https://secure.phabricator.com/D16796
67 lines
1.6 KiB
PHP
67 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCalendarEventUntilDateTransaction
|
|
extends PhabricatorCalendarEventDateTransaction {
|
|
|
|
const TRANSACTIONTYPE = 'calendar.recurrenceenddate';
|
|
|
|
public function generateOldValue($object) {
|
|
$editor = $this->getEditor();
|
|
|
|
$until = $object->newUntilDateTime();
|
|
if (!$until) {
|
|
return null;
|
|
}
|
|
|
|
return $until
|
|
->newAbsoluteDateTime()
|
|
->setIsAllDay($editor->getOldIsAllDay())
|
|
->toDictionary();
|
|
}
|
|
|
|
public function applyInternalEffects($object, $value) {
|
|
$actor = $this->getActor();
|
|
$editor = $this->getEditor();
|
|
|
|
if ($value) {
|
|
$datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($value);
|
|
$datetime->setIsAllDay($editor->getNewIsAllDay());
|
|
$object->setUntilDateTime($datetime);
|
|
} else {
|
|
$object->setUntilDateTime(null);
|
|
}
|
|
}
|
|
|
|
public function getTitle() {
|
|
if ($this->getNewValue()) {
|
|
return pht(
|
|
'%s changed this event to repeat until %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderNewDate());
|
|
} else {
|
|
return pht(
|
|
'%s changed this event to repeat forever.',
|
|
$this->renderAuthor());
|
|
}
|
|
}
|
|
|
|
public function getTitleForFeed() {
|
|
if ($this->getNewValue()) {
|
|
return pht(
|
|
'%s changed %s to repeat until %s.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject(),
|
|
$this->renderNewDate());
|
|
} else {
|
|
return pht(
|
|
'%s changed %s to repeat forever.',
|
|
$this->renderAuthor(),
|
|
$this->renderObject());
|
|
}
|
|
}
|
|
|
|
protected function getInvalidDateMessage() {
|
|
return pht('Repeat until date is invalid.');
|
|
}
|
|
|
|
}
|