2015-04-28 15:26:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorCalendarEventTransaction
|
|
|
|
extends PhabricatorApplicationTransaction {
|
|
|
|
|
2015-04-28 17:34:26 +02:00
|
|
|
const TYPE_NAME = 'calendar.name';
|
2015-04-28 15:26:48 +02:00
|
|
|
const TYPE_START_DATE = 'calendar.startdate';
|
|
|
|
const TYPE_END_DATE = 'calendar.enddate';
|
|
|
|
const TYPE_DESCRIPTION = 'calendar.description';
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
const TYPE_CANCEL = 'calendar.cancel';
|
2015-05-08 01:57:49 +02:00
|
|
|
const TYPE_ALL_DAY = 'calendar.allday';
|
2015-05-19 22:09:28 +02:00
|
|
|
const TYPE_ICON = 'calendar.icon';
|
2015-04-29 22:51:09 +02:00
|
|
|
const TYPE_INVITE = 'calendar.invite';
|
2015-04-28 15:26:48 +02:00
|
|
|
|
2015-05-01 22:26:07 +02:00
|
|
|
const MAILTAG_RESCHEDULE = 'calendar-reschedule';
|
2015-04-28 15:26:48 +02:00
|
|
|
const MAILTAG_CONTENT = 'calendar-content';
|
|
|
|
const MAILTAG_OTHER = 'calendar-other';
|
|
|
|
|
|
|
|
public function getApplicationName() {
|
|
|
|
return 'calendar';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionType() {
|
|
|
|
return PhabricatorCalendarEventPHIDType::TYPECONST;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionCommentObject() {
|
|
|
|
return new PhabricatorCalendarEventTransactionComment();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDs() {
|
|
|
|
$phids = parent::getRequiredHandlePHIDs();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
2015-04-28 17:34:26 +02:00
|
|
|
case self::TYPE_NAME:
|
2015-04-28 15:26:48 +02:00
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
case self::TYPE_END_DATE:
|
|
|
|
case self::TYPE_DESCRIPTION:
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
2015-05-08 01:57:49 +02:00
|
|
|
case self::TYPE_ALL_DAY:
|
2015-04-28 15:26:48 +02:00
|
|
|
$phids[] = $this->getObjectPHID();
|
|
|
|
break;
|
2015-04-30 20:21:41 +02:00
|
|
|
case self::TYPE_INVITE:
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
foreach ($new as $phid => $status) {
|
|
|
|
$phids[] = $phid;
|
|
|
|
}
|
|
|
|
break;
|
2015-04-28 15:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $phids;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldHide() {
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
case self::TYPE_END_DATE:
|
|
|
|
case self::TYPE_DESCRIPTION:
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
2015-05-08 01:57:49 +02:00
|
|
|
case self::TYPE_ALL_DAY:
|
2015-04-29 22:51:09 +02:00
|
|
|
case self::TYPE_INVITE:
|
2015-04-28 15:26:48 +02:00
|
|
|
return ($old === null);
|
|
|
|
}
|
|
|
|
return parent::shouldHide();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIcon() {
|
|
|
|
switch ($this->getTransactionType()) {
|
2015-05-19 22:09:28 +02:00
|
|
|
case self::TYPE_ICON:
|
|
|
|
return $this->getNewValue();
|
2015-04-28 17:34:26 +02:00
|
|
|
case self::TYPE_NAME:
|
2015-04-28 15:26:48 +02:00
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
case self::TYPE_END_DATE:
|
|
|
|
case self::TYPE_DESCRIPTION:
|
2015-05-08 01:57:49 +02:00
|
|
|
case self::TYPE_ALL_DAY:
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
2015-04-28 15:26:48 +02:00
|
|
|
return 'fa-pencil';
|
|
|
|
break;
|
2015-04-30 03:18:27 +02:00
|
|
|
case self::TYPE_INVITE:
|
|
|
|
return 'fa-user-plus';
|
|
|
|
break;
|
2015-04-28 15:26:48 +02:00
|
|
|
}
|
|
|
|
return parent::getIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
$author_phid = $this->getAuthorPHID();
|
|
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
$type = $this->getTransactionType();
|
|
|
|
switch ($type) {
|
2015-04-28 17:34:26 +02:00
|
|
|
case self::TYPE_NAME:
|
2015-04-28 17:56:00 +02:00
|
|
|
if ($old === null) {
|
|
|
|
return pht(
|
|
|
|
'%s created this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
} else {
|
2015-04-28 17:34:26 +02:00
|
|
|
return pht(
|
|
|
|
'%s changed the name of this event from %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$old,
|
|
|
|
$new);
|
|
|
|
}
|
2015-04-28 15:26:48 +02:00
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
if ($old) {
|
|
|
|
return pht(
|
|
|
|
'%s edited the start date of this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case self::TYPE_END_DATE:
|
|
|
|
if ($old) {
|
|
|
|
return pht(
|
|
|
|
'%s edited the end date of this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return pht(
|
|
|
|
"%s updated the event's description.",
|
|
|
|
$this->renderHandleLink($author_phid));
|
2015-05-08 06:16:30 +02:00
|
|
|
case self::TYPE_ALL_DAY:
|
|
|
|
if ($new) {
|
|
|
|
return pht(
|
|
|
|
'%s made this an all day event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s converted this from an all day event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
2015-05-19 22:09:28 +02:00
|
|
|
case self::TYPE_ICON:
|
|
|
|
return pht(
|
|
|
|
'%s set this event\'s icon to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
PhabricatorCalendarIcon::getLabel($new));
|
|
|
|
break;
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
|
|
|
if ($new) {
|
|
|
|
return pht(
|
|
|
|
'%s cancelled this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s reinstated this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
2015-04-29 22:51:09 +02:00
|
|
|
case self::TYPE_INVITE:
|
2015-04-30 21:34:20 +02:00
|
|
|
$text = null;
|
|
|
|
|
2015-04-30 20:21:41 +02:00
|
|
|
if (count($old) === 1
|
|
|
|
&& count($new) === 1
|
|
|
|
&& isset($old[$author_phid])) {
|
|
|
|
// user joined/declined/accepted event themself
|
|
|
|
$old_status = $old[$author_phid];
|
|
|
|
$new_status = $new[$author_phid];
|
2015-04-28 15:26:48 +02:00
|
|
|
|
2015-04-30 20:21:41 +02:00
|
|
|
if ($old_status !== $new_status) {
|
|
|
|
switch ($new_status) {
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_INVITED:
|
|
|
|
$text = pht(
|
|
|
|
'%s has joined this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
break;
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_ATTENDING:
|
|
|
|
$text = pht(
|
|
|
|
'%s is attending this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
break;
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_DECLINED:
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_UNINVITED:
|
|
|
|
$text = pht(
|
|
|
|
'%s has declined this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$text = pht(
|
|
|
|
'%s has changed their status for this event.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// user changed status for many users
|
|
|
|
$self_joined = null;
|
|
|
|
$self_declined = null;
|
|
|
|
$added = array();
|
|
|
|
$uninvited = array();
|
|
|
|
|
|
|
|
foreach ($new as $phid => $status) {
|
|
|
|
if ($status == PhabricatorCalendarEventInvitee::STATUS_INVITED
|
|
|
|
|| $status == PhabricatorCalendarEventInvitee::STATUS_ATTENDING) {
|
|
|
|
// added users
|
|
|
|
$added[] = $phid;
|
|
|
|
} else if (
|
|
|
|
$status == PhabricatorCalendarEventInvitee::STATUS_DECLINED
|
|
|
|
|| $status == PhabricatorCalendarEventInvitee::STATUS_UNINVITED) {
|
|
|
|
$uninvited[] = $phid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$count_added = count($added);
|
|
|
|
$count_uninvited = count($uninvited);
|
|
|
|
$added_text = null;
|
|
|
|
$uninvited_text = null;
|
|
|
|
|
|
|
|
if ($count_added > 0 && $count_uninvited == 0) {
|
|
|
|
$added_text = $this->renderHandleList($added);
|
2015-04-30 21:34:20 +02:00
|
|
|
$text = pht('%s invited %s.',
|
2015-04-30 20:21:41 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$added_text);
|
|
|
|
} else if ($count_added > 0 && $count_uninvited > 0) {
|
|
|
|
$added_text = $this->renderHandleList($added);
|
|
|
|
$uninvited_text = $this->renderHandleList($uninvited);
|
2015-04-30 21:34:20 +02:00
|
|
|
$text = pht('%s invited %s and uninvited: %s',
|
2015-04-30 20:21:41 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$added_text,
|
|
|
|
$uninvited_text);
|
|
|
|
} else if ($count_added == 0 && $count_uninvited > 0) {
|
|
|
|
$uninvited_text = $this->renderHandleList($uninvited);
|
2015-04-30 21:34:20 +02:00
|
|
|
$text = pht('%s uninvited %s.',
|
2015-04-30 20:21:41 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$uninvited_text);
|
|
|
|
} else {
|
|
|
|
$text = pht('%s updated the invitee list.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $text;
|
2015-04-30 21:34:20 +02:00
|
|
|
}
|
2015-04-28 15:26:48 +02:00
|
|
|
return parent::getTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitleForFeed() {
|
|
|
|
$author_phid = $this->getAuthorPHID();
|
|
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
2015-04-28 21:01:59 +02:00
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
2015-04-28 15:26:48 +02:00
|
|
|
$type = $this->getTransactionType();
|
|
|
|
switch ($type) {
|
2015-04-28 17:34:26 +02:00
|
|
|
case self::TYPE_NAME:
|
2015-04-28 21:01:59 +02:00
|
|
|
if ($old === null) {
|
|
|
|
return pht(
|
|
|
|
'%s created %s',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else {
|
2015-04-28 17:34:26 +02:00
|
|
|
return pht(
|
|
|
|
'%s changed the name of %s from %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
$old,
|
|
|
|
$new);
|
|
|
|
}
|
2015-04-28 15:26:48 +02:00
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
if ($old) {
|
2015-04-28 21:01:59 +02:00
|
|
|
$old = phabricator_datetime($old, $viewer);
|
|
|
|
$new = phabricator_datetime($new, $viewer);
|
2015-04-28 15:26:48 +02:00
|
|
|
return pht(
|
2015-04-28 21:01:59 +02:00
|
|
|
'%s changed the start date of %s from %s to %s.',
|
2015-04-28 15:26:48 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-04-28 21:01:59 +02:00
|
|
|
$this->renderHandleLink($object_phid),
|
2015-04-28 15:26:48 +02:00
|
|
|
$old,
|
|
|
|
$new);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case self::TYPE_END_DATE:
|
|
|
|
if ($old) {
|
2015-04-28 21:01:59 +02:00
|
|
|
$old = phabricator_datetime($old, $viewer);
|
|
|
|
$new = phabricator_datetime($new, $viewer);
|
2015-04-28 15:26:48 +02:00
|
|
|
return pht(
|
2015-04-28 21:01:59 +02:00
|
|
|
'%s edited the end date of %s from %s to %s.',
|
2015-04-28 15:26:48 +02:00
|
|
|
$this->renderHandleLink($author_phid),
|
2015-04-28 21:01:59 +02:00
|
|
|
$this->renderHandleLink($object_phid),
|
2015-04-28 15:26:48 +02:00
|
|
|
$old,
|
|
|
|
$new);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return pht(
|
2015-04-28 21:01:59 +02:00
|
|
|
'%s updated the description of %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
2015-05-08 06:16:30 +02:00
|
|
|
case self::TYPE_ALL_DAY:
|
|
|
|
if ($new) {
|
|
|
|
return pht(
|
|
|
|
'%s made %s an all day event.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s converted %s from an all day event.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
}
|
2015-05-19 22:09:28 +02:00
|
|
|
case self::TYPE_ICON:
|
|
|
|
return pht(
|
|
|
|
'%s set the icon for %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid),
|
|
|
|
PhabricatorCalendarIcon::getLabel($new));
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
|
|
|
if ($new) {
|
|
|
|
return pht(
|
|
|
|
'%s cancelled %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else {
|
|
|
|
return pht(
|
|
|
|
'%s reinstated %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
}
|
2015-04-29 22:51:09 +02:00
|
|
|
case self::TYPE_INVITE:
|
2015-04-30 21:34:20 +02:00
|
|
|
$text = null;
|
|
|
|
|
|
|
|
if (count($old) === 1
|
|
|
|
&& count($new) === 1
|
|
|
|
&& isset($old[$author_phid])) {
|
|
|
|
// user joined/declined/accepted event themself
|
|
|
|
$old_status = $old[$author_phid];
|
|
|
|
$new_status = $new[$author_phid];
|
|
|
|
|
|
|
|
if ($old_status !== $new_status) {
|
|
|
|
switch ($new_status) {
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_INVITED:
|
|
|
|
$text = pht(
|
|
|
|
'%s has joined %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
break;
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_ATTENDING:
|
|
|
|
$text = pht(
|
|
|
|
'%s is attending %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
break;
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_DECLINED:
|
|
|
|
case PhabricatorCalendarEventInvitee::STATUS_UNINVITED:
|
|
|
|
$text = pht(
|
|
|
|
'%s has declined %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$text = pht(
|
|
|
|
'%s has changed their status of %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// user changed status for many users
|
|
|
|
$self_joined = null;
|
|
|
|
$self_declined = null;
|
|
|
|
$added = array();
|
|
|
|
$uninvited = array();
|
|
|
|
|
|
|
|
// $event = $this->renderHandleLink($object_phid);
|
|
|
|
|
|
|
|
foreach ($new as $phid => $status) {
|
|
|
|
if ($status == PhabricatorCalendarEventInvitee::STATUS_INVITED
|
|
|
|
|| $status == PhabricatorCalendarEventInvitee::STATUS_ATTENDING) {
|
|
|
|
// added users
|
|
|
|
$added[] = $phid;
|
|
|
|
} else if (
|
|
|
|
$status == PhabricatorCalendarEventInvitee::STATUS_DECLINED
|
|
|
|
|| $status == PhabricatorCalendarEventInvitee::STATUS_UNINVITED) {
|
|
|
|
$uninvited[] = $phid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$count_added = count($added);
|
|
|
|
$count_uninvited = count($uninvited);
|
|
|
|
$added_text = null;
|
|
|
|
$uninvited_text = null;
|
|
|
|
|
|
|
|
if ($count_added > 0 && $count_uninvited == 0) {
|
|
|
|
$added_text = $this->renderHandleList($added);
|
|
|
|
$text = pht('%s invited %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$added_text,
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else if ($count_added > 0 && $count_uninvited > 0) {
|
|
|
|
$added_text = $this->renderHandleList($added);
|
|
|
|
$uninvited_text = $this->renderHandleList($uninvited);
|
|
|
|
$text = pht('%s invited %s and uninvited %s to %s',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$added_text,
|
|
|
|
$uninvited_text,
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else if ($count_added == 0 && $count_uninvited > 0) {
|
|
|
|
$uninvited_text = $this->renderHandleList($uninvited);
|
|
|
|
$text = pht('%s uninvited %s to %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$uninvited_text,
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
} else {
|
|
|
|
$text = pht('%s updated the invitee list of %s.',
|
|
|
|
$this->renderHandleLink($author_phid),
|
|
|
|
$this->renderHandleLink($object_phid));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $text;
|
2015-04-28 15:26:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getTitleForFeed();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getColor() {
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
2015-04-28 17:34:26 +02:00
|
|
|
case self::TYPE_NAME:
|
2015-04-28 15:26:48 +02:00
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
case self::TYPE_END_DATE:
|
|
|
|
case self::TYPE_DESCRIPTION:
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
2015-04-29 22:51:09 +02:00
|
|
|
case self::TYPE_INVITE:
|
2015-04-28 15:26:48 +02:00
|
|
|
return PhabricatorTransactions::COLOR_GREEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function hasChangeDetails() {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
return ($this->getOldValue() !== null);
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::hasChangeDetails();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderChangeDetails(PhabricatorUser $viewer) {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_DESCRIPTION:
|
|
|
|
$old = $this->getOldValue();
|
|
|
|
$new = $this->getNewValue();
|
|
|
|
|
|
|
|
return $this->renderTextCorpusChangeDetails(
|
|
|
|
$viewer,
|
|
|
|
$old,
|
|
|
|
$new);
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::renderChangeDetails($viewer);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMailTags() {
|
|
|
|
$tags = array();
|
|
|
|
switch ($this->getTransactionType()) {
|
2015-04-28 17:34:26 +02:00
|
|
|
case self::TYPE_NAME:
|
2015-04-28 15:26:48 +02:00
|
|
|
case self::TYPE_DESCRIPTION:
|
2015-05-01 22:26:07 +02:00
|
|
|
case self::TYPE_INVITE:
|
2015-05-19 22:09:28 +02:00
|
|
|
case self::TYPE_ICON:
|
2015-04-28 15:26:48 +02:00
|
|
|
$tags[] = self::MAILTAG_CONTENT;
|
|
|
|
break;
|
2015-05-01 22:26:07 +02:00
|
|
|
case self::TYPE_START_DATE:
|
|
|
|
case self::TYPE_END_DATE:
|
Canceling calendar events should deactivate the event
Summary: Closes T7943, Canceling calendar event should deactivate the event instead of destroying data.
Test Plan: Create an event, cancel it, see changed status icon, query for active events, event should not appear, query for deactivated events, event should appear in results.
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T7943
Differential Revision: https://secure.phabricator.com/D12604
2015-04-29 17:39:39 +02:00
|
|
|
case self::TYPE_CANCEL:
|
2015-05-01 22:26:07 +02:00
|
|
|
$tags[] = self::MAILTAG_RESCHEDULE;
|
2015-04-29 22:51:09 +02:00
|
|
|
break;
|
2015-04-28 15:26:48 +02:00
|
|
|
}
|
|
|
|
return $tags;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|