Commit Graph

13 Commits

Author SHA1 Message Date
Audric Ackermann d43d6abbae chore: replace tslint with eslint and fix linting issues 2023-07-26 11:26:46 +02:00
Audric Ackermann a9cc9a7294
add tests for attachment metadata 2022-04-07 14:47:54 +10:00
Audric Ackermann 00d2bbc63d
cleanup MessageSearchResults 2022-02-03 10:58:42 +11:00
Audric Ackermann f7581cf4eb
increase prettier maxWidth to 100 2021-04-22 18:03:58 +10:00
Audric Ackermann 979a9058e3
remove verified number - related features (partial) 2021-01-18 10:35:16 +11:00
Daniel Gasienica 16bc1d34c6 Message schema 6: Change classification of media and documents
For an easier implementation, we change our original definition of
`initializeAttachmentMetadata`. This means we have to re-run it marked as
version 6 and mark schema version 5 as deprecated as its definition has changed.
2018-05-08 16:41:07 -04:00
Daniel Gasienica 87d374ea78 Remove `@prettier` pragmas 2018-04-30 16:53:34 -04:00
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 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 ae4c74dd5b Skip metadata initialization for `verified-change` messages 2018-04-25 15:24:51 -04:00
Daniel Gasienica 424965f876 🎨 Autoformat code 2018-04-25 15:24:51 -04:00
Daniel Gasienica 867bece952 Add `Message.initializeAttachmentMetadata` 2018-04-25 15:24:50 -04:00