1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 18:52:42 +01:00
phorge-phorge/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
epriestley 2972894a4d Write "hasReplies" to database for inline comments
Summary:
Ref T1460. Ref T2618.

When publishing a draft inline, mark the inline it replies to (if any) as replied to.

Also, don't load deleted comments as drafts (sets the stage for T2618).

I'll make an effort to clean up the loading mess here in the next revision, and find some more appropriate home for the shared code.

Test Plan: Made and replied to comments in Differential and Diffusion. Saw comments get marked as "Has Replies" and "Is Reply".

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2618, T1460

Differential Revision: https://secure.phabricator.com/D12025
2015-03-09 14:11:16 -07:00

70 lines
1.8 KiB
PHP

<?php
final class PhabricatorAuditTransactionComment
extends PhabricatorApplicationTransactionComment {
protected $commitPHID;
protected $pathID;
protected $isNewFile = 0;
protected $lineNumber = 0;
protected $lineLength = 0;
protected $fixedState;
protected $hasReplies = 0;
protected $replyToCommentPHID;
protected $legacyCommentID;
private $replyToComment = self::ATTACHABLE;
public function getApplicationTransactionObject() {
return new PhabricatorAuditTransaction();
}
public function shouldUseMarkupCache($field) {
// Only cache submitted comments.
return ($this->getTransactionPHID() != null);
}
protected function getConfiguration() {
$config = parent::getConfiguration();
$config[self::CONFIG_COLUMN_SCHEMA] = array(
'commitPHID' => 'phid?',
'pathID' => 'id?',
'isNewFile' => 'bool',
'lineNumber' => 'uint32',
'lineLength' => 'uint32',
'fixedState' => 'text12?',
'hasReplies' => 'bool',
'replyToCommentPHID' => 'phid?',
'legacyCommentID' => 'id?',
) + $config[self::CONFIG_COLUMN_SCHEMA];
$config[self::CONFIG_KEY_SCHEMA] = array(
'key_path' => array(
'columns' => array('pathID'),
),
'key_draft' => array(
'columns' => array('authorPHID', 'transactionPHID'),
),
'key_commit' => array(
'columns' => array('commitPHID'),
),
'key_legacy' => array(
'columns' => array('legacyCommentID'),
),
) + $config[self::CONFIG_KEY_SCHEMA];
return $config;
}
public function attachReplyToComment(
PhabricatorAuditTransactionComment $comment = null) {
$this->replyToComment = $comment;
return $this;
}
public function getReplyToComment() {
return $this->assertAttached($this->replyToComment);
}
}