If I failed to explain this in the previous PR #19, i decided to merge the team members and team memberships routes into one route, which simply displays all team memberships, with different options depending on the membership role.
Invitees can be removed
Members can be promoted to admin or removed
Admins can be demoted to members or removed
Owner cannot be changed
Background structure
I tried to make it easily modifiable as I could. There are 3 components that compose the actual membership listing - one for information about the membership and/or member, one for role change actions and one for removal from team. Each component is render or not-rendered depending on what the current user is.
current-user is no longer used
The way our API works is that it returns the current-user upon successful authentication, as a response to an authentication request.
The way simple-auth works is that it stores whatever is returned by the API as a response in an authentication request into session.secure. This means we already have everything we currently need in relation to the current user right there, so there is at the moment no need to customize the session to add a currentUser property to it.
It also means we technically do not need a current user model on the client side, or a /me endpoint on the API side, but I decided to leave those in since I'm expecting we will need that when we decide to implement some sort of profile editing.
Team members integration test module has grown A LOT
I'd like to shrink it somehow, but I'm still figuring the best way to separate it without a lot of redundancy.
ToDO
[x] Delete action
[x] Add a property which determines the current user is an admin (or higher) of the current team and do not render the role buttons if that property is false.
Description
UI
If I failed to explain this in the previous PR #19, i decided to merge the team members and team memberships routes into one route, which simply displays all team memberships, with different options depending on the membership role.
Background structure
I tried to make it easily modifiable as I could. There are 3 components that compose the actual membership listing - one for information about the membership and/or member, one for role change actions and one for removal from team. Each component is render or not-rendered depending on what the current user is.
current-user
is no longer usedThe way our API works is that it returns the current-user upon successful authentication, as a response to an authentication request.
The way
simple-auth
works is that it stores whatever is returned by the API as a response in an authentication request intosession.secure
. This means we already have everything we currently need in relation to the current user right there, so there is at the moment no need to customize the session to add acurrentUser
property to it.It also means we technically do not need a current user model on the client side, or a
/me
endpoint on the API side, but I decided to leave those in since I'm expecting we will need that when we decide to implement some sort of profile editing.Team members integration test module has grown A LOT
I'd like to shrink it somehow, but I'm still figuring the best way to separate it without a lot of redundancy.
ToDO
team-members-test.js