mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 07:12:41 +01:00
Adding official Feed stories for Calendar event invite/uninvite actions
Summary: Closes T7988, Adding official Feed stories for Calendar event invite/uninvite actions. Test Plan: Invite/uninvite users to Calendar events, save, go to Feed, inspect stories. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7988 Differential Revision: https://secure.phabricator.com/D12629
This commit is contained in:
parent
69536ea3b9
commit
47f91c322d
1 changed files with 97 additions and 10 deletions
|
@ -138,6 +138,8 @@ final class PhabricatorCalendarEventTransaction
|
|||
$this->renderHandleLink($author_phid));
|
||||
}
|
||||
case self::TYPE_INVITE:
|
||||
$text = null;
|
||||
|
||||
if (count($old) === 1
|
||||
&& count($new) === 1
|
||||
&& isset($old[$author_phid])) {
|
||||
|
@ -176,7 +178,6 @@ final class PhabricatorCalendarEventTransaction
|
|||
$self_declined = null;
|
||||
$added = array();
|
||||
$uninvited = array();
|
||||
$text = null;
|
||||
|
||||
foreach ($new as $phid => $status) {
|
||||
if ($status == PhabricatorCalendarEventInvitee::STATUS_INVITED
|
||||
|
@ -197,19 +198,19 @@ final class PhabricatorCalendarEventTransaction
|
|||
|
||||
if ($count_added > 0 && $count_uninvited == 0) {
|
||||
$added_text = $this->renderHandleList($added);
|
||||
$text = pht('%s invited: %s.',
|
||||
$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',
|
||||
$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.',
|
||||
$text = pht('%s uninvited %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$uninvited_text);
|
||||
} else {
|
||||
|
@ -218,8 +219,7 @@ final class PhabricatorCalendarEventTransaction
|
|||
}
|
||||
}
|
||||
return $text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parent::getTitle();
|
||||
}
|
||||
|
||||
|
@ -299,10 +299,97 @@ final class PhabricatorCalendarEventTransaction
|
|||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
case self::TYPE_INVITE:
|
||||
return pht(
|
||||
'%s updated the invitee list of %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
$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;
|
||||
}
|
||||
|
||||
return parent::getTitleForFeed();
|
||||
|
|
Loading…
Reference in a new issue