Ser5 I need to access it later, to retrieve that user data from the store and use it in other places, like in the composer window. I tried to extend various methods of the following objects, and see what the extender callback receives as an argument: https://api.docs.flarum.org/js/main/classes/forum_components_composer.composer https://api.docs.flarum.org/js/main/classes/common_components_texteditor.texteditor But can't find any references to the post being edited.
Justoverclock you can extend the CommentPost component and access the current post like this? extend(CommentPost.prototype, 'oncreate', function () { const postID = this.attrs.post.id() } i do not remember but for sure you can access the post author as a relation
Ser5 Justoverclock Wow, I didn't suspected, that I can access that inside extenders. I'll check this, thanks!
Ser5 Justoverclock Holy cow, your example worked immediately! What a great memory, thank you! UPDATE For the user ID I can access it with this.attrs.post.data.relationships.user.data.id; IDK if this is allowed approach or this data is considered private, but it does work.
Justoverclock Ser5 glad that this help you, i do not remember if you can access direcly with this.attrs.post.user() but of course your above solution is fine
Ser5 Justoverclock However it appears I still have a problem... CommentPost does contain user ID. But I don't see Composer has any relations to the post being edited, nor the user. So I'm cut off from the user ID of CommentPost.
SychO If editing a post, you're dealing with the EditPostComposer, which does have a post attribute flarum/frameworkblob/1.x/framework%2Fcore%2Fjs%2Fsrc%2Fforum%2Fcomponents%2FEditPostComposer.js
Ser5 SychO Hey, that was simple indeed, it does work! Here is my example: extend(EditPostComposer.prototype, 'oncreate', function (e) { console.log(this.attrs.user.data.id); }); Thank you for your efforts, guys! 🤗