2011-02-02 00:52:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-01-04 18:10:37 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-02-02 00:52:04 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 20:56:01 +01:00
|
|
|
final class DifferentialInlineComment
|
|
|
|
extends DifferentialDAO
|
|
|
|
implements PhabricatorInlineCommentInterface {
|
2011-02-02 00:52:04 +01:00
|
|
|
|
|
|
|
protected $revisionID;
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 20:56:01 +01:00
|
|
|
protected $changesetID;
|
2011-02-02 00:52:04 +01:00
|
|
|
protected $commentID;
|
|
|
|
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 20:56:01 +01:00
|
|
|
protected $authorPHID;
|
2011-02-02 00:52:04 +01:00
|
|
|
protected $isNewFile;
|
|
|
|
protected $lineNumber;
|
|
|
|
protected $lineLength;
|
|
|
|
protected $content;
|
2011-02-03 01:36:53 +01:00
|
|
|
protected $cache;
|
2011-02-02 00:52:04 +01:00
|
|
|
|
2012-01-04 18:10:37 +01:00
|
|
|
private $syntheticAuthor;
|
|
|
|
|
|
|
|
public function setSyntheticAuthor($synthetic_author) {
|
|
|
|
$this->syntheticAuthor = $synthetic_author;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getSyntheticAuthor() {
|
|
|
|
return $this->syntheticAuthor;
|
|
|
|
}
|
|
|
|
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 20:56:01 +01:00
|
|
|
public function isCompatible(PhabricatorInlineCommentInterface $comment) {
|
2012-02-04 08:18:47 +01:00
|
|
|
return
|
Add inline comments to Diffusion/Audit
Summary:
- Add inline comments to Audits, like Differential.
- Creates new storage for the comments in the Audits database.
- Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment.
- Defines an Interface which Differential and Audit comments conform to.
- Makes consumers of DifferentialInlineComments consume objects which implement that interface instead.
- Adds save
NOTE: Some features are still missing! Wanted to cut this off before it got crazy:
- Inline comments aren't shown in the main comment list.
- Inline comments aren't shown in the emails.
- Inline comments aren't previewed.
I'll followup with those but this was getting pretty big.
@vrana, does the SQL change look correct?
Test Plan:
- Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs.
- Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs.
Reviewers: btrahan, vrana
Reviewed By: btrahan
CC: aran, epriestley
Maniphest Tasks: T904
Differential Revision: https://secure.phabricator.com/D1898
2012-03-14 20:56:01 +01:00
|
|
|
($this->getAuthorPHID() === $comment->getAuthorPHID()) &&
|
|
|
|
($this->getSyntheticAuthor() === $comment->getSyntheticAuthor()) &&
|
|
|
|
($this->getContent() === $comment->getContent());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setContent($content) {
|
|
|
|
$this->setCache(null);
|
|
|
|
$this->writeField('content', $content);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getContent() {
|
|
|
|
return $this->readField('content');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isDraft() {
|
|
|
|
return !$this->getCommentID();
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: We need to provide implementations so we conform to the shared
|
|
|
|
// interface; these are all trivial and just explicit versions of the Lisk
|
|
|
|
// defaults.
|
|
|
|
|
|
|
|
public function setChangesetID($id) {
|
|
|
|
$this->writeField('changesetID', $id);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getChangesetID() {
|
|
|
|
return $this->readField('changesetID');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setIsNewFile($is_new) {
|
|
|
|
$this->writeField('isNewFile', $is_new);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIsNewFile() {
|
|
|
|
return $this->readField('isNewFile');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setLineNumber($number) {
|
|
|
|
$this->writeField('lineNumber', $number);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLineNumber() {
|
|
|
|
return $this->readField('lineNumber');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setLineLength($length) {
|
|
|
|
$this->writeField('lineLength', $length);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLineLength() {
|
|
|
|
return $this->readField('lineLength');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setCache($cache) {
|
|
|
|
$this->writeField('cache', $cache);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCache() {
|
|
|
|
return $this->readField('cache');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setAuthorPHID($phid) {
|
|
|
|
$this->writeField('authorPHID', $phid);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAuthorPHID() {
|
|
|
|
return $this->readField('authorPHID');
|
2012-02-04 08:18:47 +01:00
|
|
|
}
|
|
|
|
|
2012-10-24 02:33:58 +02:00
|
|
|
|
|
|
|
/* -( PhabricatorMarkupInterface Implementation )-------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getMarkupFieldKey($field) {
|
|
|
|
return 'DI:'.$this->getID();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function newMarkupEngine($field) {
|
|
|
|
return PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMarkupText($field) {
|
|
|
|
return $this->getContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldUseMarkupCache($field) {
|
|
|
|
// Only cache submitted comments.
|
|
|
|
return ($this->getID() && $this->getCommentID());
|
|
|
|
}
|
|
|
|
|
2011-02-02 00:52:04 +01:00
|
|
|
}
|