Skip to content

Commit

Permalink
Merge pull request #377 from gitroomhq/feat/fix-teams
Browse files Browse the repository at this point in the history
hotfix: fixed team invite
  • Loading branch information
nevo-david authored Oct 18, 2024
2 parents fbd977a + 264eb86 commit c4326f1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/src/components/layout/settings.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const SettingsPopup: FC<{ getRef?: Ref<any> }> = (props) => {
}, []);

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

const loadProfile = useCallback(async () => {
const personal = await (await fetch('/user/personal')).json();
Expand Down
7 changes: 2 additions & 5 deletions apps/frontend/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { fetchBackend } from '@gitroom/helpers/utils/custom.fetch.func';
import { getCookieUrlFromDomain } from '@gitroom/helpers/subdomain/subdomain.management';
import { internalFetch } from '@gitroom/helpers/utils/internal.fetch';

// This function can be marked `async` if using `await` inside
export async function middleware(request: NextRequest) {
Expand Down Expand Up @@ -68,13 +68,10 @@ export async function middleware(request: NextRequest) {
try {
if (org) {
const { id } = await (
await fetchBackend('/user/join-org', {
await internalFetch('/user/join-org', {
body: JSON.stringify({
org,
}),
headers: {
auth: authCookie?.value!,
},
method: 'POST',
})
).json();
Expand Down
3 changes: 1 addition & 2 deletions libraries/helpers/src/utils/custom.fetch.func.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { loadVars } from '@gitroom/react/helpers/variable.context';

export interface Params {
baseUrl: string;
Expand Down Expand Up @@ -48,6 +47,6 @@ export const customFetch = (

export const fetchBackend = customFetch({
get baseUrl() {
return loadVars().backendUrl;
return process.env.BACKEND_URL!;
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class OrganizationService {
}

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

0 comments on commit c4326f1

Please sign in to comment.