mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10: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:
parent
faf42cbe8f
commit
4dadad53ae
3 changed files with 11 additions and 1 deletions
|
@ -462,7 +462,7 @@ abstract class PhabricatorFeedStory
|
|||
}
|
||||
|
||||
public function newMarkupEngine($field) {
|
||||
return PhabricatorMarkupEngine::getEngine();
|
||||
return PhabricatorMarkupEngine::getEngine('feed');
|
||||
}
|
||||
|
||||
public function getMarkupText($field) {
|
||||
|
|
|
@ -252,6 +252,12 @@ final class PhabricatorEmbedFileRemarkupRule
|
|||
$autoplay = null;
|
||||
}
|
||||
|
||||
// Rendering contexts like feed can disable autoplay.
|
||||
$engine = $this->getEngine();
|
||||
if ($engine->getConfig('autoplay.disable')) {
|
||||
$autoplay = null;
|
||||
}
|
||||
|
||||
return $this->newTag(
|
||||
$tag,
|
||||
array(
|
||||
|
|
|
@ -414,6 +414,10 @@ final class PhabricatorMarkupEngine extends Phobject {
|
|||
case 'default':
|
||||
$engine = self::newMarkupEngine(array());
|
||||
break;
|
||||
case 'feed':
|
||||
$engine = self::newMarkupEngine(array());
|
||||
$engine->setConfig('autoplay.disable', true);
|
||||
break;
|
||||
case 'nolinebreaks':
|
||||
$engine = self::newMarkupEngine(array());
|
||||
$engine->setConfig('preserve-linebreaks', false);
|
||||
|
|
Loading…
Reference in a new issue