showing edit button and derive a copy link in published content that the...

... user owns
Why did you move `session.get('id')` out of the template helper function?  Moving it out means that the `user` variable will be evaluated once (when the app loads) and then never again, so the session status will never change.  Leaving it in the function means it will be evaluated every time the template is loaded and will therefore show the correct session status at that time.