Mark emails as read on JMAP server (fixes Betterbird showing unread)
This commit is contained in:
@@ -69,6 +69,23 @@ export const addContact = async (userId, emailAccountId, jmapConfig, email, name
|
||||
return newContact;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a contact by ID
|
||||
*/
|
||||
export const getContactById = async (contactId, userId) => {
|
||||
const [contact] = await db
|
||||
.select()
|
||||
.from(contacts)
|
||||
.where(and(eq(contacts.id, contactId), eq(contacts.userId, userId)))
|
||||
.limit(1);
|
||||
|
||||
if (!contact) {
|
||||
throw new NotFoundError('Kontakt nenájdený');
|
||||
}
|
||||
|
||||
return contact;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a contact
|
||||
*/
|
||||
|
||||
@@ -246,7 +246,11 @@ export const markContactEmailsAsRead = async (userId, contactId) => {
|
||||
|
||||
console.log('✅ markContactEmailsAsRead result:', { count: result.length, contactId });
|
||||
|
||||
return { success: true, count: result.length };
|
||||
return {
|
||||
success: true,
|
||||
count: result.length,
|
||||
emails: result, // Return the emails so controller can mark them on JMAP server
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user