[local-sync, cloud-api] Add logic to handle thread metadata

Summary:
[cloud-api]
Based on the passed in `messageIds`, it finds any existing thread
metadata that might be under a different thread id. If it realizes
there are actually multiple threads that should be the same thread,
(due to getting a missing message link), it reconciles all of them.

[local-sync]
Return `message_ids` in `Thread.toJSON()`

See D3879 for tests

N1 Pairing: D3875

Test Plan: unit tests, local testing soon

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3880
This commit is contained in:
Halla Moore 2017-02-10 13:37:11 -08:00
parent 1e74be3b94
commit 8287f4116f

View file

@ -198,6 +198,7 @@ module.exports = (sequelize, Sequelize) => {
const response = {
id: `${this.id}`,
object: 'thread',
message_ids: this.messages.map(m => m.id),
folders: this.folders.map(f => f.toJSON()),
labels: this.labels.map(l => l.toJSON()),
account_id: this.accountId,