You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/js/modules
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 */]
```
8 years ago
..
migrations Index messages with attachments using a boolean 8 years ago
types Index messages with attachments using a boolean 8 years ago
views Remove type annotation 8 years ago
.eslintrc Auto-fixes: UX Improvements (#2077) 8 years ago
auto_orient_image.js Auto-orient image attachments based on EXIF metadata 8 years ago
backup.js Responding to pull request review feedback 8 years ago
crypto.js Encryption support for backup and restore 8 years ago
database.js Use single quotes for identifiers 8 years ago
debug.js Use single quotes for identifiers 8 years ago
debuglogs.js Document workaround for `got` `FormData` bug 8 years ago
deferred_to_promise.js Extract `deferredToPromise` 8 years ago
global_errors.js Rename `Errors` to `GlobalErrors` for clarity 8 years ago
i18n.js Remove 'use strict' from i18n.js 8 years ago
idle_detector.js Replace startup with attachment background migration 8 years ago
link_text.d.ts Fork `link-text` module 8 years ago
link_text.js ESLint auto-fix `link_text` 8 years ago
logs.js Refactor: db tasks to database.js, log delete to modules/logs.js 8 years ago
messages_data_migrator.js Use single quotes for identifiers 8 years ago
os.js Add `OS` module 8 years ago
privacy.js Use single quotes for identifiers 8 years ago
settings.js Use single quotes for identifiers 8 years ago
sleep.js Add `sleep` module 8 years ago
startup.js Use single quotes for identifiers 8 years ago
string_to_array_buffer.js Use single quotes for identifiers 8 years ago