[Posting] Add text/html content type, must actually treat it

This commit is contained in:
Diogo Peralta Cordeiro 2021-09-20 17:02:35 +01:00
parent 85969a8cff
commit 958cbffb91
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0

View File

@ -28,6 +28,7 @@ use App\Core\Form;
use App\Core\GSFile;
use function App\Core\I18n\_m;
use App\Core\Modules\Component;
use App\Core\Security;
use App\Entity\Actor;
use App\Entity\ActorToAttachment;
use App\Entity\Attachment;
@ -170,12 +171,18 @@ class Posting extends Component
public function onRenderNoteContent(string $content, string $content_type, ?string &$rendered, Actor $author, ?Note $reply_to = null)
{
if ($content_type === 'text/plain') {
$content = Formatting::renderPlainText($content);
$rendered = Formatting::linkifyMentions($content, $author, $reply_to);
return Event::stop;
switch ($content_type) {
case 'text/plain':
$rendered = Formatting::renderPlainText($content);
$rendered = Formatting::linkifyMentions($rendered, $author, $reply_to);
return Event::stop;
case 'text/html':
// TODO: It has to linkify and stuff as well
$rendered = Security::sanitize($content);
return Event::stop;
default:
return Event::next;
}
return Event::next;
}
/**