mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Add basic feed stories for Conpherence
Summary: [Draft] Posting this up because feed is pulling `getTitle` and not `getTitleForFeed` and I'm super confused. Restarted phd and apache. Test Plan: Create a new room, see link in feed. Change topic, see story, add people, don't see story. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11645 Differential Revision: https://secure.phabricator.com/D16561
This commit is contained in:
parent
7f6fa28363
commit
1ea6fe9387
3 changed files with 64 additions and 4 deletions
|
@ -16,16 +16,16 @@ final class ConpherenceNewRoomController extends ConpherenceController {
|
|||
$editor = new ConpherenceEditor();
|
||||
$xactions = array();
|
||||
|
||||
$xactions[] = id(new ConpherenceTransaction())
|
||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
||||
->setNewValue($request->getStr('title'));
|
||||
|
||||
$participants = $request->getArr('participants');
|
||||
$participants[] = $user->getPHID();
|
||||
$participants = array_unique($participants);
|
||||
$xactions[] = id(new ConpherenceTransaction())
|
||||
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
|
||||
->setNewValue(array('+' => $participants));
|
||||
|
||||
$xactions[] = id(new ConpherenceTransaction())
|
||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
||||
->setNewValue($request->getStr('title'));
|
||||
$xactions[] = id(new ConpherenceTransaction())
|
||||
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
|
||||
->setNewValue($request->getStr('topic'));
|
||||
|
|
|
@ -623,6 +623,17 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
|||
protected function shouldPublishFeedStory(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
foreach ($xactions as $xaction) {
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case ConpherenceTransaction::TYPE_TITLE:
|
||||
case ConpherenceTransaction::TYPE_TOPIC:
|
||||
case ConpherenceTransaction::TYPE_PICTURE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,55 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
|||
return parent::getTitle();
|
||||
}
|
||||
|
||||
public function getTitleForFeed() {
|
||||
$author_phid = $this->getAuthorPHID();
|
||||
$object_phid = $this->getObjectPHID();
|
||||
|
||||
$old = $this->getOldValue();
|
||||
$new = $this->getNewValue();
|
||||
|
||||
$type = $this->getTransactionType();
|
||||
switch ($type) {
|
||||
case self::TYPE_TITLE:
|
||||
if (strlen($old) && strlen($new)) {
|
||||
return pht(
|
||||
'%s renamed %s from "%s" to "%s".',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid),
|
||||
$old,
|
||||
$new);
|
||||
} else {
|
||||
return pht(
|
||||
'%s created the room %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case self::TYPE_TOPIC:
|
||||
if (strlen($new)) {
|
||||
return pht(
|
||||
'%s set the topic of %s to "%s".',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid),
|
||||
$new);
|
||||
} else if (strlen($old)) {
|
||||
return pht(
|
||||
'%s deleted the topic in %s',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_PICTURE:
|
||||
return pht(
|
||||
'%s updated the room image for %s.',
|
||||
$this->renderHandleLink($author_phid),
|
||||
$this->renderHandleLink($object_phid));
|
||||
break;
|
||||
}
|
||||
return parent::getTitleForFeed();
|
||||
}
|
||||
|
||||
private function getRoomTitle() {
|
||||
$author_phid = $this->getAuthorPHID();
|
||||
|
||||
|
|
Loading…
Reference in a new issue