chore: new feature
This commit is contained in:
@@ -67,6 +67,14 @@ export class EmailController {
|
||||
return this.emailService.markMessageAsSeen(userId, Number(params.messageId), query.mailbox);
|
||||
}
|
||||
|
||||
@Patch("messages/:messageId/unseen")
|
||||
@ApiOperation({ summary: "Mark a message as unseen" })
|
||||
@ApiResponse({ status: 200, description: "Message marked as unseen successfully" })
|
||||
@ApiResponse({ status: 404, description: "Message not found" })
|
||||
markMessageAsUnseen(@UserDec("wildduckUserId") userId: string, @Param() params: MessageParamDto, @Query() query: MailboxIdQueryDto) {
|
||||
return this.emailService.markMessageAsUnseen(userId, Number(params.messageId), query.mailbox);
|
||||
}
|
||||
|
||||
@Get("messages/inbox")
|
||||
@ApiOperation({ summary: "List messages in a inbox" })
|
||||
@ApiResponse({ status: 200, description: "List of messages" })
|
||||
|
||||
@@ -33,6 +33,8 @@ export class EmailSpamService {
|
||||
}
|
||||
}
|
||||
} catch (_error) {
|
||||
// Expected: 404 errors occur when the message doesn't exist in this mailbox
|
||||
// Continue searching other mailboxes
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +103,7 @@ export class EmailSpamService {
|
||||
await firstValueFrom(
|
||||
this.mailServerService.domainAccess.addAllowedDomain(domainTag, {
|
||||
domain: senderInfo.senderDomain,
|
||||
description: `Auto-allowed due to not-spam report from message ${messageId}`,
|
||||
// Removed description field as WildDuck API doesn't accept it for allowlist operations
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -269,6 +269,27 @@ export class EmailService {
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================
|
||||
async markMessageAsUnseen(wildduckUserId: string, messageId: number, mailboxId: string) {
|
||||
try {
|
||||
this.logger.log(`Marking message ${messageId} as unseen in ${mailboxId} mailbox for user: ${wildduckUserId}`);
|
||||
|
||||
const { updated } = await firstValueFrom(this.mailServerService.messages.updateMessage(wildduckUserId, mailboxId, messageId, { seen: false }));
|
||||
|
||||
this.logger.log(`Message ${messageId} marked as unseen successfully in ${mailboxId}`);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: EmailMessage.MESSAGE_MARKED_AS_UNSEEN_SUCCESSFULLY,
|
||||
updated,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
`Failed to mark message ${messageId} as unseen for user ${wildduckUserId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
//==============================================
|
||||
async getSentMessages(wildduckUserId: string, query: MessageListQueryDto) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user