Commit graph

16 commits

Author SHA1 Message Date
Daniel Gasienica
f36f206a01 Use IndexablePresence for hasFileAttachments and hasVisualMediaAttachments
Reduces index size, makes it easier to debug using IndexedDB inspector, and
hopefully improves lookup performance.
2018-04-25 15:25:12 -04:00
Daniel Gasienica
fca8de16c8 Add required Message.id: string 2018-04-25 15:24:52 -04:00
Daniel Gasienica
8b9516de72 Update test for attachment metadata 2018-04-25 15:24:52 -04:00
Daniel Gasienica
45d89d1e44 Create UserMessage type
Describes user visible messages that can have attachments.
2018-04-25 15:24:51 -04:00
Daniel Gasienica
648a7ab1bb Autoformat using Prettier 2018-04-25 15:24:51 -04:00
Daniel Gasienica
9d84b2f420 Index messages with attachments using a boolean
When indexing message attachment metadata using numeric indexes such as:

```javascript
{
  conversationId: '+12223334455',
  received_at: 123,
  attachments: […],
  numAttachments: 2,
},
{
  conversationId: '+12223334455',
  received_at: 456,
  attachments: [],
  numAttachments: 0,
}
{
  conversationId: '+12223334455',
  received_at: 789,
  attachments: [],
  numAttachments: 1,
}
```

It creates an index as follows:

```
[conversationId, received_at, numAttachments]
['+12223334455', 123, 2]
['+12223334455', 456, 0]
['+12223334455', 789, 1]
```

This means a query such as…

```
lowerBound: ['+12223334455', 0,                1               ]
upperBound: ['+12223334455', Number.MAX_VALUE, Number.MAX_VALUE]
```

…will return all three original entries because they span the `received_at`
from `0` through `Number.MAX_VALUE`. One workaround is to index booleans using
`1 | undefined` where `1` is included in the index and `undefined` is not, but
that way we lose the ability to query for the `false` value. Instead, we flip
adjust the index to `[conversationId, hasAttachments, received_at]` and can
then query messages with attachments using

```
[conversationId, 1 /* hasAttachments */, 0                /* received_at */]
[conversationId, 1 /* hasAttachments */, Number.MAX_VALUE /* received_at */]
```
2018-04-25 15:24:51 -04:00
Daniel Gasienica
b0fefdbb98 Implementing grouping messages by date 2018-04-25 15:24:51 -04:00
Daniel Gasienica
424965f876 🎨 Autoformat code 2018-04-25 15:24:51 -04:00
Daniel Gasienica
3d70e46aea Calculate dates in UTC 2018-04-25 15:24:51 -04:00
Daniel Gasienica
e34347f290 Add groupMessagesByDate 2018-04-25 15:24:51 -04:00
Daniel Gasienica
94ef3bab80 Move test file 2018-04-25 15:24:50 -04:00
Daniel Gasienica
44debd123d Add basic implementation of Conversation.updateFromLastMessage 2018-04-11 19:34:21 -04:00
Daniel Gasienica
55fc21505e Rename ts/test to ts/styleguide 2018-04-11 16:36:42 -04:00
Scott Nonnenberg
96bd90a4e0
Simplify assignment; add warning to preload.js about Style Guide 2018-04-05 17:16:15 -07:00
Scott Nonnenberg
05303233fb
window.Signal.React -> window.Signal.Components 2018-04-05 16:10:59 -07:00
Scott Nonnenberg
23537546fe
Big refactor: ts/ directory for all typescript, including react
Split out test-specific and general utility react components too.

And moved our test/legacy* files for the Style Guide into a styleguide/
subdirectory of test/.

I think we'll be able to live in this directory structure for a while.
2018-04-05 15:30:40 -07:00