File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,6 @@ final class PholioTransactionType extends PholioConstants {
4
4
5
5
const TYPE_NAME = 'name ' ;
6
6
const TYPE_DESCRIPTION = 'description ' ;
7
+ const TYPE_INLINE = 'inline ' ;
7
8
8
9
}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ public function processRequest() {
22
22
$ mock = id (new PholioMockQuery ())
23
23
->setViewer ($ user )
24
24
->withIDs (array ($ this ->id ))
25
+ ->needImages (true )
25
26
->executeOne ();
26
27
27
28
if (!$ mock ) {
@@ -49,6 +50,18 @@ public function processRequest() {
49
50
id (new PholioTransactionComment ())
50
51
->setContent ($ comment ));
51
52
53
+ $ inlineComments = id (new PholioTransactionComment ())->loadAllWhere (
54
+ 'authorphid = %s AND transactionphid IS NULL AND imageid IN (%Ld) ' ,
55
+ $ user ->getPHID (),
56
+ mpull ($ mock ->getImages (), 'getID ' )
57
+ );
58
+
59
+ foreach ($ inlineComments as $ inlineComment ) {
60
+ $ xactions [] = id (new PholioTransaction ())
61
+ ->setTransactionType (PholioTransactionType::TYPE_INLINE )
62
+ ->attachComment ($ inlineComment );
63
+ }
64
+
52
65
$ editor = id (new PholioMockEditor ())
53
66
->setActor ($ user )
54
67
->setContentSource ($ content_source )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ public function getTransactionTypes() {
14
14
15
15
$ types [] = PholioTransactionType::TYPE_NAME ;
16
16
$ types [] = PholioTransactionType::TYPE_DESCRIPTION ;
17
+ $ types [] = PholioTransactionType::TYPE_INLINE ;
17
18
return $ types ;
18
19
}
19
20
@@ -40,6 +41,18 @@ protected function getCustomTransactionNewValue(
40
41
}
41
42
}
42
43
44
+ protected function transactionHasEffect (
45
+ PhabricatorLiskDAO $ object ,
46
+ PhabricatorApplicationTransaction $ xaction ) {
47
+
48
+ switch ($ xaction ->getTransactionType ()) {
49
+ case PholioTransactionType::TYPE_INLINE :
50
+ return true ;
51
+ }
52
+
53
+ return parent ::transactionHasEffect ($ object , $ xaction );
54
+ }
55
+
43
56
protected function applyCustomInternalTransaction (
44
57
PhabricatorLiskDAO $ object ,
45
58
PhabricatorApplicationTransaction $ xaction ) {
Original file line number Diff line number Diff line change @@ -75,9 +75,12 @@ private function validateEdit(
75
75
"Transaction must have a PHID before calling applyEdit()! " );
76
76
}
77
77
78
- if ($ comment ->getPHID ()) {
79
- throw new Exception (
78
+ $ type_comment = PhabricatorTransactions::TYPE_COMMENT ;
79
+ if ($ xaction ->getTransactionType () == $ type_comment ) {
80
+ if ($ comment ->getPHID ()) {
81
+ throw new Exception (
80
82
"Transaction comment must not yet have a PHID! " );
83
+ }
81
84
}
82
85
83
86
if (!$ this ->getContentSource ()) {
You can’t perform that action at this time.
0 commit comments