fmartinez said 11 months ago :
For the 1 and 2, just didn't work due needed the information from the logged in user
Seems to me that turbo streams create the partial to be pasted in the target without any interaction, only the model create the partial with db info
So, no way to get current_user

The only way that worked for me was number 3
Initially I wanted to trigger a stimulus action on turbo load, but, it wasn't enough. 
I think this will require some morph... too much work for a personal project

End up selecting path number 3
Added current user on the DOM
<div hidden id="session_set"><%= current_user.id%></div>

Then, on the partial, added plain javascript code
I just wanted to align according current user, so, I added this on the partial
    <script> 
        if(document.getElementById("session_set").innerHTML == <%= message.user.id %>) {
            let msgPartial = <%="message_#{dom_id message}"%>;
            msgPartial.classList.add("justify-end");

            let msgPartialContainer = <%="message_#{dom_id message}_container"%>;
            msgPartialContainer.classList.add("flex-row-reverse");

            let msgPartialUsertag = <%="message_#{dom_id message}_usertag"%>;
            msgPartialUsertag.classList.add("ml-10");

        }
    </script>

Spend sooooo much time on it that didn't care to go all 90's on it

Im okay with it due its only for presentation purpose
Anyhow for edit or delete action could create a static turbo_stream_from with information of the user that match (is the approach of this video https://www.youtube.com/watch?v=NxlfCYP7Gfo). Anyhow, due it is static, the approach didn't work for me

Well, this is my learning Hotwire experience repo
https://github.com/droidfer/turbochat