Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/storage/PhabricatorProjectTransaction.php
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
} | } | ||||
case PhabricatorProjectTransaction::TYPE_SLUGS: | case PhabricatorProjectTransaction::TYPE_SLUGS: | ||||
$add = array_diff($new, $old); | $add = array_diff($new, $old); | ||||
$rem = array_diff($old, $new); | $rem = array_diff($old, $new); | ||||
if ($add && $rem) { | if ($add && $rem) { | ||||
return pht( | return pht( | ||||
'%s changed project hashtag(s), added %d: %s; removed %d: %s', | '%s changed project hashtag(s), added %d: %s; removed %d: %s.', | ||||
$author_handle, | $author_handle, | ||||
count($add), | count($add), | ||||
$this->renderSlugList($add), | $this->renderSlugList($add), | ||||
count($rem), | count($rem), | ||||
$this->renderSlugList($rem)); | $this->renderSlugList($rem)); | ||||
} else if ($add) { | } else if ($add) { | ||||
return pht( | return pht( | ||||
'%s added %d project hashtag(s): %s', | '%s added %d project hashtag(s): %s.', | ||||
$author_handle, | $author_handle, | ||||
count($add), | count($add), | ||||
$this->renderSlugList($add)); | $this->renderSlugList($add)); | ||||
} else if ($rem) { | } else if ($rem) { | ||||
return pht( | return pht( | ||||
'%s removed %d project hashtag(s): %s', | '%s removed %d project hashtag(s): %s.', | ||||
$author_handle, | $author_handle, | ||||
count($rem), | count($rem), | ||||
$this->renderSlugList($rem)); | $this->renderSlugList($rem)); | ||||
} | } | ||||
case PhabricatorProjectTransaction::TYPE_MEMBERS: | case PhabricatorProjectTransaction::TYPE_MEMBERS: | ||||
$add = array_diff($new, $old); | $add = array_diff($new, $old); | ||||
$rem = array_diff($old, $new); | $rem = array_diff($old, $new); | ||||
if ($add && $rem) { | if ($add && $rem) { | ||||
return pht( | return pht( | ||||
'%s changed project member(s), added %d: %s; removed %d: %s', | '%s changed project member(s), added %d: %s; removed %d: %s.', | ||||
$author_handle, | $author_handle, | ||||
count($add), | count($add), | ||||
$this->renderHandleList($add), | $this->renderHandleList($add), | ||||
count($rem), | count($rem), | ||||
$this->renderHandleList($rem)); | $this->renderHandleList($rem)); | ||||
} else if ($add) { | } else if ($add) { | ||||
if (count($add) == 1 && (head($add) == $this->getAuthorPHID())) { | if (count($add) == 1 && (head($add) == $this->getAuthorPHID())) { | ||||
return pht( | return pht( | ||||
'%s joined this project.', | '%s joined this project.', | ||||
$author_handle); | $author_handle); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s added %d project member(s): %s', | '%s added %d project member(s): %s.', | ||||
$author_handle, | $author_handle, | ||||
count($add), | count($add), | ||||
$this->renderHandleList($add)); | $this->renderHandleList($add)); | ||||
} | } | ||||
} else if ($rem) { | } else if ($rem) { | ||||
if (count($rem) == 1 && (head($rem) == $this->getAuthorPHID())) { | if (count($rem) == 1 && (head($rem) == $this->getAuthorPHID())) { | ||||
return pht( | return pht( | ||||
'%s left this project.', | '%s left this project.', | ||||
$author_handle); | $author_handle); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s removed %d project member(s): %s', | '%s removed %d project member(s): %s.', | ||||
$author_handle, | $author_handle, | ||||
count($rem), | count($rem), | ||||
$this->renderHandleList($rem)); | $this->renderHandleList($rem)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return parent::getTitle(); | return parent::getTitle(); | ||||
} | } | ||||
private function renderSlugList($slugs) { | private function renderSlugList($slugs) { | ||||
return implode(', ', $slugs); | return implode(', ', $slugs); | ||||
} | } | ||||
} | } |