AddonsLab
Well-known member
- Affected version
- 2.2.7 Patch 1
Some API requests render templates, for example,
To reproduce the issue create any
The expected outcome is "Hello 0!", the actual outcome is "Hello !".
The reason the variables are missing is that
/nodes
endpoint renders the content of Page
nodes. If these pages happen to use variables otherwise available in templates, e.g. $xf.visitor
the variables are not available and may also log an error if a method is called, e.g. $xf.visitor.canStartConversation()
.To reproduce the issue create any
Page
node with the following content:
Code:
Hello {$xf.visitor.user_id}!
The expected outcome is "Hello 0!", the actual outcome is "Hello !".
The reason the variables are missing is that
App::getGlobalTemplateData()
method is never called in API requests and its output is not added to the default template parameters.