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

673 enhanced admin management #701

Merged
merged 6 commits into from
Jan 14, 2023
Merged

Conversation

fozziethebeat
Copy link
Collaborator

Applies to #673

Updates the admin views to user the backend's User API routes:

  • Fetch all users from the backend and merge them with what the web knows
  • Update web API routes to use the more updated backend routes
  • Set the user's enabled and notes fields when managing a user

What's not supported yet:

  • Pagination. This is broken but will be fixed in a follow up PR. How pagination works has changed when using the backend strategy.

@fozziethebeat fozziethebeat changed the title 673 enhanced admin routing 673 enhanced admin management Jan 14, 2023
@fozziethebeat fozziethebeat marked this pull request as ready for review January 14, 2023 08:14
},
});
const messages = await messagesRes.json();
const messages = await oasstApiClient.fetch_user_messages(user as string);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string array? or Message[]?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the explicit type.

Comment on lines +31 to +41
const local_user_map = local_users.reduce((result, user) => {
result.set(user.id, user.role);
return result;
}, new Map());

const users = all_users.map((user) => {
const role = local_user_map.get(user.id) || "general";
return {
...user,
role,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this happen every time you open the users dashboard?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not ideal and not something I want to keep for long. I think the real fix is to push the role information to the backend but that would require a variety of new routes to make that fetching and setting easier.

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Front-end change approved!

Copy link
Collaborator

@yk yk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you

@fozziethebeat
Copy link
Collaborator Author

Merging now that I see approval from all required people.

@fozziethebeat fozziethebeat merged commit 69be679 into main Jan 14, 2023
@fozziethebeat fozziethebeat deleted the 673-enhanced-admin-routing branch January 14, 2023 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants