mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Prevent typos in feed publishing
Summary: See D3789. Moving away from constants means less safety; provide a runtime check at least. Test Plan: Took some actions which caused feed stories to publish, verified they showed up. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D3792
This commit is contained in:
parent
90ccfe4da1
commit
31ac1cbf6e
1 changed files with 16 additions and 1 deletions
|
@ -61,10 +61,25 @@ final class PhabricatorFeedStoryPublisher {
|
|||
}
|
||||
|
||||
public function publish() {
|
||||
if (!$this->storyType) {
|
||||
$class = $this->storyType;
|
||||
if (!$class) {
|
||||
throw new Exception("Call setStoryType() before publishing!");
|
||||
}
|
||||
|
||||
if (!class_exists($class)) {
|
||||
throw new Exception(
|
||||
"Story type must be a valid class name and must subclass ".
|
||||
"PhabricatorFeedStory. ".
|
||||
"'{$class}' is not a loadable class.");
|
||||
}
|
||||
|
||||
if (!is_subclass_of($class, 'PhabricatorFeedStory')) {
|
||||
throw new Exception(
|
||||
"Story type must be a valid class name and must subclass ".
|
||||
"PhabricatorFeedStory. ".
|
||||
"'{$class}' is not a subclass of PhabricatorFeedStory.");
|
||||
}
|
||||
|
||||
$chrono_key = $this->generateChronologicalKey();
|
||||
|
||||
$story = new PhabricatorFeedStoryData();
|
||||
|
|
Loading…
Reference in a new issue