Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14383764
D12625.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D12625.diff
View Options
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
@@ -36,9 +36,14 @@
case self::TYPE_STATUS:
case self::TYPE_DESCRIPTION:
case self::TYPE_CANCEL:
- case self::TYPE_INVITE:
$phids[] = $this->getObjectPHID();
break;
+ case self::TYPE_INVITE:
+ $new = $this->getNewValue();
+ foreach ($new as $phid => $status) {
+ $phids[] = $phid;
+ }
+ break;
}
return $phids;
@@ -96,7 +101,6 @@
$old,
$new);
}
- break;
case self::TYPE_START_DATE:
if ($old) {
return pht(
@@ -119,31 +123,103 @@
$this->renderHandleLink($author_phid),
$old_name,
$new_name);
- break;
case self::TYPE_DESCRIPTION:
return pht(
"%s updated the event's description.",
$this->renderHandleLink($author_phid));
- break;
case self::TYPE_CANCEL:
if ($new) {
return pht(
'%s cancelled this event.',
$this->renderHandleLink($author_phid));
- break;
} else {
return pht(
'%s reinstated this event.',
$this->renderHandleLink($author_phid));
- break;
}
case self::TYPE_INVITE:
- return pht(
- "%s updated the event's invitee list.",
- $this->renderHandleLink($author_phid));
- break;
- }
+ 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 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();
+ $text = null;
+ 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.',
+ $this->renderHandleLink($author_phid),
+ $added_text);
+ } 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',
+ $this->renderHandleLink($author_phid),
+ $added_text,
+ $uninvited_text);
+ } else if ($count_added == 0 && $count_uninvited > 0) {
+ $uninvited_text = $this->renderHandleList($uninvited);
+ $text = pht('%s uninvited: %s.',
+ $this->renderHandleLink($author_phid),
+ $uninvited_text);
+ } else {
+ $text = pht('%s updated the invitee list.',
+ $this->renderHandleLink($author_phid));
+ }
+ }
+ return $text;
+ break;
+ }
return parent::getTitle();
}
@@ -172,7 +248,6 @@
$old,
$new);
}
- break;
case self::TYPE_START_DATE:
if ($old) {
$old = phabricator_datetime($old, $viewer);
@@ -206,33 +281,28 @@
$this->renderHandleLink($object_phid),
$old_name,
$new_name);
- break;
case self::TYPE_DESCRIPTION:
return pht(
'%s updated the description of %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
- break;
case self::TYPE_CANCEL:
if ($new) {
return pht(
'%s cancelled %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
- break;
} else {
return pht(
'%s reinstated %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
- break;
}
case self::TYPE_INVITE:
return pht(
'%s updated the invitee list of %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
- break;
}
return parent::getTitleForFeed();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 8:18 AM (20 h, 55 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6917925
Default Alt Text
D12625.diff (6 KB)
Attached To
Mode
D12625: Calendar event timeline feed should reflect invite changes better
Attached
Detach File
Event Timeline
Log In to Comment