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

Don't warn about conflicts when reverting Phriction documents

Summary:
Fixes T5144. This was incorrectly checking the //content// version, not the //head// version, so reverts would raise the "conflict" warning.

Also fix a couple of FontAwesome icons.

Test Plan:
- Edited a document.
- Reverted a document.
- Opened two edit tabs. Edited one, tried to edit #2, got a warning.
- Opened two revert tabs. Reverted in one, tried to revert in #2, got a warning.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5144

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

+13 -7
+7 -3
src/applications/phriction/controller/PhrictionEditController.php
··· 14 14 $request = $this->getRequest(); 15 15 $user = $request->getUser(); 16 16 17 + $current_version = null; 17 18 if ($this->id) { 18 19 $document = id(new PhrictionDocumentQuery()) 19 20 ->setViewer($user) 20 21 ->withIDs(array($this->id)) 22 + ->needContent(true) 21 23 ->requireCapabilities( 22 24 array( 23 25 PhabricatorPolicyCapability::CAN_VIEW, ··· 27 29 if (!$document) { 28 30 return new Aphront404Response(); 29 31 } 32 + 33 + $current_version = $document->getContent()->getVersion(); 30 34 31 35 $revert = $request->getInt('revert'); 32 36 if ($revert) { ··· 38 42 return new Aphront404Response(); 39 43 } 40 44 } else { 41 - $content = id(new PhrictionContent())->load($document->getContentID()); 45 + $content = $document->getContent(); 42 46 } 43 47 44 48 } else { ··· 56 60 57 61 if ($document) { 58 62 $content = $document->getContent(); 63 + $current_version = $content->getVersion(); 59 64 } else { 60 65 if (PhrictionDocument::isProjectSlug($slug)) { 61 66 $project = id(new PhabricatorProjectQuery()) ··· 104 109 $overwrite = $request->getBool('overwrite'); 105 110 if (!$overwrite) { 106 111 $edit_version = $request->getStr('contentVersion'); 107 - $current_version = $content->getVersion(); 108 112 if ($edit_version != $current_version) { 109 113 $dialog = $this->newDialog() 110 114 ->setTitle(pht('Edit Conflict!')) ··· 229 233 ->setAction($request->getRequestURI()->getPath()) 230 234 ->addHiddenInput('slug', $document->getSlug()) 231 235 ->addHiddenInput('nodraft', $request->getBool('nodraft')) 232 - ->addHiddenInput('contentVersion', $content->getVersion()) 236 + ->addHiddenInput('contentVersion', $current_version) 233 237 ->appendChild( 234 238 id(new AphrontFormTextControl()) 235 239 ->setLabel(pht('Title'))
+6 -4
src/applications/phriction/controller/PhrictionHistoryController.php
··· 108 108 109 109 if ($vs_previous) { 110 110 $item->addIcon( 111 - 'arrow_left', 111 + 'fa-reply', 112 112 pht('Show Change'), 113 113 array( 114 114 'href' => $vs_previous, 115 115 )); 116 116 } else { 117 - $item->addIcon('arrow_left-grey', 117 + $item->addIcon( 118 + 'fa-reply grey', 118 119 phutil_tag('em', array(), pht('No previous change'))); 119 120 } 120 121 121 122 if ($vs_head) { 122 123 $item->addIcon( 123 - 'merge', 124 + 'fa-reply-all', 124 125 pht('Show Later Changes'), 125 126 array( 126 127 'href' => $vs_head, 127 128 )); 128 129 } else { 129 - $item->addIcon('merge-grey', 130 + $item->addIcon( 131 + 'fa-reply-all grey', 130 132 phutil_tag('em', array(), pht('No later changes'))); 131 133 } 132 134