mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Minor, allow feed stories to publish with no related PHIDs (commits, future notifications).
This commit is contained in:
parent
111ecabc5f
commit
b3900a399c
1 changed files with 16 additions and 18 deletions
|
@ -61,10 +61,6 @@ final class PhabricatorFeedStoryPublisher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function publish() {
|
public function publish() {
|
||||||
if (!$this->relatedPHIDs) {
|
|
||||||
throw new Exception("There are no PHIDs related to this story!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->storyType) {
|
if (!$this->storyType) {
|
||||||
throw new Exception("Call setStoryType() before publishing!");
|
throw new Exception("Call setStoryType() before publishing!");
|
||||||
}
|
}
|
||||||
|
@ -78,24 +74,26 @@ final class PhabricatorFeedStoryPublisher {
|
||||||
$story->setChronologicalKey($chrono_key);
|
$story->setChronologicalKey($chrono_key);
|
||||||
$story->save();
|
$story->save();
|
||||||
|
|
||||||
$ref = new PhabricatorFeedStoryReference();
|
if ($this->relatedPHIDs) {
|
||||||
|
$ref = new PhabricatorFeedStoryReference();
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
$conn = $ref->establishConnection('w');
|
$conn = $ref->establishConnection('w');
|
||||||
foreach (array_unique($this->relatedPHIDs) as $phid) {
|
foreach (array_unique($this->relatedPHIDs) as $phid) {
|
||||||
$sql[] = qsprintf(
|
$sql[] = qsprintf(
|
||||||
|
$conn,
|
||||||
|
'(%s, %s)',
|
||||||
|
$phid,
|
||||||
|
$chrono_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
queryfx(
|
||||||
$conn,
|
$conn,
|
||||||
'(%s, %s)',
|
'INSERT INTO %T (objectPHID, chronologicalKey) VALUES %Q',
|
||||||
$phid,
|
$ref->getTableName(),
|
||||||
$chrono_key);
|
implode(', ', $sql));
|
||||||
}
|
}
|
||||||
|
|
||||||
queryfx(
|
|
||||||
$conn,
|
|
||||||
'INSERT INTO %T (objectPHID, chronologicalKey) VALUES %Q',
|
|
||||||
$ref->getTableName(),
|
|
||||||
implode(', ', $sql));
|
|
||||||
|
|
||||||
if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
|
if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
|
||||||
$this->insertNotifications($chrono_key);
|
$this->insertNotifications($chrono_key);
|
||||||
$this->sendNotification($chrono_key);
|
$this->sendNotification($chrono_key);
|
||||||
|
|
Loading…
Reference in a new issue