-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Reply tracker for Outlook #721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
ba3389c
7217edb
752dade
c3cdddb
6972181
cd919be
09dbe47
1e401e2
60bc444
44a4606
259d357
66e9a4c
227cb14
76f7724
35dc58e
3e6e2f2
88c419f
32ebfec
b1a75e6
c660ad3
b784118
b76b6d5
2705cb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,8 @@ import { | |||||||||||||||
| createLabel, | ||||||||||||||||
| getOrCreateInboxZeroLabel, | ||||||||||||||||
| GmailLabel, | ||||||||||||||||
| getNeedsReplyLabel, | ||||||||||||||||
| getAwaitingReplyLabel, | ||||||||||||||||
| } from "@/utils/gmail/label"; | ||||||||||||||||
| import { labelVisibility, messageVisibility } from "@/utils/gmail/constants"; | ||||||||||||||||
| import type { InboxZeroLabel } from "@/utils/label"; | ||||||||||||||||
|
|
@@ -46,10 +48,7 @@ import { | |||||||||||||||
| getThreadsWithNextPageToken, | ||||||||||||||||
| } from "@/utils/gmail/thread"; | ||||||||||||||||
| import { decodeSnippet } from "@/utils/gmail/decode"; | ||||||||||||||||
| import { | ||||||||||||||||
| getAwaitingReplyLabel as getGmailAwaitingReplyLabel, | ||||||||||||||||
| getReplyTrackingLabels, | ||||||||||||||||
| } from "@/utils/reply-tracker/label"; | ||||||||||||||||
| import { getReplyTrackingLabels } from "@/utils/gmail/label"; | ||||||||||||||||
| import { getDraft, deleteDraft } from "@/utils/gmail/draft"; | ||||||||||||||||
| import { | ||||||||||||||||
| getFiltersList, | ||||||||||||||||
|
|
@@ -292,7 +291,21 @@ export class GmailProvider implements EmailProvider { | |||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| async getAwaitingReplyLabel(): Promise<string> { | ||||||||||||||||
| return getGmailAwaitingReplyLabel(this.client); | ||||||||||||||||
| return getAwaitingReplyLabel(this.client); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| async getNeedsReplyLabel(): Promise<string> { | ||||||||||||||||
| return getNeedsReplyLabel(this.client); | ||||||||||||||||
| } | ||||||||||||||||
|
Comment on lines
+296
to
+298
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Same normalization for getNeedsReplyLabel async getNeedsReplyLabel(): Promise<string | null> {
- return getNeedsReplyLabel(this.client);
+ const id = await getNeedsReplyLabel(this.client);
+ return id || null;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| async removeAwaitingReplyLabel(threadId: string): Promise<void> { | ||||||||||||||||
| const awaitingReplyLabelId = await this.getAwaitingReplyLabel(); | ||||||||||||||||
| await removeThreadLabel(this.client, threadId, awaitingReplyLabelId); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| async removeNeedsReplyLabel(threadId: string): Promise<void> { | ||||||||||||||||
| const needsReplyLabelId = await this.getNeedsReplyLabel(); | ||||||||||||||||
| await removeThreadLabel(this.client, threadId, needsReplyLabelId); | ||||||||||||||||
| } | ||||||||||||||||
|
elie222 marked this conversation as resolved.
|
||||||||||||||||
|
|
||||||||||||||||
| async createLabel(name: string): Promise<EmailLabel> { | ||||||||||||||||
|
|
@@ -617,6 +630,22 @@ export class GmailProvider implements EmailProvider { | |||||||||||||||
| return getReplyTrackingLabels(this.client); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| async labelAwaitingReply(messageId: string, labelId: string): Promise<void> { | ||||||||||||||||
| await labelMessage({ | ||||||||||||||||
| gmail: this.client, | ||||||||||||||||
| messageId, | ||||||||||||||||
| addLabelIds: [labelId], | ||||||||||||||||
| }); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| async labelNeedsReply(messageId: string, labelId: string): Promise<void> { | ||||||||||||||||
| await labelMessage({ | ||||||||||||||||
| gmail: this.client, | ||||||||||||||||
| messageId, | ||||||||||||||||
| addLabelIds: [labelId], | ||||||||||||||||
| }); | ||||||||||||||||
| } | ||||||||||||||||
|
elie222 marked this conversation as resolved.
Outdated
|
||||||||||||||||
|
|
||||||||||||||||
| async processHistory(options: { | ||||||||||||||||
| emailAddress: string; | ||||||||||||||||
| historyId?: number; | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Normalize empty IDs to null to honor the interface
gmail/label.getAwaitingReplyLabel may return "", which violates the nullable contract and can leak through.
async getAwaitingReplyLabel(): Promise<string | null> { - return getAwaitingReplyLabel(this.client); + const id = await getAwaitingReplyLabel(this.client); + return id || null; }📝 Committable suggestion
🤖 Prompt for AI Agents