Skip to content

Conversation

@mlsad3
Copy link
Contributor

@mlsad3 mlsad3 commented Aug 6, 2022

Allow matching message thread details.

Create rules that can match an email thread's details.
Thread details include:

  • (thread label ABC/xyz)
  • (thread is_important)
  • (thread is_in_inbox)
  • (thread is_in_priority_inbox)
  • (thread is_in_spam)
  • (thread is_in_trash)
  • (thread is_starred)
  • (thread is_unread)
  • (thread first_message_subject /has This Text/i)

For example, an email thread may already exist in the labels:

  • ABC
  • ABC/xyz
  • def

Or you can check if an email thread is starred (resolves #11):

(thread is_starred)

Or you can check what the original thread subjectline was (helping, but not resolving issue #17):

(thread first_message_subject /This has no RE: in it/i)

@mlsad3
Copy link
Contributor Author

mlsad3 commented Aug 14, 2022

@ranmocy ,

What are your thoughts on adding a (thread <subtype>) to this, allowing users to match based on thread (not message) details?

(thread is_starred)
(thread first_message_subject /This has no RE: in it/i)

Or do you prefer something like:

(is_starred)
(first_message_subject /This has no RE: in it/i)

@mlsad3 mlsad3 force-pushed the match-on-thread-details branch 4 times, most recently from cb3f192 to bcc6096 Compare August 16, 2022 15:57
Matt Diehl added 2 commits August 18, 2022 18:21
Based on Issue ranmocy#36, allows matching on any header and value.
```
(header X-Custom-Header /value/)
```

As we use `GmailMessage.getHeader` function, the header name
used in the condition must be case-sensitive.

Overall flow:
 - Rules are parsed, and a list of condition-requested-headers is
   created.
 - ThreadData reads in the message data, and all the headers
   that were requested in the rules (we have to pass SessionData
   to ThreadData so it knows which headers to search).
 - Condition.match checks what header to match with, and compares
   the header's value with the rule's value.

In order to get the SessionData.mock.ts to work, SessionData.labels
had to be made public. This seems to be a limitation we will continue
to hit in testing if we want to test on Sheet Apps, since we cannot use
other better libraries.
Create rules that can match an email thread's details.
Thread details include:
 - label
 - is_important
 - is_in_inbox
 - is_in_priority_inbox
 - is_in_spam
 - is_in_trash
 - is_starred
 - is_unread
 - first_message_subject

For example, an email thread may already exist in the labels:
 - ABC
 - ABC/xyz
 - def

When a new email is received that is for the same thread, the following
rule can be used:

(thread label ABC/xyz)

Or you can check if an email thread is marked 'important':

(thread is_important)

Or you can check what the original thread subjectline was:

(thread first_message_subject /This has no RE: in it/i)
@mlsad3 mlsad3 force-pushed the match-on-thread-details branch from bcc6096 to e01bfc7 Compare August 19, 2022 01:27
@jitsu-net
Copy link

@ranmocy ,

This change would be extremely useful to avoid constant pings from congratulatory email threads (perf / promo / etc) – the type where you want to congratulate a teammate, but once you do, the thread can be ignored.

Is there anything @mlsad3 and I can do to help move this along?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mechanism to star message only if thread isn't already starred?

2 participants