Commit graph

484 commits

Author SHA1 Message Date
Scott Nonnenberg
12914307f1 Improve experience when discovering identity key error on send
New experience in the Message Detail view when outgoing identity key
errors happen, matching the Android View.

'View' button is only shown on outgoing key errors right now.

When a contact with an outgoing identity key error is clicked, they are
taken to a view like the popup that comes up on Android: an explanation
of what happened and three options: 'Show Safety Number', 'Send Anyway',
and 'Cancel'

Contacts are now sorted alphabetically, with the set of contacts with
errors coming before the rest.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
b6cca41a0c Update verification-related strings to better match mobile app
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
f654532fa8 Handle UNVERIFIED sync verification messages (via contact sync)
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
20451cc827 Show verified/keychange notifications when actually relevant
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
e91f2d0377 Miscellaneous wire-up to ensure that failures propagate
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
aa83bc1dab Ensure all sessions are archived on profile fetch
If the key has changed, saveIdentity will archive sibling sessions, but not the
session for the device it was called on. Therefore we have to archive that one
by hand.

Also switch from saving the identity of an OutgoingIdentityKeyError to just
triggering a profile fetch, mostly for consistency, simplicity, and DRYness.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
e2ee63efaa m.get('sender') -> m.isIncoming(), filter in getLoadedUnreadCount
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
5b46ef3562 Show last seen indicator for keychange/verification notifications
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
78094102bd Message.send: Add promise to array for consistency
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
4ee4ad80c3 Message.send - check for missing identityKey, also add logging
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
5e62d0cfd8 Update identity key after a send error tells us it has changed
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
22208ec3f8 Fix: Conversation.updateVerified fails when convo not yet in db
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
7bfb66b13b processVerifiedMessage: Archive all sessions when key changes
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
d7054f4b63 Archive sessions whenever an identity key changes
Sessions established with the previous identity should no longer be used for
sending, so we should close them.

Since we've added this call to saveIdentity, we can omit the call to it after
profile fetches.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
0db2ef9e7f Refactor: combine Conversation.setVerified/setVerifiedDefault
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1e8ae774a2 Differentiate between local and remote trust decisions
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3acfda3a56 Archive sessions on key changes after profile fetch
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4f2f622598 Apply special handling to verification sync messages
// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
fc39241003 Ensure that we pull verified state only after getting profiles
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
4a1dc46ab3 Fixes to get local verification and sync messages working
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
c43d96904d Move to the real verify/trust APIs
This wires up verification sync messages, verification and trust checks
to the trust store instead of using mocked data.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
475d607fd0 Prepare for verification sync messages: receiver, ready to send
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
aebf4b32d6 Conversation.updateLastMessage: fix indent, use of null message
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1cf9289b1a Add items to conversation history when user verifies/unverifies
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
a827334c3e Allow re-send of messages in msg detail view on OutgoingKeyError
We also show more errors than we used to in the MessageDetail screen
to help make it clear what is happening, and why the user would need to
re-send.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
8d29cb9830 Prevent access to Safety Number when talking to yourself
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
243cbd8123 Confirmaton on send, banner when 'unverified'
Not yet using the new APIs, but ready to. Still to do:
- Send sync messages on trust decisions
- Respond to received trust decision sync messages
- Show trust decisions in the conversation history
- In that rare situation where a sent message ends up with a key error
  make it easy to retry the send.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
bedf10056b Support for group-member verifications via second-level panel
Also:
- All the necessary wire-up to update things in real time. If you have
a safety number page up via a group member view as well as via a 1:1
conversation with that contact, they'll both be updated as the
underlying model changes. Similarly, the overall group will update
in real-time as members change.
- A bit of special-casing for yourself in a group conversation - you're
shown as 'me' and are not clickable, where normally that would take you
to the Safety Number screen for that contact. You are also not included
in the trust calculations for a given group.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
ee0b0f5ffb Remove all concept of 'key conflict' from the app 2017-08-04 12:03:25 -07:00
lilia
c6bfdec84d Remove blockingApproval
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
f095a1583e Fetch profiles whenever conversations are opened
For a group, fetch everyone's profile.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4e4aedd4ba Pass in non/blockingApproval args to saveIdentity
Multiple cases here:
1. setting our own key on registration
1. changing identities from a safety number change dialog

Note that removeIdentityKey runs before saveIdentity, so we'll always end up
with firstUse: true on our own key.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3ca511a10a Unwrap removeIdentityKey from calls to saveIdentity
saveIdentity is now reponsible for determining firstUse, so we must not remove
the existing key before updating it.

Previously, the implementation provided an extra check against overwritting an
existing key, but that should be done via isTrustedIdentity instead.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
d269751dbc Conversation.markRead: Return a promise so queueJob works
FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
785b117b86 Mark older messages as read when we get out-of-order read receipt
FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
aeefc530d2 Conversation.markRead: Remove checks for unread
We will now always attempt to mark things unread if this method. If the
conversation's unreadCount gets out of date, set to zero, we will still
do it. If we go through the motions, and nothing is newly marked read,
we will still set the unreadCount to zero.
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
6fbdd63e7e Conversation.onReadMessage - queue job, don't send read receipts
We queue the job because we often get a whole lot of read receipts at
once, and their markRead calls could very easily overlap given the async
pull from DB.

We also disable read receipts for any message marked read due to a read
receipt. That's a notification explosion we don't need.

FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
89046484ed Read receipts: Also mark all messages read prior to this one
We mark as read everything older than this message - to clean up old
stuff still marked unread in the database. If the user generally doesn't
read in the desktop app, so the desktop app only gets read receipts, we
can very easily end up with messages never marked as read (our previous
early read receipt handling, read receipts never sent because app was
offline).

FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
6bfeb7ab14 Conversation.sendMessage: Don't set unreadCount to zero
This is no longer guaranteed to be true. If you're scrolled up in a
conversation, you may not have read all messages. Setting the
unreadCount to zero will prevent the user from marking any of their
existing messages as unread until something else happens, like receiving
a read receipt or new message.

FREEBIE
2017-06-07 15:27:27 -07:00
Scott Nonnenberg
fb7e7cf34c TimerView: don't continue to update after expiration
FREEBIE
2017-06-06 15:33:55 -07:00
Scott Nonnenberg
ec22445f75 Bulletproofing of markRead and findNewestVisibleUnread
FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
b60b20bde4 Mark messages read only when visible, on receipt, focus, scroll
- Only mark messages read when scrolling if in focus and visible
- Remove last seen indicator when scrolling to the bottom with scroll
  down button
- Update last seen indicator when we don't already have one and we're
  scrolled up.

FREEBIE
2017-06-01 16:09:27 -07:00
lilia
3dbb21c53c Fix being re-added to a group you previously left
Negate the flag marking the group as left. Fixes #1207.

// FREEBIE
2017-05-30 10:51:07 -07:00
Scott Nonnenberg
10c2874d19 Fix race condition: Pull from database after add to conversation
Also add some console logs to help us determine whether this ever
happens to people in the wild.

FREEBIE
2017-05-26 16:02:14 -07:00
Scott Nonnenberg
3beecce94e fetchConversation: Minimize scans across loaded messages
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
d5d1d58cc2 Exclude Backbone-sourced method from jscs checks
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
3ceb3a049e Override Message.fetch to ensure that db data overrides local
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
2c81539042 A guard to prevent infinite loops in fetching of conversation
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
30b7bf23db Recursively fetch messages until we've loaded all unread
FREEBIE
2017-05-23 11:08:23 -07:00
lilia
80bfe18f02 Mark groups left on synced "You left the group"
When leaving a group on mobile, we sync the group quit message to desktop, but
we weren't marking the conversation left.

// FREEBIE
2017-05-16 15:23:29 -07:00
lilia
8bd7280673 Early read receipts should start expiration timers
Check for early read receipts for an incoming messages *after*
processing the expireTimer on that message. Then we can set
expirationStartTime appropriately if an early receipt is found.

Closes #950

// FREEBIE
2017-05-11 13:47:58 -07:00
lilia
aed5735620 Improve keychange notice reliability/perf
Bind a single listener to keychange events from the storage interface,
which then looks up relevant conversations and adds notices to them,
with tests.

Previously we would need to instantiate a conversation model in order to
start listening to its key change events. In practice this usually
happens at startup but we shouldn't rely on it, and it incurs higher
overhead since it creates a different listener for each conversation.

// FREEBIE
2017-05-09 15:41:41 -07:00
lilia
787c393e1b Log key change advisory creation
// FREEBIE
2017-05-09 15:28:16 -07:00
lilia
8aa2f771a7 Remove self-listener in conversation model
Since there is the only source/listener on this event, it can be called
directly.

// FREEBIE
2017-05-09 15:28:16 -07:00
lilia
510a5cb7fe Namespace global listeners to Whisper 2017-04-12 20:43:16 -07:00
Sam Vevang
ed4991974b set up a new view for displaying the network status
// FREEBIE
2017-04-08 00:10:56 -07:00
lilia
e4b9c51f88 Rework expiring messages management
// FREEBIE
2017-02-22 16:18:01 -08:00
lilia
08e8c00329 Restore setting lastMessage in handleDataMessage 2017-02-22 16:15:27 -08:00
lilia
ace59147ab Reduce unnecessary updates on conversations at startup 2017-02-22 01:22:44 -08:00
lilia
6509646bdb Set expireTimer to null to unset
// FREEBIE
2017-02-22 01:17:20 -08:00
lilia
54b856139a Fix fetchExpiring 2017-02-17 12:10:20 -08:00
lilia
e648a4b095 Revert "Remove unregistered group members"
This reverts commit a768b94471.

d2ddfc7 was enough to fix #989. Removing unregistered members from the
group (as opposed to silently ignorning them) creates greater potential
for getting out of sync with the member lists on other devices.

// FREEBIE
2017-02-16 18:06:20 -08:00
lilia
cd0fe7037b Add replayable error for signed key failure
Disable message sending if signed key updates fail too many times, but
allow the user to retry sending.

// FREEBIE
2017-02-16 18:06:19 -08:00
haffenloher
a768b94471 Remove unregistered group members
Locally remove unregistered users from group membership lists.

Fixes #989
Related to Whispersystems/Signal-Android#6175
Closes #1052

// FREEBIE
2017-02-08 17:13:36 -08:00
haffenloher
04f0142b23 Ignore missing members in incoming group updates
Previously, updateNumbers would throw an Error, so the whole group
update was discarded.

Signal-Android handles this the same way in
GroupMessageProcessor.handleGroupUpdate().

Closes #1056
2017-02-08 16:46:09 -08:00
Thomas Guillet
400313f749 Prevent expiration timer update on group update
It occurs when a message with a different expiration time is received.

The issue report highlights the scenario of a member leaving a group
(group update [quit] sent with expiration time = 0).

Fix https://github.com/WhisperSystems/Signal-Android/issues/5996
Fix https://github.com/WhisperSystems/Signal-iOS/issues/1566
2017-01-25 20:40:25 -08:00
lilia
9ef61d43f4 Update conversation lastMessage from database
Don't set lastMessage, let it update itself as needed, such as when
first rendering a conversation list item, and when its messages are
sent, received, or destroyed.
2017-01-25 20:40:25 -08:00
lilia
6253269d19 Tweak key change advisory insertion
Let received_at be the current time for keychanges. This avoids them
being inserted in the wrong place in the thread.

Use the newmessage event to trigger frontend listeners to add them to
the conversation view if it is open.
2017-01-25 20:40:25 -08:00
lilia
a623f909f2 Move key change advisory content to the model
Return this content from a helper method so it can be used to populate
the last message on conversations.
2017-01-25 20:40:25 -08:00
lilia
d2c1e6df27 Fix wrong variable name
Fix potentially setting expiration timeouts more than once.
2017-01-25 20:40:24 -08:00
lilia
d7f241ddee Use correct type on timer updates 2017-01-25 20:40:24 -08:00
lilia
05ed7c3822 Merge timer update functions 2017-01-25 20:40:24 -08:00
lilia
0854b19371 Revert "Don't load group contacts unnecessarily"
This reverts commit 6699571910.

Not quite ready for primetime.
2016-11-16 22:25:36 +01:00
lilia
6699571910 Don't load group contacts unnecessarily
There are some cases when we want to initialize a group object without
loading its contacts, such as while processing delivery receipts. We
really only need to load the contacts for a group/convo when we are
rendering it, so let the front end handle those cases (which most of
them do already).
2016-11-16 13:33:04 +01:00
lilia
03c5d12edd Fix necrobumping convos on key change
When inserting key change advisories, use the current conversation
timestamp to avoid pushing lots of old groups to the top of the
conversation list.
2016-10-12 11:34:49 +09:00
lilia
f8a3ae158c Remove log message 2016-10-06 18:18:54 +09:00
lilia
d3a2f5c838 Ignore expireTimer on session reset messages 2016-10-05 22:32:40 +09:00
lilia
4ee2652367 Fix wrong contact in some timer updates
Mistakenly showed 'You' for timer updates inferred from incoming
messages.
2016-10-05 22:31:30 +09:00
lilia
7fe708d195 Insert keychange advisories
On click, these open a verification panel for the relevant contact,
within this conversation.

// FREEBIE
2016-10-05 19:11:39 +09:00
lilia
009098f8dd Insert inferred timer updates before the corresponding message 2016-10-05 19:09:21 +09:00
lilia
a12569e356 Fix destination on synced timer updates 2016-10-05 19:09:20 +09:00
lilia
56aee5e8ef Update conversation snippets automatically
Fixes stale snippets after the message has expired
2016-10-05 19:09:20 +09:00
lilia
8d16bfb65e Populate conversation snippet for timer updates 2016-09-29 16:17:01 -07:00
lilia
e488c19889 Do not trigger notifications for timer updates 2016-09-29 16:17:01 -07:00
lilia
7a26cf79ee Insert timer update messages when inferring timer changes 2016-09-29 16:17:01 -07:00
lilia
ad2174e279 Sync expirationStartTimestamp on outgoing messages
Linked devices need to know when to start the clock.
2016-09-29 16:17:01 -07:00
lilia
6074a29046 Send timer update messages when changing the timer 2016-09-29 16:17:01 -07:00
lilia
824b7417e9 Apply expireTimer to outgoing messages 2016-09-29 16:17:01 -07:00
lilia
2b2c6ab040 Frontend for timer updates and timer indicator 2016-09-29 16:17:01 -07:00
lilia
4cd2c03687 Add clock svg style 2016-09-28 17:20:03 -07:00
lilia
7331d967d2 Add support for expiration timer updates messages 2016-09-28 17:20:03 -07:00
lilia
5f92ccd524 Render animated hourglass when messages are expiring 2016-09-28 17:20:02 -07:00
lilia
1383dc141f Ensure that expired messages are removed from the frontend 2016-09-28 17:20:02 -07:00
lilia
02ea4f2475 Use read receipt envelope to infer startExpirationTime
Avoids display of phantom messages that are only received and marked
read locally long after they have expired on another linked device.
2016-09-28 17:20:02 -07:00
lilia
96fd017890 Support for incoming expiring messages
When initialized, or when expiration-related attributes change, expiring
messages will set timers to self-destruct. On self-destruct they trigger
'expired' events so that frontend listeners can clean up any collections
and views referencing them.

At startup, load all messages pending expiration so they can start their
timers even if they haven't been loaded in the frontend yet.

Todo: Remove expired conversation snippets from the left pane.
2016-09-28 17:20:02 -07:00
lilia
edd6f58539 Update display when contact colors change
// FREEBIE
2016-09-12 11:44:52 -07:00
lilia
f610233ef6 Add support for syncing blocked numbers
// FREEBIE
2016-09-07 13:04:45 -07:00
lilia
53f20640af Add support for syncing colors
// FREEBIE
2016-09-07 13:04:45 -07:00
lilia
7b9894d688 Refactor css to support theming
Move away from inline style attributes for setting contact colors.
Apply colors by name via css classes instead. Also lays groundwork
for syncing contact colors.

// FREEBIE
2016-08-30 18:31:02 -07:00
lilia
e07616e2ef Only create notifications for unread messages
In some cases, we have already received a read receipt for an incoming
message by the time we go to create a notification about it. In this
case, we should skip the notification.

// FREEBIE
2016-08-04 15:34:27 -07:00
lilia
8939c61c7c Log on notification removal
// FREEBIE
2016-08-01 20:19:16 -07:00
lilia
7caecc564d Process all incoming conflicts before outgoing ones
Fixes a session management problem where, after resolving a conflict
with some contact, that contact would get bad mac as a result of us
sending them a new prekey message before processing a pending conflicted
prekey message received from them earlier.

Fixes #806

// FREEBIE
2016-05-26 18:11:17 -07:00
lilia
148bd32671 Update libsignal-protocol v0.10.0
* Changes policy for old session deletion
* Renames putIdentityKey to saveIdentity
* Remove device messages

// FREEBIE
2016-05-18 11:11:11 -07:00
2-4601
b9ecdbf402 i18n 'Error handling incoming message'
// FREEBIE
2016-05-05 12:54:15 -07:00
2-4601
60fe1e2cea i18n 'Received message with unknown identity key'
// FREEBIE
2016-05-05 12:54:14 -07:00
2-4601
52992a8f12 i18n 'Secure session ended'
// FREEBIE
2016-05-05 12:54:14 -07:00
lilia
1d60dc38fb Rename axolotl storage
// FREEBIE
2016-04-22 13:43:30 -07:00
lilia
dd7d72a77d i18n 'Media message'
Fixes #736

// FREEBIE
2016-04-18 19:15:36 -07:00
lilia
172d843368 Always update lastMessage on incoming messages
Fixes #742

// FREEBIE
2016-04-18 19:15:35 -07:00
lilia
0cd7f84a05 Refactor read state tracking
Adds support for handling early arriving read receipts.

// FREEBIE
2016-04-14 11:57:52 -07:00
lilia
d1e9534542 Refactor delivery receipt tracking
Move code for matching receipts to messages (and vice versa) to its own
file.

// FREEBIE
2016-04-13 13:57:56 -07:00
lilia
18012688ea Log unread message timestamps
// FREEBIE
2016-04-13 13:57:55 -07:00
lilia
0f4f00ff4e Fix read sync on duplicate messages
In the case of a double send (same message encrypted and sent twice due
to key conflict bug), we would mark the first instance read twice rather
than marking both instances read. Fix by searching for matching messages
that have not yet been marked read.

// FREEBIE
2016-04-04 16:14:15 -07:00
lilia
07a0463b65 Fix conversation list self-resorting
When deleting all messages in a conversation, the entry in the left pane
should be inserted into the alphabetical portion of the list. To keep it
in this collection, do not nullify active_at.

To ensure the list view is keeping itself correctly sorted, make sure
that resorting behavior is triggered any time a relevant attribute is
changed.

This fixes deleted conversations jumping to the top of the list, and
conversation order scrambling when getting a group or contact sync
message from our master device.

Fixes #734

// FREEBIE
2016-03-25 14:32:57 -07:00
lilia
3901bcb8df Style resend button as an inline link
For messages that failed to send due to network errors, this change
allows retrying them directly from the main conversation view rather
than only from the message detail view.

// FREEBIE
2016-03-22 15:38:22 -07:00
lilia
234f937bc7 Conversation subscreens share a header
// FREEBIE
2016-03-21 15:37:53 -07:00
lilia
c8aa2246dc Let groups have blue headers
// FREEBIE
2016-03-21 13:02:34 -07:00
lilia
18a5ce8e54 Restyle conversation panel
// FREEBIE
2016-03-18 13:09:45 -07:00
lilia
8b3596b956 Delete last timestamp on a convo when deleting messages
// FREEBIE
2016-03-18 11:21:11 -07:00
lilia
6f3f33657a Don't mark read on sync messages
There's no longer a need for this since we have read-state syncing.

// FREEBIE
2016-03-18 11:20:52 -07:00
lilia
762cb68721 Serialize sending and adding messages to a convo
Previously, if a message was sent in between the receive time of an
incoming message and the time it is actually added to the conversation's
message collection (which only occurs later after several async
callbacks), the incoming message would be inserted not-at-the-end of the
collection since it is ordered by receive time. This tricked the front
end into assuming the message was an older message instead of a new one.

Fixes #490

// FREEBIE
2016-03-17 15:41:01 -07:00
lilia
f9a3c7817e DRY up early receipt processing
// FREEBIE
2016-03-17 15:39:28 -07:00
lilia
67900753d1 Log sending read receipts
// FREEBIE
2016-03-14 16:26:22 -07:00
lilia
0763cf14a3 Remove messages from notifications when read
Remove individual messages from Notifications when marked read.
Previously this was only done from the conversation model when marking
the entire conversation as read.

Fixes #717

// FREEBIE
2016-03-08 12:03:16 -08:00
lilia
2b7cbef8b1 Rename a function
Avoid confusing this operation with actual receipts, which are something
else.

// FREEBIE
2016-02-26 12:41:29 -08:00
lilia
b77d5df4f2 Fix markRead when messages have not been loaded yet
Query the database and not just the in-memory messages.

// FREEBIE
2016-02-26 12:36:14 -08:00
lilia
01053335ac Don't send empty read status reports
// FREEBIE
2016-02-26 12:28:14 -08:00
lilia
f88b33a135 Fix unread message lookup in markRead
// FREEBIE
2016-02-26 12:27:44 -08:00
lilia
c4a88dd651 Fix getUnread query
Booleans are not valid keys in indexeddb.
https://www.w3.org/TR/IndexedDB/#dfn-valid-key

// FREEBIE
2016-02-26 12:25:56 -08:00
lilia
2e30c4388f Set destination on end session messages for syncing
// FREEBIE
2016-02-24 23:10:16 -08:00
lilia
e91f646920 Fix initial post-sync timestamps
Fixes #669

// FREEBIE
2016-02-24 17:11:59 -08:00
lilia
71467822f6 Clear key conflict before replaying it
Don't save the change until we successfully process the message, but
make it first so that the user sees the error disappear when the new key
is accepted.

// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
1f897f32b7 Track and sync unread messages
// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
ecf2885a6c Do post-send tasks when resolving conflicts
Fixes #684

// FREEBIE
2016-02-22 17:11:16 -08:00
lilia
731052ad0a Clear old key conflict errors after failed replay
If the replay failed due to a bad mac or other decryption error for some
other reason we still want to clear the conflict. If it failed because
it's still in conflict then the newly returned error will reflect that
and be saved.

// FREEBIE
2016-02-22 17:11:16 -08:00
lilia
7e8ce5eb54 Omit left groups from search
Unless they contain messages.

// FREEBIE
2016-02-22 17:11:16 -08:00
lilia
010297f4c5 Track groups I've left
// FREEBIE
2016-02-22 17:11:16 -08:00
lilia
173e037fa6 Fix minor style errors
And keep it that way, by making jscs config more opinionated.

// FREEBIE
2016-02-18 13:45:22 -08:00
lilia
b602533084 Serialize calls to sendSyncMessage
Fixes #679

// FREEBIE
2016-02-16 17:46:20 -08:00
lilia
7e82d1295c Handle attachment upload errors
Adds a new kind of replayable error that handles retry of pre-encryption
failures, e.g., attachment upload.

Fixes #485

// FREEBIE
2016-02-09 13:21:32 -08:00
lilia
137b992f87 Fix "Delete Messages" not deleting all messages
Since the introduction of infinite scroll, the delete messages function
has only deleted the currently loaded set of messages in a conversation.
To fix this, we should fetch all the messages and then delete them.

Fixes #645

// FREEBIE
2016-01-27 15:06:16 -08:00
lilia
b2bed9c51c Fix display of empty group updates
Group updates in which nothing change should still display 'Updated the
group'. Previously they would display as empty message bubbles. Fixed by
ensuring that the 'group_update' attribute is set on the model, even if
it is an empty object.

// FREEBIE
2016-01-12 10:44:52 -08:00
Karel Bilek
557d33bf88 Fixing upper bounds on contact search (fixes #545) 2016-01-02 04:23:21 -08:00
lilia
1d6e391dd6 Prefer single quotes
// FREEBIE
2016-01-02 02:51:25 -08:00
lilia
bc576e18d5 Fix no delivery receipts on close session messages
// FREEBIE
2015-12-11 12:06:45 -08:00
lilia
dabe51fd68 Mark message sent iff at least 1 recipient got it
Previously, we would always mark a message sent even if all our network
requests failed.

Fix #484

// FREEBIE
2015-12-10 16:21:21 -08:00
lilia
63135a2337 Fix race between sync messages and receipts
Previously, when processing a backlog of sync messages and their
delivery receipts, we would fail to mark some messages as delivered even
though we got a receipt. This was due to an async race condition between
saving a sync message and fetching it after the receipt arrives.

Fix by re-ordering idb requests such that we save the message first and
fetch it after.

Fixes #479

// FREEBIE
2015-12-10 10:36:15 -08:00
lilia
720032bb8e Remove id from search tokens
Instead, just strip the leading + from search queries that look like
numbers.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
a258f1a66b Refactor number parsing and validation
Refactor libphonenumber.validateNumber into libphonenumber.parseNumber,
which encapsulates the try-catch pattern used in number parsing and
returns an object of info about the input number rather tha throwing
since we expect to get some invalid number inputs the user is typing.

In the conversation model,
  * Separate phone number validation from search token updating.
  * Perform token update before save if the number was valid.
  * Stop storing unneeded number variants as conversation properties.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
65c13adf5e Fix searching for numbers with parens or dashes
Strip some punctuation from search queries

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
af64784d64 Let search match on full e164 format numbers
// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
0b7742ecd7 Create contact by number with no country code or +
Search box finds or creates a conversation given a phone number in
local (to the user's region) or international format.

Previously you had to enter e164 format to set up the conversation
correctly.

If the number is not valid, do not open the conversation.

TODO: user feedback on invalid numbers.

// FREEBIE
2015-12-09 18:58:50 -08:00
lilia
0b95606eff Display nicely formatted phone numbers
In conversation headers and as titles for contacts with no name. Updated
tests accordingly.

// FREEBIE
2015-12-09 18:58:50 -08:00
lilia
0620f08a7c Save single errors returned from send functions
// FREEBIE
2015-12-04 12:02:19 -08:00
lilia
2f469835d9 Handle group quit sync messages
Previously, we would incorrectly reject group updates originating from a
linked device instructing us to remove ourselves from the group.

// FREEBIE
2015-12-04 11:25:19 -08:00
Georg Semmler
1a6cedac56 Fix #402
Remove messages which are read from the notification
2015-12-01 13:31:02 -08:00
lilia
7bf94c33d5 Show all contacts when inbox is empty 2015-11-27 22:26:55 -08:00
lilia
07702c4ee5 Let the application layer send sync messages
Previously, libtextsecure would send a sync message automatically
when appropriate. This fails if any recipient has a key conflict
or if our network connection fails mid-send.

Instead, when appropriate, return a the DataMessage encoded as an array
buffer for later syncing. This lets the application choose when to send
it, which we now do after any successful send to a recipient, rather
than after all recipients are successfully sent to.

Eventually we should move the DataMessage protobuf construction and
group sending logic to the application layer entirely, in which case
we wouldn't need libtextsecure to construct the sync message either.

Fixes #408
2015-11-24 17:11:03 -08:00
lilia
5c37c3d6ce Change return type from sending messages
Pass the whole result from the outgoing message callback on to the
caller, and preserve the names of the members.

// FREEBIE
2015-11-24 17:05:25 -08:00
lilia
4615e730ca Save ReferenceErrors on messages
// FREEBIE
2015-11-17 16:22:30 -08:00
lilia
2861fa26a7 Implement infinite scrolling message lists
Only load the most recent messages when initially rendering a
conversation. Scrolling to the top of a message list loads older
messages.

This required some slight refactoring of how we insert message elements
into the dom. If the message is added to the end of the collection,
append it at the end. Otherwise, assume it is an older message and
prepend it.

When adding elements to the top, reset the scrollPosition to its
previous distance from scrollHeight. This keeps the current set of
elements fixed in the viewport.

// FREEBIE
2015-11-15 14:56:58 -08:00
lilia
b59b702eb3 Clear the lastMessage when deleting a conversation
Leave no trace. Fixes #397.

// FREEBIE
2015-11-08 11:14:21 -08:00
lilia
a569e34b33 Refactor new message notification and frontend updates
Create a cleaner seperation between generating notifications
and updating frontend conversation views. The former is now
handled by `conversation.notify` while the latter is achieved
by triggering an event on the conversation model, which will
only be acted on if there are any views listening for it.

Additionally, instead of re-fetching the entire message history,
which is overkill, just add or update the new/modified message.
This will help speed up the newmessage event handler and also
help avoid unnecessary re-rendering when resolving key conflicts.

// FREEBIE
2015-11-07 14:11:13 -08:00
lilia
4136e3633c Fix incoming key conflict behaviors
Follow up to ddd2e67eb5
but for incoming messages.

* Conflict state sometimes failed to be removed even though the
  conflict was resolved.
* Messages failed to re-render after a conflict. We want to
  re-render only the error state on outgoing messages, to avoid
  flickering attachments. On incoming messages, we need to call
  render to populate the message text, avatar, etc...

// FREEBIE
2015-11-06 17:50:43 -08:00
lilia
9c8933c3d0 Resolve conflicts one at a time
Previously, with a mix of text and media messages in conflict,
asynchronous callbacks aligned so as to fail to remove some of
the conflict objects on messages.

Fix by serializing conflict processing, but making sure to move
on through the message list even if some conflict resolutions fail.

Fixes #370

// FREEBIE
2015-11-05 19:42:55 -08:00
lilia
4c4b875348 Fix displaying contact names as 'Unknown Group'
// FREEBIE
2015-11-05 16:30:36 -08:00
lilia
c64fe8410e Convo list shows 'Media message' when appropriate
// FREEBIE
2015-11-02 16:50:46 -08:00
lilia
503509fc8f Fix blank lastMessage for non-text messages
For non text messages (ex: media messages and group updates), the
lastMessage field was being populated with empty string, resulting in an
empty message preview in the conversation list. Instead, display 'Media
message' or 'Updated the group', etc...

// FREEBIE
2015-11-02 16:27:42 -08:00
lilia
c77391b3f2 Sinewave animation for pending requests
Tryin it on for size.

// FREEBIE
2015-10-28 13:57:32 -07:00
lilia
e68b84ad9a Fix saving TypeErrors
// FREEBIE
2015-10-22 10:12:34 -07:00
lilia
ee393bfa03 Ensure that tokens get updated on initial save
// FREEBIE
2015-10-16 13:01:14 -07:00
lilia
82ce76265d Remove stray log statement
// FREEBIE
2015-10-16 12:32:06 -07:00
lilia
f70c22f898 Add search field to inbox
Using the search field produces a filtered view of all contacts and
groups containing the input. To make this fast and scalable, add an
index on a 'tokens' array containing words from the conversation name
and different forms of phone number.

Closes #365

// FREEBIE
2015-10-15 13:33:07 -07:00
lilia
a32f3ff1f6 More work on replayable errors
Expose a button that does that retries outgoing messages if possible.

// FREEBIE
2015-10-02 18:31:07 -07:00
lilia
7ec4700431 Handle saving errors when none exist already
// FREEBIE
2015-10-02 12:35:28 -07:00
lilia
ae25d62ef2 Fix up post-conflict resolution error processing
// FREEBIE
2015-10-02 12:14:34 -07:00
lilia
fbb65d1988 Add replayable network errors
Support for manual message retry.

// FREEBIE
2015-10-01 18:43:20 -07:00
lilia
19423bf909 Abstract message error handling
// FREEBIE
2015-10-01 18:21:20 -07:00
lilia
569d0655fa Fix test failure
// FREEBIE
2015-09-30 19:32:25 -07:00
lilia
876e11c19b Fix sync messages not getting displayed on arrival
// FREEBIE
2015-09-30 17:52:13 -07:00
lilia
7d6adc4879 Save outgoing error codes when messages fail
// FREEBIE
2015-09-30 17:13:59 -07:00
lilia
a802322d44 Display a default message for incoming message errors
An exception to the previous commit, for incoming messages we should not
show a mysterious empty bubble. Instead there is some generic
non-technical error message.

// FREEBIE
2015-09-30 15:24:34 -07:00
lilia
929c16090b Move error messages to message detail view
Change how message errors are rendered. Errors associated with a number
will be shown under that number in the detail view rather than piling up
in the message bubble.

// FREEBIE
2015-09-30 14:27:18 -07:00
lilia
c1b9f3235f Save all errors
But clean up objects created by the Error constructor, as they contain
non-serializable properties, like functions.

// FREEBIE
2015-09-30 14:22:07 -07:00
lilia
04c5f83485 Un-nest libtextsecure errors
Fix inconsistency in error format, where we sometimes get an unexpected
Error object and sometimes get a wrapper object containing an Error.

Also start saving network errors.

// FREEBIE
2015-09-30 12:44:11 -07:00
lilia
8453424ebd Fix stuck pending messages state
Refactor outgoing message error handling to use the same success and
error handlers. This creates a somewhat strange pattern, where we call
send and pass in the promise that resolves when sending is complete, but
there's enough variety in the libtextsecure syntax for different message
sending routines that it belongs at the conversation level and only the
post-processing stuff is really shared by all messages.

// FREEBIE
2015-09-28 13:33:26 -07:00
lilia
9ff95c7e61 DRY up group update sending
// FREEBIE
2015-09-23 16:45:07 -07:00
lilia
f6b35ffbfc Log error stack traces
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
213dbdefd2 Reorder functions
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
d1191c509c Log outgoing errors individually
// FREEBIE
2015-09-21 11:48:57 -07:00
lilia
ada3d999e0 Log outgoing errors
// FREEBIE
2015-09-21 11:02:33 -07:00
lilia
d8803ee31f Mark leave group messages as sent
// FREEBIE
2015-09-21 10:32:33 -07:00
lilia
6364cda7cb Create requires an object
// FREEBIE
2015-09-17 11:42:59 -07:00
lilia
b617240338 Stop calling updateInbox all the time
Now that the inbox collection keeps itself in sync, we don't have the
data duplication that was forcing us to reload constantly.

// FREEBIE
2015-09-17 10:57:17 -07:00
lilia
2bc65c2ab4 Let messages fetch references to senders
The conversation's contactCollection only contains references to the
current membership, and will not provide contact info for people who
have left the group, causing their messages to render without numbers or
avatars.

// FREEBIE
2015-09-16 22:15:47 -07:00
lilia
4b0c70fb44 Resolve multiple conflicts independently
When resolving multiple conflicts in a conversation, failure to resolve
one should not block any others.

// FREEBIE
2015-09-15 11:12:47 -07:00
lilia
80764bf494 Remove unused function
// FREEBIE
2015-09-14 16:56:01 -07:00
lilia
1a30d003f5 Fetch group contacts before fetching new messages
Messages must wait for sender info to arrive before rendering.

// FREEBIE
2015-09-14 13:49:09 -07:00
lilia
e8edbe53bc Improve notification behavior
Only allow one notification at a time. Use a basic notification for
normal messages, and image notification for image messages, and a list
notification when there are multiple unread messages.

// FREEBIE
2015-09-14 11:12:08 -07:00
lilia
59313b5177 Let message models manage blob urls for attachments
// FREEBIE
2015-09-13 19:42:49 -07:00