And another “simple” question from me and basically a follow up to Showing simple text with decorateWidget
I want to decorate the post with a custom field from the posting user. To do this, I want to get the user object. I already realized, that I can get the username or user_id from the helper, i.e.,
var username = helper.attrs.username var user_id = helper.attrs.user_id
How can I reach the user object from there? I found something about a User.find() method somewhere, but I’m not able to access it even though I import User from discourse/models/user. I also try to user Discourse.User.findByUsername(), but that returns a Promise and I have no idea how to handle that.
Do I need some additional imports or am I doing things wrong? Thanks a lot!