Update localization texts, add permissions check, and seed data

This commit removes the membersTabDescription, updates the deleteAccountDescription text in the localization files, and adds a condition to check permissions in account invitation component. It also includes test credentials in README and provides a significant amount of seed data for testing the database.
This commit is contained in:
giancarlo
2024-04-20 16:53:54 +08:00
parent 0148265b5f
commit efd27aa7de
21 changed files with 634 additions and 122 deletions

View File

@@ -162,6 +162,10 @@ function ActionsDropdown({
const [isUpdatingRole, setIsUpdatingRole] = useState(false);
const [iRenewingInvite, setIsRenewingInvite] = useState(false);
if (!permissions.canUpdateInvitation && !permissions.canRemoveInvitation) {
return null;
}
return (
<>
<DropdownMenu>

View File

@@ -5,7 +5,7 @@ import { Trans } from '@kit/ui/trans';
type Role = string;
const roleClassNameBuilder = cva('font-medium capitalize', {
const roleClassNameBuilder = cva('font-medium capitalize shadow-none', {
variants: {
role: {
owner: '',

View File

@@ -116,13 +116,16 @@ export class AccountInvitationsWebhookService {
logger.info(ctx, 'Invitation email successfully sent!');
})
.catch((error) => {
logger.warn({ error, ...ctx }, 'Failed to send invitation email');
console.error(error);
logger.error({ error, ...ctx }, 'Failed to send invitation email');
});
return {
success: true,
};
} catch (error) {
console.error(error);
logger.warn({ error, ...ctx }, 'Failed to invite user to team');
return {

View File

@@ -9,30 +9,41 @@ const MAILER_PROVIDER = z
* @description Get the mailer based on the environment variable.
*/
export async function getMailer() {
switch (process.env.MAILER_PROVIDER as typeof MAILER_PROVIDER) {
case 'nodemailer': {
if (process.env.NEXT_RUNTIME !== 'edge') {
const { Nodemailer } = await import('./impl/nodemailer');
switch (MAILER_PROVIDER) {
case 'nodemailer':
return getNodemailer();
return new Nodemailer();
} else {
throw new Error('Nodemailer is not available on the edge runtime side');
}
}
case 'cloudflare':
return getCloudflareMailer();
case 'cloudflare': {
const { CloudflareMailer } = await import('./impl/cloudflare');
return new CloudflareMailer();
}
case 'resend': {
const { ResendMailer } = await import('./impl/resend');
return new ResendMailer();
}
case 'resend':
return getResendMailer();
default:
throw new Error(`Invalid mailer: ${MAILER_PROVIDER as string}`);
}
}
async function getNodemailer() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
const { Nodemailer } = await import('./impl/nodemailer');
return new Nodemailer();
} else {
throw new Error(
'Nodemailer is not available on the edge runtime. Please use another mailer.',
);
}
}
async function getCloudflareMailer() {
const { CloudflareMailer } = await import('./impl/cloudflare');
return new CloudflareMailer();
}
async function getResendMailer() {
const { ResendMailer } = await import('./impl/resend');
return new ResendMailer();
}