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

Added a Disable Macros function that can be called in some contexts where Macros are unsuitable

Summary: Semi Fixed T2397

Test Plan: Can disable the meme button on manually toggling the class variable.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2397

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

authored by

Debarghya Das and committed by
epriestley
ccb206e9 39afb3fe

+18 -11
+2 -1
src/applications/phame/controller/blog/PhameBlogEditController.php
··· 122 122 ->setName('description') 123 123 ->setValue($blog->getDescription()) 124 124 ->setID('blog-description') 125 - ->setUser($user)) 125 + ->setUser($user) 126 + ->setDisableMacros(true)) 126 127 ->appendChild( 127 128 id(new AphrontFormPolicyControl()) 128 129 ->setUser($user)
+1
src/applications/phame/controller/post/PhamePostEditController.php
··· 133 133 ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) 134 134 ->setID('post-body') 135 135 ->setUser($user) 136 + ->setDisableMacros(true) 136 137 ) 137 138 ->appendChild( 138 139 id(new AphrontFormSelectControl())
+15 -10
src/view/form/control/PhabricatorRemarkupControl.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { 4 - 4 + private $disableMacro = false; 5 + public function setDisableMacros($disable) { 6 + $this->disableMacro = $disable; 7 + return $this; 8 + } 5 9 protected function renderInput() { 6 10 $id = $this->getID(); 7 11 if (!$id) { ··· 48 52 ), 49 53 'table' => array( 50 54 'tip' => pht('Table'), 51 - ), 52 - array( 55 + ) 56 + ); 57 + if (!$this->disableMacro and function_exists('imagettftext')) { 58 + $actions[] = array( 53 59 'spacer' => true, 54 - ), 55 - 'meme' => array( 60 + ); 61 + $actions['meme'] = array( 56 62 'tip' => pht('Meme'), 57 - ), 58 - 'help' => array( 63 + ); 64 + } 65 + $actions['help'] = array( 59 66 'tip' => pht('Help'), 60 67 'align' => 'right', 61 68 'href' => PhabricatorEnv::getDoclink( 62 69 'article/Remarkup_Reference.html'), 63 - ), 64 - ); 70 + ); 65 71 66 72 $buttons = array(); 67 73 foreach ($actions as $action => $spec) { ··· 74 80 ''); 75 81 continue; 76 82 } 77 - 78 83 $classes = array(); 79 84 $classes[] = 'remarkup-assist-button'; 80 85 if (idx($spec, 'align') == 'right') {