Thomas Obkircher

Joined

10 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Realtime Nested Comments: Part 3 Discussion

Hey, I'm fighting with this as well and I still don't understand how it's possible at all to make edit & delete buttons visible in the broadcasted partial depending on the user. I don't see how this can work.

The commit itself and the after_create_commit are running in the context of the creating user, i.e. Current.user is always the user creating the post, which means everyone receives the same partial!

Only ways that I see is

  • Use JS / Stimulus to postprocess the partial in the browser.
  • Not sending the partial, but a trigger, so that every client pulls the update in his own context

Can anyone correct me, please?