Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1a0ad90
draft fixes:
ahmetskilinc Apr 19, 2025
1622cca
some fixes for saving attachments to draft
ahmetskilinc Apr 19, 2025
eea8827
fix for empty draft loading
ahmetskilinc Apr 19, 2025
3a2860e
fix draft list recipient name/address
ahmetskilinc Apr 19, 2025
397090c
also show 'No Recipient' if empty
ahmetskilinc Apr 19, 2025
cc52f73
remove comments
ahmetskilinc Apr 19, 2025
b66393c
Merge branch 'staging' into fix-some-draft-issues
ahmetskilinc Apr 20, 2025
aaf0678
Merge branch 'staging' into fix-some-draft-issues
ahmetskilinc Apr 21, 2025
0214edb
switch to mimetext for draft saving to keep formatting consistent
ahmetskilinc Apr 21, 2025
3253ec3
add message title to draft list
ahmetskilinc Apr 21, 2025
181f606
Merge branch 'staging' into fix-some-draft-issues
ahmetskilinc Apr 21, 2025
281e215
feat: single api for oauth connections
BlankParticle Apr 21, 2025
de0ea3f
Merge branch 'staging' into fix-some-draft-issues
ahmetskilinc Apr 21, 2025
80e1af9
Merge pull request #723 from Mail-0/fix-some-draft-issues
ahmetskilinc Apr 21, 2025
2763b45
fix: add extra error handling
BlankParticle Apr 21, 2025
3ac1712
Merge branch 'staging' into feat/single-point-of-oauth
ahmetskilinc Apr 21, 2025
37e5190
Merge pull request #741 from BlankParticle/feat/single-point-of-oauth
ahmetskilinc Apr 21, 2025
b3415c3
chore: simplify and fix the dev env
BlankParticle Apr 21, 2025
3364807
Merge branch 'staging' into chore/fix-dev-env
MrgSub Apr 21, 2025
d57570c
Merge pull request #742 from BlankParticle/chore/fix-dev-env
MrgSub Apr 21, 2025
1d37659
Ai generate security (#706)
ripgrim Apr 21, 2025
797a8cd
Add a new Vietnamese translation file to support Vietnamese language …
ncdai Apr 21, 2025
57936a1
Update es.json (#710)
danibaldomir Apr 22, 2025
3b338fb
Update app manifest and add new icons for PWA (#739)
humbernieto Apr 22, 2025
9a75453
feat: allow sending from email aliases added through gmail (#743)
atharvadeosthale Apr 22, 2025
acbf4b6
Refactor IP handling in early-access routes
MrgSub Apr 22, 2025
f59fb33
Add unauthorized error handling in sign out function
MrgSub Apr 22, 2025
156c2fa
Redirect from Home Page on Session (#701)
nikitadrokin Apr 22, 2025
d8065ba
Refactor settings handling and golden ticket logic
MrgSub Apr 22, 2025
f892073
Feat: og:image Generation on /compose route (#730)
ripgrim Apr 22, 2025
9d5ff36
Merge branch 'main' into staging
MrgSub Apr 22, 2025
934e336
Update session check to include user id before redirecting
MrgSub Apr 22, 2025
67a393a
Fix unauthorized error handling in multiple actions
MrgSub Apr 22, 2025
f443556
Enable shortcuts settings in navigation
MrgSub Apr 22, 2025
aac4405
Refactor error handling to return unauthorized gracefully
MrgSub Apr 22, 2025
84fce88
Update Hero component with new imports and link adjustments
MrgSub Apr 22, 2025
0ff71d8
Update redirect URL to use hostname from req object
MrgSub Apr 22, 2025
c504834
Fix redirect URL formatting and add log for missing user ID
MrgSub Apr 22, 2025
46e49d4
Fix error handling in API routes for unauthorized requests
MrgSub Apr 22, 2025
89e730a
Refactor throwUnauthorizedGracefully function for readability
MrgSub Apr 22, 2025
69500a8
Fix error handling in driver routes
MrgSub Apr 22, 2025
f8d0d2e
Handle unauthorized gracefully when getting connections
MrgSub Apr 22, 2025
89af662
Refactor mail actions for better error handling
MrgSub Apr 22, 2025
bd6b50d
Refactor deleteActiveConnection function for readability
MrgSub Apr 22, 2025
d1b1b30
fixed (#752)
ahmetskilinc Apr 22, 2025
68775ab
Added hover opaciity for better visibility
Adarsh9977 Apr 22, 2025
9415153
Merge branch 'staging' into zero/hover-effect
Adarsh9977 Apr 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mail/actions/ai-reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function generateAIResponse(
const session = await auth.api.getSession({ headers: headersList });

if (!session?.user) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

if (!process.env.GROQ_API_KEY) {
Expand Down
2 changes: 1 addition & 1 deletion apps/mail/actions/brain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const EnableBrain = async () => {
const connection = await getActiveConnection();

if (!connection?.accessToken || !connection.refreshToken) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

return await axios.put(process.env.BRAIN_URL + `/subscribe/${connection.providerId}`, {
Expand Down
8 changes: 4 additions & 4 deletions apps/mail/actions/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export async function deleteConnection(connectionId: string) {
const session = await auth.api.getSession({ headers: headersList });

if (!session) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

const userId = session?.user?.id;

if (!userId) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

await db
Expand All @@ -46,13 +46,13 @@ export async function putConnection(connectionId: string) {
const session = await auth.api.getSession({ headers: headersList });

if (!session) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

const userId = session?.user?.id;

if (!userId) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

const [foundConnection] = await db
Expand Down
4 changes: 1 addition & 3 deletions apps/mail/actions/drafts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export const getDrafts = async ({
return await driver.listDrafts(q, max, pageToken);
} catch (error) {
console.error('Error getting threads:', error);
await throwUnauthorizedGracefully();
// throw error;
return { messages: [], nextPageToken: null };
return throwUnauthorizedGracefully();
}
};

Expand Down
36 changes: 0 additions & 36 deletions apps/mail/actions/email-aliases.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/mail/actions/getSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const GetSummary = async (threadId: string) => {
const session = await auth.api.getSession({ headers: headersList });

if (!session || !session.connectionId) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

const [_connection] = await db
Expand All @@ -21,7 +21,7 @@ export const GetSummary = async (threadId: string) => {
.where(and(eq(connection.userId, session.user.id), eq(connection.id, session.connectionId)));

if (!_connection) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

try {
Expand Down
52 changes: 6 additions & 46 deletions apps/mail/actions/mail.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,9 @@
'use server';
import { deleteActiveConnection, FatalErrors, getActiveDriver } from './utils';
import { throwUnauthorizedGracefully } from '@/app/api/utils';
import { IGetThreadResponse } from '@/app/api/driver/types';
import { FatalErrors, getActiveDriver } from './utils';
import { ParsedMessage } from '@/types';

export const getMails = async ({
folder,
q,
max,
labelIds,
pageToken,
}: {
folder: string;
q?: string;
max?: number;
labelIds?: string[];
pageToken: string | number | undefined;
}) => {
if (!folder) {
throw new Error('Missing required fields');
}

try {
const driver = await getActiveDriver();
return await driver.list(folder, q, max, labelIds, pageToken);
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
console.error('Error getting threads:', error);
// throw error;
await throwUnauthorizedGracefully();
return { messages: [], nextPageToken: null };
}
};

export const getMail = async ({ id }: { id: string }): Promise<IGetThreadResponse> => {
if (!id) {
throw new Error('Missing required fields');
Expand All @@ -47,7 +18,7 @@ export const getMail = async ({ id }: { id: string }): Promise<IGetThreadRespons

return mailData;
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
if (FatalErrors.includes((error as Error).message)) await throwUnauthorizedGracefully();
console.error('Error getting mail:', error);
throw error;
}
Expand All @@ -59,7 +30,7 @@ export const markAsRead = async ({ ids }: { ids: string[] }) => {
await driver.markAsRead(ids);
return { success: true };
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
if (FatalErrors.includes((error as Error).message)) await throwUnauthorizedGracefully();
console.error('Error marking message as read:', error);
throw error;
}
Expand All @@ -71,23 +42,12 @@ export const markAsUnread = async ({ ids }: { ids: string[] }) => {
await driver.markAsUnread(ids);
return { success: true };
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
if (FatalErrors.includes((error as Error).message)) await throwUnauthorizedGracefully();
console.error('Error marking message as unread:', error);
throw error;
}
};

export const mailCount = async () => {
try {
const driver = await getActiveDriver();
return await driver.count();
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
console.error('Error getting mail count:', error);
throw error;
}
};

export const modifyLabels = async ({
threadId,
addLabels = [],
Expand Down Expand Up @@ -117,7 +77,7 @@ export const modifyLabels = async ({
console.log('Server: No label changes specified');
return { success: false, error: 'No label changes specified' };
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
if (FatalErrors.includes((error as Error).message)) await throwUnauthorizedGracefully();
console.error('Error updating thread labels:', error);
throw error;
}
Expand Down Expand Up @@ -159,7 +119,7 @@ export const toggleStar = async ({ ids }: { ids: string[] }) => {

return { success: true };
} catch (error) {
if (FatalErrors.includes((error as Error).message)) await deleteActiveConnection();
if (FatalErrors.includes((error as Error).message)) await throwUnauthorizedGracefully();
console.error('Error toggling star:', error);
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/mail/actions/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function sendEmail({
const connection = await getActiveConnection();

if (!connection?.accessToken || !connection.refreshToken) {
return throwUnauthorizedGracefully();
return throwUnauthorizedGracefully() as never;
}

const driver = await createDriver(connection.providerId, {
Expand Down
Loading