mirror of
https://github.com/flarum/core.git
synced 2025-07-29 12:40:40 +02:00
fix: extensions not being able to use the renderer without context (#3382)
This commit is contained in:
@@ -45,7 +45,7 @@ class FormatUserMentions
|
||||
public function __invoke(Renderer $renderer, $context, string $xml)
|
||||
{
|
||||
return Utils::replaceAttributes($xml, 'USERMENTION', function ($attributes) use ($context) {
|
||||
$user = (isset($context->getRelations()['mentionsUsers']) || $context instanceof Post)
|
||||
$user = (($context && isset($context->getRelations()['mentionsUsers'])) || $context instanceof Post)
|
||||
? $context->mentionsUsers->find($attributes['id'])
|
||||
: User::find($attributes['id']);
|
||||
|
||||
|
@@ -51,7 +51,7 @@ class UnparseUserMentions
|
||||
protected function updateUserMentionTags($context, string $xml): string
|
||||
{
|
||||
return Utils::replaceAttributes($xml, 'USERMENTION', function ($attributes) use ($context) {
|
||||
$user = (isset($context->getRelations()['mentionsUsers']) || $context instanceof Post)
|
||||
$user = (($context && isset($context->getRelations()['mentionsUsers'])) || $context instanceof Post)
|
||||
? $context->mentionsUsers->find($attributes['id'])
|
||||
: User::find($attributes['id']);
|
||||
|
||||
|
Reference in New Issue
Block a user