@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Publish inline comments in Asana notification stories

Summary: Ref T2852. Bleh, gross. Does what it says in the title.

Test Plan: {F54024}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2852

Differential Revision: https://secure.phabricator.com/D6735

+51 -4
+4
src/applications/differential/editor/DifferentialCommentEditor.php
··· 612 612 'action' => $comment->getAction(), 613 613 'feedback_content' => $comment->getContent(), 614 614 'actor_phid' => $actor_phid, 615 + 616 + // NOTE: Don't use this, it will be removed after ApplicationTransactions. 617 + // For now, it powers inline comment rendering over the Asana brdige. 618 + 'temporaryCommentID' => $comment->getID(), 615 619 ); 616 620 617 621 id(new PhabricatorFeedStoryPublisher())
+12
src/applications/differential/query/DifferentialInlineCommentQuery.php
··· 45 45 return $this; 46 46 } 47 47 48 + public function withCommentIDs(array $comment_ids) { 49 + $this->commentIDs = $comment_ids; 50 + return $this; 51 + } 52 + 48 53 public function execute() { 49 54 $table = new DifferentialInlineComment(); 50 55 $conn_r = $table->establishConnection('r'); ··· 109 114 $conn_r, 110 115 'authorPHID IN (%Ls) AND commentID IS NULL', 111 116 $this->draftsByAuthors); 117 + } 118 + 119 + if ($this->commentIDs) { 120 + $where[] = qsprintf( 121 + $conn_r, 122 + 'commentID IN (%Ld)', 123 + $this->commentIDs); 112 124 } 113 125 114 126 return $this->formatWhereClause($where);
+35 -4
src/applications/feed/story/PhabricatorFeedStoryDifferential.php
··· 98 98 $action = $this->getValue('action'); 99 99 $verb = DifferentialAction::getActionPastTenseVerb($action); 100 100 101 + $engine = PhabricatorMarkupEngine::newMarkupEngine(array()) 102 + ->setConfig('viewer', new PhabricatorUser()) 103 + ->setMode(PhutilRemarkupEngine::MODE_TEXT); 104 + 101 105 $title = "{$author_name} {$verb} this revision."; 102 106 if (strlen($comment)) { 103 - $engine = PhabricatorMarkupEngine::newMarkupEngine(array()) 104 - ->setConfig('viewer', new PhabricatorUser()) 105 - ->setMode(PhutilRemarkupEngine::MODE_TEXT); 106 - 107 107 $comment = $engine->markupText($comment); 108 108 109 109 $title .= "\n\n"; 110 110 $title .= $comment; 111 111 } 112 + 113 + // Roughly render inlines into the comment. 114 + $comment_id = $data->getValue('temporaryCommentID'); 115 + if ($comment_id) { 116 + $inlines = id(new DifferentialInlineCommentQuery()) 117 + ->withCommentIDs(array($comment_id)) 118 + ->execute(); 119 + if ($inlines) { 120 + $title .= "\n\n"; 121 + $title .= pht('Inline Comments'); 122 + $title .= "\n"; 123 + $changeset_ids = mpull($inlines, 'getChangesetID'); 124 + $changesets = id(new DifferentialChangeset())->loadAllWhere( 125 + 'id IN (%Ld)', 126 + $changeset_ids); 127 + foreach ($inlines as $inline) { 128 + $changeset = idx($changesets, $inline->getChangesetID()); 129 + if (!$changeset) { 130 + continue; 131 + } 132 + 133 + $filename = $changeset->getDisplayFilename(); 134 + $linenumber = $inline->getLineNumber(); 135 + $inline_text = $engine->markupText($inline->getContent()); 136 + $inline_text = rtrim($inline_text); 137 + 138 + $title .= "{$filename}:{$linenumber} {$inline_text}\n"; 139 + } 140 + } 141 + } 142 + 112 143 113 144 return $title; 114 145 }