-
-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow calling formatContent() on a CommentPost without passing a request #1840
Comments
Cross-linking the PR: #1721 Not sure if it's worth an additional issue, but IMO it would be more logical to pass the actor as parameter, assuming guest if no actor was given. That way the same method can also be useful in the context of sending emails for example, where there is no request, but definitely is an actor. |
Definitely 👍 for the proposal - please feel free to send a PR! @clarkwinkelmann That was also my reaction, but Toby's response isn't completely without merit. Can you share example code where you are using the formatter in a non-request context, please? |
We could also consider passing in something like a |
I have no example of my own but it could maybe be used here for example https://github.com/flarum/subscriptions/blob/v0.1.0-beta.9/views/emails/newPost.blade.php#L10 |
Is it still possible to have the PR merged for beta10, as a temporary solution? Thanks |
When the
Formatter
was made dependent on the current HTTP request in 0ab9fac, the$request
parameter on therender
method on the formatter was made optional, but it wasn't on theformatContent($request)
method in theCommentPost
class.As discussed here, there might be the need to generate the HTML content in contexts where the request is not available.
The proposal is to change, in the
CommentPost
class, this signature from:to:
The text was updated successfully, but these errors were encountered: