[ADD] ui: expose the current user's agents to templates - #196
Merged
Conversation
A sidebar is drawn on every /me page, but only the chat route builds the agent list, so every other page rendered it empty — reading as "no agents available" to anyone whose theme shows that list. Superadmins were unaffected on the chat page and so nobody noticed. A template can now ask for the list wherever it is drawn instead of each route having to carry it. The lookup is lazy and returns nothing rather than raising when there is no session, so a template can call it unguarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A sidebar that lists the current user's agents is drawn on every
/mepage, butonly the chat route builds that list — so on workflows, connections, dashboard,
tools and vault it rendered empty, reading as "no agents available" to anyone
whose theme shows it.
It stayed hidden because the two conditions rarely meet: superadmins bypass the
per-user check entirely, and the one page that does pass the list is the one
most used. It surfaces for a non-superadmin on any other page.
user_agents(request)lets a template ask for the list wherever it is drawn,instead of every route having to carry it — including routes in plugins mounted
from elsewhere, which cannot be changed from here. The import is lazy because
ui.routes.meimports this module, and it returns an empty list rather thanraising when there is no session, so a template can call it unguarded.
Nothing in this repository consumes it yet; the core pages keep passing their
own context and behave exactly as before.