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

Possibly fix memes in email

Summary:
Depends on D19201. Ref T13101. This likely produces relatively stable-ish image references for email.

They currently TTL after 30 days but this makes the jokes more exclusive and special so it's a feature, not a bug.

Test Plan: I'm just going to test this in production because I'm a ninja superstar developer.

Maniphest Tasks: T13101

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

+57 -27
+4 -1
src/applications/macro/engine/PhabricatorMemeEngine.php
··· 163 163 $data, 164 164 array( 165 165 'name' => 'meme-'.$template->getName(), 166 - 'ttl.relative' => phutil_units('24 hours in seconds'), 167 166 'canCDN' => true, 167 + 168 + // In modern code these can end up linked directly in email, so let 169 + // them stick around for a while. 170 + 'ttl.relative' => phutil_units('30 days in seconds'), 168 171 )); 169 172 } 170 173
+53 -26
src/applications/macro/markup/PhabricatorMemeRemarkupRule.php
··· 36 36 ->setBelowText($options['below']); 37 37 38 38 $asset = $engine->loadCachedFile(); 39 - $uri = $engine->getGenerateURI(); 40 39 41 - if ($this->getEngine()->isHTMLMailMode()) { 42 - $uri = PhabricatorEnv::getProductionURI($uri); 40 + $is_html_mail = $this->getEngine()->isHTMLMailMode(); 41 + $is_text = $this->getEngine()->isTextMode(); 42 + $must_inline = ($is_html_mail || $is_text); 43 + 44 + if ($must_inline) { 45 + if (!$asset) { 46 + try { 47 + $asset = $engine->newAsset(); 48 + } catch (Exception $ex) { 49 + return $matches[0]; 50 + } 51 + } 43 52 } 44 53 45 - if ($this->getEngine()->isTextMode()) { 46 - $img = 47 - ($options['above'] != '' ? "\"{$options['above']}\"\n" : ''). 48 - $options['src'].' <'.PhabricatorEnv::getProductionURI($uri).'>'. 49 - ($options['below'] != '' ? "\n\"{$options['below']}\"" : ''); 54 + if ($asset) { 55 + $uri = $asset->getViewURI(); 50 56 } else { 51 - $alt_text = pht( 52 - 'Macro %s: %s %s', 53 - $options['src'], 54 - $options['above'], 55 - $options['below']); 57 + $uri = $engine->getGenerateURI(); 58 + } 56 59 57 - if ($asset) { 58 - $img = $this->newTag( 59 - 'img', 60 - array( 61 - 'src' => $asset->getViewURI(), 62 - 'class' => 'phabricator-remarkup-macro', 63 - 'alt' => $alt_text, 64 - )); 65 - } else { 66 - $img = id(new PHUIRemarkupImageView()) 67 - ->setURI($uri) 68 - ->addClass('phabricator-remarkup-macro') 69 - ->setAlt($alt_text); 60 + if ($is_text) { 61 + $parts = array(); 62 + 63 + $above = $options['above']; 64 + if (strlen($above)) { 65 + $parts[] = pht('"%s"', $above); 66 + } 67 + 68 + $parts[] = $options['src'].' <'.$uri.'>'; 69 + 70 + $below = $options['below']; 71 + if (strlen($below)) { 72 + $parts[] = pht('"%s"', $below); 70 73 } 74 + 75 + $parts = implode("\n", $parts); 76 + return $this->getEngine()->storeText($parts); 77 + } 78 + 79 + $alt_text = pht( 80 + 'Macro %s: %s %s', 81 + $options['src'], 82 + $options['above'], 83 + $options['below']); 84 + 85 + if ($asset) { 86 + $img = $this->newTag( 87 + 'img', 88 + array( 89 + 'src' => $uri, 90 + 'class' => 'phabricator-remarkup-macro', 91 + 'alt' => $alt_text, 92 + )); 93 + } else { 94 + $img = id(new PHUIRemarkupImageView()) 95 + ->setURI($uri) 96 + ->addClass('phabricator-remarkup-macro') 97 + ->setAlt($alt_text); 71 98 } 72 99 73 100 return $this->getEngine()->storeText($img);