Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove currentUser lookup in pretty-text (#20894)

Martin Brennane6feb3f1360f
diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb
index 5d142f9e31a..0f679713ec9 100644
--- a/lib/pretty_text.rb
+++ b/lib/pretty_text.rb
@@ -215,16 +215,7 @@ module PrettyText
buffer << "__optInput.forceQuoteLink = #{opts[:force_quote_link]};\n"
end
- if opts[:user_id]
- buffer << "__optInput.userId = #{opts[:user_id].to_i};\n"
-
- # NOTE: If using this for server-side cooking you will end up
- # with a Hash once it is passed to a PrettyText::Helper. If
- # you use that hash to instanciate a User model, you will want to do
- # user.reload before accessing data on this parsed User, otherwise
- # AR relations will not be loaded.
- buffer << "__optInput.currentUser = #{User.find(opts[:user_id]).to_json}\n"
- end
+ buffer << "__optInput.userId = #{opts[:user_id].to_i};\n" if opts[:user_id]
opts[:hashtag_context] = opts[:hashtag_context] || "topic-composer"
hashtag_types_as_js =