@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
at recaptime-dev/main 42 lines 1.1 kB view raw
1<?php 2 3final class PhrictionDocumentPublishedHeraldField 4 extends PhrictionDocumentHeraldField { 5 6 const FIELDCONST = 'phriction.document.published'; 7 8 public function getHeraldFieldName() { 9 return pht('Published document changed'); 10 } 11 12 public function getFieldGroupKey() { 13 return HeraldTransactionsFieldGroup::FIELDGROUPKEY; 14 } 15 16 public function getHeraldFieldValue($object) { 17 // The published document changes if we apply a "publish" transaction 18 // (which points the published document pointer at new content) or if we 19 // apply a "content" transaction. 20 21 // When a change affects only the draft document, it applies as a "draft" 22 // transaction. 23 24 $type_content = PhrictionDocumentContentTransaction::TRANSACTIONTYPE; 25 $type_publish = PhrictionDocumentPublishTransaction::TRANSACTIONTYPE; 26 27 if ($this->hasAppliedTransactionOfType($type_content)) { 28 return true; 29 } 30 31 if ($this->hasAppliedTransactionOfType($type_publish)) { 32 return true; 33 } 34 35 return false; 36 } 37 38 protected function getHeraldFieldStandardType() { 39 return self::STANDARD_BOOL; 40 } 41 42}