mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-08 21:08:29 +01:00
Build separate comments for each inline comment in Audit
Summary: Ref T4896. Moves us closer to migrating comments to transactions by building a transaction per inline. This makes the UI a little wonky, and it will get slightly worse until we swap to the new UI and grouping/collapsing starts working. It's still usable, there's just a box per inline. Test Plan: - Added a comment. - Added an inline comment. - Added a comment and an inline comment. Reviewers: btrahan, joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Maniphest Tasks: T4896 Differential Revision: https://secure.phabricator.com/D10023
This commit is contained in:
parent
4c767c2803
commit
bf39748011
2 changed files with 22 additions and 8 deletions
|
@ -9,6 +9,7 @@ final class PhabricatorAuditActionConstants {
|
||||||
const CLOSE = 'close';
|
const CLOSE = 'close';
|
||||||
const ADD_CCS = 'add_ccs';
|
const ADD_CCS = 'add_ccs';
|
||||||
const ADD_AUDITORS = 'add_auditors';
|
const ADD_AUDITORS = 'add_auditors';
|
||||||
|
const INLINE = 'audit:inline';
|
||||||
|
|
||||||
public static function getActionNameMap() {
|
public static function getActionNameMap() {
|
||||||
$map = array(
|
$map = array(
|
||||||
|
|
|
@ -57,13 +57,8 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$content_blocks = array($comment->getContent());
|
$content_blocks = array($comment->getContent());
|
||||||
|
foreach ($inline_comments as $inline) {
|
||||||
if ($inline_comments) {
|
$content_blocks[] = $inline->getContent();
|
||||||
foreach ($inline_comments as $inline) {
|
|
||||||
$inline->setAuditCommentID($comment->getID());
|
|
||||||
$inline->save();
|
|
||||||
$content_blocks[] = $inline->getContent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ccs = $this->ccs;
|
$ccs = $this->ccs;
|
||||||
|
@ -280,6 +275,20 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
$commit->updateAuditStatus($requests);
|
$commit->updateAuditStatus($requests);
|
||||||
$commit->save();
|
$commit->save();
|
||||||
|
|
||||||
|
$comments = array($comment);
|
||||||
|
foreach ($inline_comments as $inline) {
|
||||||
|
$xaction = id(new PhabricatorAuditComment())
|
||||||
|
->setAction(PhabricatorAuditActionConstants::INLINE)
|
||||||
|
->setActorPHID($actor->getPHID())
|
||||||
|
->setTargetPHID($commit->getPHID())
|
||||||
|
->save();
|
||||||
|
|
||||||
|
$inline->setAuditCommentID($xaction->getID());
|
||||||
|
$inline->save();
|
||||||
|
|
||||||
|
$comments[] = $xaction;
|
||||||
|
}
|
||||||
|
|
||||||
$feed_dont_publish_phids = array();
|
$feed_dont_publish_phids = array();
|
||||||
foreach ($requests as $request) {
|
foreach ($requests as $request) {
|
||||||
$status = $request->getAuditStatus();
|
$status = $request->getAuditStatus();
|
||||||
|
@ -305,7 +314,7 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
|
|
||||||
if (!$this->noEmail) {
|
if (!$this->noEmail) {
|
||||||
$this->sendMail(
|
$this->sendMail(
|
||||||
array($comment),
|
$comments,
|
||||||
$other_comments,
|
$other_comments,
|
||||||
$inline_comments,
|
$inline_comments,
|
||||||
$requests);
|
$requests);
|
||||||
|
@ -530,6 +539,10 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
|
||||||
|
|
||||||
$body = new PhabricatorMetaMTAMailBody();
|
$body = new PhabricatorMetaMTAMailBody();
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
|
if ($comment->getAction() == PhabricatorAuditActionConstants::INLINE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$verb = PhabricatorAuditActionConstants::getActionPastTenseVerb(
|
$verb = PhabricatorAuditActionConstants::getActionPastTenseVerb(
|
||||||
$comment->getAction());
|
$comment->getAction());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue