Skip to content
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

Merge messages and threads #1 #3583

Merged
merged 5 commits into from
Jan 23, 2024
Merged

Merge messages and threads #1 #3583

merged 5 commits into from
Jan 23, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Jan 22, 2024

Context

This PR introduces a new MessageChannelMessage table. This table represents the link between a message and a channel. Meaning we can have the same message imported by different channels and we will only store 1 message, this new table will be there to map the relation. Because of this, we had to introduce some merging strategies. This PR handles a few edges cases but it still need to be tested.

Details

Message has already been imported and has been matched with messageHeaderId
1.1) Message has the same threadExternalId
=> We only create a new row in MessageChannelMessage using the info from gmail and the existing message.
1.2) Message has a different threadExternalId. Meaning it was imported through a different Channel. We need to merge.

Message does not exist but we can find a thread with threadExternalId
=> We create a message and messageChannelMessage

Message does not exist and we can't find a matching thread.
=> We create a new thread.

Note: I've removed the sanitising of empty threads. Also we will need to delete messages that don't have an entry in messageChannelMessage. We will add it back in an upcoming PR with probably a dedicated job.

@Weiko Weiko force-pushed the c--merge-messages-and-threads branch from 3a153cc to dbde765 Compare January 23, 2024 15:58
@Weiko Weiko marked this pull request as ready for review January 23, 2024 16:04
@Weiko Weiko changed the title Merge messages and threads Merge messages and threads #1 Jan 23, 2024
@Weiko Weiko enabled auto-merge (squash) January 23, 2024 16:18
@Weiko Weiko disabled auto-merge January 23, 2024 16:27
@Weiko Weiko merged commit dc7fccb into main Jan 23, 2024
13 checks passed
@Weiko Weiko deleted the c--merge-messages-and-threads branch January 23, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants