Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15386354
D19203.id45989.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D19203.id45989.diff
View Options
diff --git a/src/applications/macro/engine/PhabricatorMemeEngine.php b/src/applications/macro/engine/PhabricatorMemeEngine.php
--- a/src/applications/macro/engine/PhabricatorMemeEngine.php
+++ b/src/applications/macro/engine/PhabricatorMemeEngine.php
@@ -163,8 +163,11 @@
$data,
array(
'name' => 'meme-'.$template->getName(),
- 'ttl.relative' => phutil_units('24 hours in seconds'),
'canCDN' => true,
+
+ // In modern code these can end up linked directly in email, so let
+ // them stick around for a while.
+ 'ttl.relative' => phutil_units('30 days in seconds'),
));
}
diff --git a/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php b/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php
--- a/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php
+++ b/src/applications/macro/markup/PhabricatorMemeRemarkupRule.php
@@ -36,38 +36,65 @@
->setBelowText($options['below']);
$asset = $engine->loadCachedFile();
- $uri = $engine->getGenerateURI();
- if ($this->getEngine()->isHTMLMailMode()) {
- $uri = PhabricatorEnv::getProductionURI($uri);
+ $is_html_mail = $this->getEngine()->isHTMLMailMode();
+ $is_text = $this->getEngine()->isTextMode();
+ $must_inline = ($is_html_mail || $is_text);
+
+ if ($must_inline) {
+ if (!$asset) {
+ try {
+ $asset = $engine->newAsset();
+ } catch (Exception $ex) {
+ return $matches[0];
+ }
+ }
}
- if ($this->getEngine()->isTextMode()) {
- $img =
- ($options['above'] != '' ? "\"{$options['above']}\"\n" : '').
- $options['src'].' <'.PhabricatorEnv::getProductionURI($uri).'>'.
- ($options['below'] != '' ? "\n\"{$options['below']}\"" : '');
+ if ($asset) {
+ $uri = $asset->getViewURI();
} else {
- $alt_text = pht(
- 'Macro %s: %s %s',
- $options['src'],
- $options['above'],
- $options['below']);
-
- if ($asset) {
- $img = $this->newTag(
- 'img',
- array(
- 'src' => $asset->getViewURI(),
- 'class' => 'phabricator-remarkup-macro',
- 'alt' => $alt_text,
- ));
- } else {
- $img = id(new PHUIRemarkupImageView())
- ->setURI($uri)
- ->addClass('phabricator-remarkup-macro')
- ->setAlt($alt_text);
+ $uri = $engine->getGenerateURI();
+ }
+
+ if ($is_text) {
+ $parts = array();
+
+ $above = $options['above'];
+ if (strlen($above)) {
+ $parts[] = pht('"%s"', $above);
}
+
+ $parts[] = $options['src'].' <'.$uri.'>';
+
+ $below = $options['below'];
+ if (strlen($below)) {
+ $parts[] = pht('"%s"', $below);
+ }
+
+ $parts = implode("\n", $parts);
+ return $this->getEngine()->storeText($parts);
+ }
+
+ $alt_text = pht(
+ 'Macro %s: %s %s',
+ $options['src'],
+ $options['above'],
+ $options['below']);
+
+ if ($asset) {
+ $img = $this->newTag(
+ 'img',
+ array(
+ 'src' => $uri,
+ 'class' => 'phabricator-remarkup-macro',
+ 'alt' => $alt_text,
+ ));
+ } else {
+ $img = id(new PHUIRemarkupImageView())
+ ->setURI($uri)
+ ->addClass('phabricator-remarkup-macro')
+ ->setAlt($alt_text);
}
return $this->getEngine()->storeText($img);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 12:25 AM (1 w, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704658
Default Alt Text
D19203.id45989.diff (3 KB)
Attached To
Mode
D19203: Possibly fix memes in email
Attached
Detach File
Event Timeline
Log In to Comment