fix: Add ability to choose user permission level when inviting (#2473)

* Select user role while sending invite

* Add tests to check for role

* Update app/scenes/Invite.js

Co-authored-by: Tom Moor <tom.moor@gmail.com>

* Use select

* Use inviteUser policy

* Remove unnecessary code

* Normalize rank/role
Fix text sizing of select input, fix alignment on users invite form

* Move component to root

* cleanup

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Saumya Pandey
2021-08-29 03:05:37 +05:30
committed by GitHub
parent 00ba65f3ef
commit e4b7aa6761
12 changed files with 151 additions and 52 deletions

View File

@ -1,9 +1,14 @@
// @flow
import { uniqBy } from "lodash";
import type { Role } from "shared/types";
import mailer from "../mailer";
import { User, Event, Team } from "../models";
type Invite = { name: string, email: string };
type Invite = {
name: string,
email: string,
role: Role,
};
export default async function userInviter({
user,
@ -52,6 +57,8 @@ export default async function userInviter({
name: invite.name,
email: invite.email,
service: null,
isAdmin: invite.role === "admin",
isViewer: invite.role === "viewer",
});
users.push(newUser);
@ -62,6 +69,7 @@ export default async function userInviter({
data: {
email: invite.email,
name: invite.name,
role: invite.role,
},
ip,
});