mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 10:25:42 +08:00
fix: extensions not being able to use the renderer without context (#3382)
This commit is contained in:
parent
c944fd0029
commit
b0fa795cc9
@ -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']);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user