Skip to content

Commit c4326f1

Browse files
authored
Merge pull request #377 from gitroomhq/feat/fix-teams
hotfix: fixed team invite
2 parents fbd977a + 264eb86 commit c4326f1

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

apps/frontend/src/components/layout/settings.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const SettingsPopup: FC<{ getRef?: Ref<any> }> = (props) => {
3838
}, []);
3939

4040
const url = useSearchParams();
41-
const showLogout = !url.get('onboarding');
41+
const showLogout = !url.get('onboarding') || user?.tier?.current === "FREE";
4242

4343
const loadProfile = useCallback(async () => {
4444
const personal = await (await fetch('/user/personal')).json();

apps/frontend/src/middleware.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextResponse } from 'next/server';
22
import type { NextRequest } from 'next/server';
3-
import { fetchBackend } from '@gitroom/helpers/utils/custom.fetch.func';
43
import { getCookieUrlFromDomain } from '@gitroom/helpers/subdomain/subdomain.management';
4+
import { internalFetch } from '@gitroom/helpers/utils/internal.fetch';
55

66
// This function can be marked `async` if using `await` inside
77
export async function middleware(request: NextRequest) {
@@ -68,13 +68,10 @@ export async function middleware(request: NextRequest) {
6868
try {
6969
if (org) {
7070
const { id } = await (
71-
await fetchBackend('/user/join-org', {
71+
await internalFetch('/user/join-org', {
7272
body: JSON.stringify({
7373
org,
7474
}),
75-
headers: {
76-
auth: authCookie?.value!,
77-
},
7875
method: 'POST',
7976
})
8077
).json();

libraries/helpers/src/utils/custom.fetch.func.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { loadVars } from '@gitroom/react/helpers/variable.context';
21

32
export interface Params {
43
baseUrl: string;
@@ -48,6 +47,6 @@ export const customFetch = (
4847

4948
export const fetchBackend = customFetch({
5049
get baseUrl() {
51-
return loadVars().backendUrl;
50+
return process.env.BACKEND_URL!;
5251
},
5352
});

libraries/nestjs-libraries/src/database/prisma/organizations/organization.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class OrganizationService {
4646
}
4747

4848
async inviteTeamMember(orgId: string, body: AddTeamMemberDto) {
49-
const timeLimit = dayjs().add(15, 'minutes').format('YYYY-MM-DD HH:mm:ss');
49+
const timeLimit = dayjs().add(1, 'hour').format('YYYY-MM-DD HH:mm:ss');
5050
const id = makeId(5);
5151
const url =
5252
process.env.FRONTEND_URL +
@@ -55,7 +55,7 @@ export class OrganizationService {
5555
await this._notificationsService.sendEmail(
5656
body.email,
5757
'You have been invited to join an organization',
58-
`You have been invited to join an organization. Click <a href="${url}">here</a> to join.<br />The link will expire in 15 minutes.`
58+
`You have been invited to join an organization. Click <a href="${url}">here</a> to join.<br />The link will expire in 1 hour.`
5959
);
6060
}
6161
return { url };

0 commit comments

Comments
 (0)