Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Admin" link missing on some pages #63

Open
alexwennerberg opened this issue Feb 23, 2024 · 3 comments
Open

"Admin" link missing on some pages #63

alexwennerberg opened this issue Feb 23, 2024 · 3 comments

Comments

@alexwennerberg
Copy link
Contributor

on e.g. /about, there is no "admin" link in the header, I believe because IsAdmin is not populated.

With IsAdmin and Pending booleans, I wonder if storing a larger 'logged in user metadata' struct rather than getting each field individually may be valuable, and reduce code duplication

@JamieCrisman
Copy link

JamieCrisman commented May 30, 2024

I noticed the TemplateData is inconsistently populated across handlers. I think context.Context could help provide the user data, and you can take the context as a parameter to build a baseline TemplateData in the handlers. This would ensure things like the user id, is logged in, is admin is consistently filled out.

There's also some spots where we can avoid duplicated calls to the database asking for the individual fields for the user data.

I have some code working for this locally. I could make a PR if it's okay with @cblgh

@cblgh
Copy link
Owner

cblgh commented Jun 1, 2024

the admin link missing was actually intended, but perhaps it wasn't so useful. i just wanted to constrain the admin controls and reminders to one place rather than always having an admin top-hat on

@JamieCrisman can you put up your changes on a branch you host somewhere and link me? reading someone's code and giving it a think over would be a nice intermediate from the almost conflict-oriented PR approach github has imposed on collaboration :)

@JamieCrisman
Copy link

JamieCrisman commented Jun 1, 2024

I've made a branch. I tried to break it up into more bite sized commits. And attempted to explain the changes in the commit message.

First three are the main changes. First two just setting up for the third. Last one is a little side thing I noticed while testing.

main...JamieCrisman:cerca:context

For non-admin users, would it be good to have a link to the admin page (maybe on the about page)? Or is that being held off for some reason? Thought it was interesting to realize there's an admin and moderation log that could be seen and even works on merveilles instance, but is not linked to anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants