@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.

When creating a Phriction document, mark initial transactions as "create" transactions to fix weird email

Summary:
Ref T13289. When you create a Phriction document, you currently get an email with the whole new content as a "diff".

You also get extra transactions in the email and on the page.

This is because Phriction isn't on EditEngine and doesn't mark "create" transactions in a modern way. Get them marked properly to fix these obviously-broken behaviors. This can all go away once Phriction switches to EditEngine, although I don't have any particular plans to do that in the immediate future.

Test Plan:
- Created a new document, viewed email, no longer saw redundant "edited content" transaction or "CHANGES TO CONTENT" diff.
- Updated a document, viewed email, got interdiff.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13289

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

+19 -4
+15 -3
src/applications/phriction/controller/PhrictionEditController.php
··· 97 97 $content_text = $content->getContent(); 98 98 $is_draft_mode = ($document->getContent()->getVersion() != $max_version); 99 99 100 + $default_view = $document->getViewPolicy(); 101 + $default_edit = $document->getEditPolicy(); 102 + $default_space = $document->getSpacePHID(); 103 + 100 104 if ($request->isFormPost()) { 101 105 if ($is_new) { 102 106 $save_as_draft = false; ··· 121 125 } 122 126 123 127 $xactions = array(); 128 + 129 + if ($is_new) { 130 + $xactions[] = id(new PhrictionTransaction()) 131 + ->setTransactionType(PhabricatorTransactions::TYPE_CREATE); 132 + } 124 133 125 134 $xactions[] = id(new PhrictionTransaction()) 126 135 ->setTransactionType(PhrictionDocumentTitleTransaction::TRANSACTIONTYPE) ··· 130 139 ->setNewValue($content_text); 131 140 $xactions[] = id(new PhrictionTransaction()) 132 141 ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) 133 - ->setNewValue($v_view); 142 + ->setNewValue($v_view) 143 + ->setIsDefaultTransaction($is_new && ($v_view === $default_view)); 134 144 $xactions[] = id(new PhrictionTransaction()) 135 145 ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) 136 - ->setNewValue($v_edit); 146 + ->setNewValue($v_edit) 147 + ->setIsDefaultTransaction($is_new && ($v_edit === $default_edit)); 137 148 $xactions[] = id(new PhrictionTransaction()) 138 149 ->setTransactionType(PhabricatorTransactions::TYPE_SPACE) 139 - ->setNewValue($v_space); 150 + ->setNewValue($v_space) 151 + ->setIsDefaultTransaction($is_new && ($v_space === $default_space)); 140 152 $xactions[] = id(new PhrictionTransaction()) 141 153 ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) 142 154 ->setNewValue(array('=' => $v_cc));
+4 -1
src/applications/phriction/storage/PhrictionDocument.php
··· 78 78 } 79 79 80 80 if ($parent_doc) { 81 + $space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID( 82 + $parent_doc); 83 + 81 84 $document 82 85 ->setViewPolicy($parent_doc->getViewPolicy()) 83 86 ->setEditPolicy($parent_doc->getEditPolicy()) 84 - ->setSpacePHID($parent_doc->getSpacePHID()); 87 + ->setSpacePHID($space_phid); 85 88 } else { 86 89 $default_view_policy = PhabricatorPolicies::getMostOpenPolicy(); 87 90 $document