1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 04:20:55 +01:00

Prevent media from autoplaying when rendered as a feed story

Summary: Fixes T11845. Users can still embed a text panel on the home page to give it some ambiance.

Test Plan: Wrote an autoplay video as a comment, saw it in feed. Before change: autoplay. After change: no auto play. On task: still autoplay.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11845

Differential Revision: https://secure.phabricator.com/D16920
This commit is contained in:
epriestley 2016-11-22 14:15:45 -08:00
parent faf42cbe8f
commit 4dadad53ae
3 changed files with 11 additions and 1 deletions

View file

@ -462,7 +462,7 @@ abstract class PhabricatorFeedStory
} }
public function newMarkupEngine($field) { public function newMarkupEngine($field) {
return PhabricatorMarkupEngine::getEngine(); return PhabricatorMarkupEngine::getEngine('feed');
} }
public function getMarkupText($field) { public function getMarkupText($field) {

View file

@ -252,6 +252,12 @@ final class PhabricatorEmbedFileRemarkupRule
$autoplay = null; $autoplay = null;
} }
// Rendering contexts like feed can disable autoplay.
$engine = $this->getEngine();
if ($engine->getConfig('autoplay.disable')) {
$autoplay = null;
}
return $this->newTag( return $this->newTag(
$tag, $tag,
array( array(

View file

@ -414,6 +414,10 @@ final class PhabricatorMarkupEngine extends Phobject {
case 'default': case 'default':
$engine = self::newMarkupEngine(array()); $engine = self::newMarkupEngine(array());
break; break;
case 'feed':
$engine = self::newMarkupEngine(array());
$engine->setConfig('autoplay.disable', true);
break;
case 'nolinebreaks': case 'nolinebreaks':
$engine = self::newMarkupEngine(array()); $engine = self::newMarkupEngine(array());
$engine->setConfig('preserve-linebreaks', false); $engine->setConfig('preserve-linebreaks', false);