Commit graph

326 commits

Author SHA1 Message Date
Danila Fedorin
fa985f8f16 Blurb isn't really the right word. 2021-08-04 09:30:02 -07:00
Danila Fedorin
611c6e9717 Move replying code into reply.js and add license 2021-08-04 09:26:26 -07:00
Bruno Windels
0dc5041f47 WIP 2021-08-04 15:23:03 +02:00
Danila Fedorin
8956f6ecf4 Fuse methods and properties related to replies 2021-08-03 13:10:36 -07:00
Danila Fedorin
e2ad589aa3 Go through and clean up affected files. 2021-07-27 16:51:34 -07:00
Danila Fedorin
3d911f2a22 Add escaping to replies 2021-07-26 14:49:06 -07:00
Danila Fedorin
305fab467e Send a formatted body from quotes 2021-07-23 16:45:22 -07:00
Danila Fedorin
0db6870edb Flesh out the fallback formatting a bit. 2021-07-23 16:37:23 -07:00
Danila Fedorin
c0d39a5983 Add very rudimentary fallback reply formatting code 2021-07-23 15:34:04 -07:00
Danila Fedorin
242a9c209b Handle replies in EventEntry 2021-07-23 14:34:11 -07:00
Danila Fedorin
46215b3c51 Add the ability to reply 2021-07-20 12:53:31 -07:00
Danila Fedorin
800b4785d1 Accomodate in_reply_to relation shape 2021-07-20 12:17:44 -07:00
RMidhunSuresh
2502c4024a Fix broken tests
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
RMidhunSuresh
8a976ef24b Make powerLevels observable
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
RMidhunSuresh
f7a6fbd901 Make getUserLevel() public
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-07-16 17:08:18 +05:30
Bruno Windels
575f3fa966 fix tests 2021-06-24 14:28:10 +02:00
Bruno Windels
299294daff prevent re(d)action in left/kicked room 2021-06-24 14:24:22 +02:00
Bruno Windels
061f44f475 extract methods here 2021-06-24 12:56:23 +02:00
Bruno Windels
a4a7c23148 use pending re(d)action timestamp to have stable reaction sorting order
also move more logic into the matrix layer, from Reaction(s)ViewModel
to PendingAnnotation
2021-06-24 12:26:38 +02:00
Bruno Windels
e125599a47 prevent decryption result getting lost after reaction updates entry 2021-06-23 17:38:52 +02:00
Bruno Windels
0e750db9ae write unit tests for (re)aggregating annotations in RelationWriter 2021-06-21 18:16:21 +02:00
Bruno Windels
d1345d0f83 write test for redaction in RelationWriter 2021-06-21 17:52:02 +02:00
Bruno Windels
11fba12083 add tests for remote reaction target being added after pending event 2021-06-18 15:09:14 +02:00
Bruno Windels
0703cf8915 cleanup 2021-06-18 15:06:49 +02:00
Bruno Windels
5bea8130f2 more timeline annotation tests 2021-06-18 14:39:54 +02:00
Bruno Windels
9f99cf4b1e fix lint in tests 2021-06-18 11:52:09 +02:00
Bruno Windels
8092713faa add tests for local echo of adding and removing reaction 2021-06-18 11:51:02 +02:00
Bruno Windels
70d64f38eb spelling 2021-06-17 16:07:32 +02:00
Bruno Windels
cad884aa41 fix local redaction echo while already sending target 2021-06-17 16:07:09 +02:00
Bruno Windels
a77ef02677 cleanup 2021-06-17 10:12:45 +02:00
Bruno Windels
cbee498d41 a bit more brief 2021-06-17 10:03:32 +02:00
Bruno Windels
bf84b59e39 more accurate test name and also test >= 2021-06-17 09:59:24 +02:00
Bruno Windels
099f99a96b check power levels to see if we can react 2021-06-17 09:41:25 +02:00
Bruno Windels
150f58a6b3 don't aggregate relations on redacted events 2021-06-16 18:00:50 +02:00
Bruno Windels
ce5409dc26 aggregate relations when seeing event target during back-pagination 2021-06-16 17:40:29 +02:00
Bruno Windels
bbcf0d2572 more local echo fixes for redacting a reaction + cleanup 2021-06-16 12:46:44 +02:00
Bruno Windels
4f10174e48 clarify comment 2021-06-16 10:28:17 +02:00
Bruno Windels
3b629622d9 need to keep pending count around if 0 or less for redaction local echo
also need to be able to tell the difference between no pending reactions
and redactions and the sum being 0 (having both a redaction and
reaction) so we keep isPending to true
2021-06-16 10:23:22 +02:00
Bruno Windels
e5c1094153 WIP 2021-06-15 19:06:41 +02:00
Bruno Windels
75ee509361 fix lint 2021-06-11 11:30:11 +02:00
Bruno Windels
757e08c62c WIP 4 2021-06-10 18:29:10 +02:00
Bruno Windels
cb051ad161 WIP3 2021-06-09 16:52:30 +02:00
Bruno Windels
206d18f498 WIP2 2021-06-08 16:56:17 +02:00
Bruno Windels
2ebadb36c3 WIP 2021-06-08 13:20:55 +02:00
Bruno Windels
3e47877645 Merge branch 'master' into bwindels/reactions 2021-06-04 16:33:10 +02:00
Bruno Windels
33655ee37e forgot to export class 2021-06-04 16:32:03 +02:00
Bruno Windels
7691b28503 prevent another race between sync and openTimeline 2021-06-04 16:28:08 +02:00
Bruno Windels
bb6905bdcd don't assume localEntries exists, as load races with sync.afterSync 2021-06-04 16:05:28 +02:00
Bruno Windels
b7402ce43c support local echo for adding a reaction 2021-06-04 15:34:44 +02:00
Bruno Windels
8bf160dfc0 handle sending relations to events that haven't been sent yet 2021-06-04 10:48:59 +02:00
Bruno Windels
bb8acbefa3 support undoing a reaction 2021-06-03 19:57:16 +02:00
Bruno Windels
20abb01ee8 very basic way of sending a reaction 2021-06-03 19:16:53 +02:00
Bruno Windels
2152d5e833 expose reactions on base message tile as vm with observable list 2021-06-03 19:15:49 +02:00
Bruno Windels
b94ab42c90 delete annotations object when no more annotations left 2021-06-03 19:10:29 +02:00
Bruno Windels
a78e9af8fc Support (de)aggregating annotation relations in relation writer
When deaggregating on redacting an annotation relation, we remove the
relation and aggregate the other relations for that key again, so we can
reliably detect the first timestamp (and count and me as well to lesser
extent).

as a consequence, more than one event can get updated when redacting a
relation (the relation is updated, as well as the relation target), so
account for that by returning an array of entries that have updated.
2021-06-03 16:50:37 +02:00
Bruno Windels
36a35d92f0 pass ownUserId to RelationWriter
We'll need to to aggregate whether we have reacted to a message

Create writers at room level and pass subwriter is dependency, rather
than creating them in sync and gap writer.
2021-06-03 16:50:37 +02:00
Bruno Windels
46bfab3eb7 fix some lint and comment 2021-06-03 16:50:11 +02:00
Bruno Windels
0c4c018ceb add note that powerlevels won't update when the state event is changed 2021-06-02 18:43:47 +02:00
Bruno Windels
d2f5b412ac don't try to hook up local relations for events that are not relations
and do unnecessary work
2021-06-02 18:43:16 +02:00
Bruno Windels
365bd5cad0 fix the race 2021-06-02 18:42:46 +02:00
Bruno Windels
84ecaa2ee1 don't trip over missing create events when loading power levels
as the test from previous commit fails because of that, and powerlevels
works fine without
2021-06-02 18:41:52 +02:00
Bruno Windels
4a8a6168cd add failing test for race between sync & subscribing after openTimeline 2021-06-02 18:41:03 +02:00
Bruno Windels
31075d601f load power levels before decryption closes the txn 2021-06-02 15:06:30 +02:00
Bruno Windels
7a96f84cab also show redaction reason for redaction local echo 2021-06-02 12:17:09 +02:00
Bruno Windels
addddf1f26 remove need for transferLocalEchoState, just add local relations again 2021-05-31 16:33:05 +02:00
Bruno Windels
13a4a0169c remove obsolete comments 2021-05-31 16:23:59 +02:00
Bruno Windels
00231443d3 timeline has the own member, so can just use timeline, not ownUserId 2021-05-31 15:18:44 +02:00
Bruno Windels
d68d14358f use lower return 2021-05-31 14:08:45 +02:00
Bruno Windels
23459aad52 check if you are allowed to redact a message 2021-05-31 13:52:03 +02:00
Bruno Windels
63b371b6ef support findAndUpdate with same predicate semantics in SortedArray too 2021-05-31 10:47:32 +02:00
Bruno Windels
fa37e8fedb findAndUpdate uses predicate, just add callback to update method 2021-05-31 10:46:16 +02:00
Bruno Windels
2da7ef4280 can only look in remote entries here as PEEs never return an event id 2021-05-27 10:28:02 +02:00
Bruno Windels
5e9ce365bf also apply local relations when loading at top 2021-05-27 10:27:44 +02:00
Bruno Windels
a93b1af047 ensure these don't fail on a gap entry 2021-05-27 09:16:25 +02:00
Bruno Windels
2b5dcff836 consistent naming 2021-05-27 09:11:13 +02:00
Bruno Windels
da02b5fe2d transfer local echo state when replacing event entry
e.g. after decryption or remote echo of other relation comes in
2021-05-26 13:10:19 +02:00
Bruno Windels
ce7147e463 put redactions in their own view, and allow aborting while still queued 2021-05-26 13:07:56 +02:00
Bruno Windels
af45810582 add support for redactions (and relations) local echo 2021-05-21 16:59:29 +02:00
Bruno Windels
b55efb7f11 ensure updateEntries is always set in the result of GapWriter 2021-05-21 16:58:04 +02:00
Bruno Windels
f271517446 log redaction during sync 2021-05-20 15:02:14 +02:00
Bruno Windels
df9e886f32 fix lint 2021-05-20 13:22:54 +02:00
Bruno Windels
b655c34bbb also show reason for redaction 2021-05-20 13:20:12 +02:00
Bruno Windels
780ad44032 render redacted messages 2021-05-20 13:15:35 +02:00
Bruno Windels
94b0bc82ef writing relations is async 2021-05-20 12:50:16 +02:00
Bruno Windels
9b923d337d write redactions during sync 2021-05-20 12:50:16 +02:00
Bruno Windels
8ff1f91d2c bring down lint error count, delete some old, inactive unit tests 2021-05-17 12:59:04 +02:00
Bruno Windels
1216378783 Extract BaseRoom from Room with summary and timeline, not sync or send
Which we can then reuse to create a dedicated ArchivedRoom class
which will:
 - have only relevant methods and properties (e.g. no sendEvent)
 - turns out that you can still receive a leave room in the sync
   (e.g. when banned after kick) so we'll make the sync for
   an archived room separate from room to not overcomplicate the sync
   there, much like we did for Invite already.
2021-05-07 16:13:49 +02:00
Bruno Windels
7defd4a02b ensure the sync is limited when rejoining without overlap
otherwise gap would be lost. The server should do this already,
but we're just ensuring it is, to be more robust.
2021-05-06 14:15:47 +02:00
Bruno Windels
08ba4577f6 rejoin logic was throwing away the prev_batch token 2021-05-06 14:15:47 +02:00
Bruno Windels
ec0de15da6 handle overlap with existing timeline when rejoining room 2021-04-22 17:21:29 +02:00
Bruno Windels
f976eeaf13 rename SortedArray.replace to update 2021-04-08 18:36:09 +02:00
Bruno Windels
863f659774 fall back to bare userid for local echo profile 2021-04-08 16:30:46 +02:00
Bruno Windels
813be758d7 we should prefer to not pick the event itself if it's a member event
but still fall back to that if it's a new join
2021-04-08 15:33:21 +02:00
Bruno Windels
f67ccc18f4 take most recent member rather than first in timeline for inline lookup
noticed this while inspecting the code, looks related to #269
2021-04-08 12:57:10 +02:00
Bruno Windels
6f37c232f7 Don't cache members that haven't been written yet - fixes #271 2021-04-08 12:56:24 +02:00
Bruno Windels
fcc06b2754 WIP to add logging to decryption and fetching key backups 2021-03-15 14:39:42 +01:00
Bruno Windels
cfb521ef10 fix ll events being duplicated in the timeline preventing name changes 2021-03-05 20:10:57 +01:00
Bruno Windels
f4a7782298 add MemberWriter, and only return MemberChange's if something changed 2021-03-05 17:03:45 +01:00
Bruno Windels
f98f690b49 no need to "serialize" here every time, it just adds noise 2021-03-05 17:02:26 +01:00
Bruno Windels
e0d14207ac make opening a txn async again
as we'll need to await a bogus request first thing after opening the txn

funny enough, we originally made it sync to accommodate the same bug
in safari, but that didn't prevent any microtask being awaited
before scheduling a request in the calling code closing the txn.

We'll await a bogus request within the transaction class now so it
doesn't depend on the calling code
2021-03-04 19:47:02 +01:00
Bruno Windels
b012b1dc99 Show correct profile for pending messages 2021-03-03 14:53:22 +01:00
Bruno Windels
43547e0901 don't add retried entries to the timeline if they are not already there 2021-03-03 14:03:50 +01:00
Bruno Windels
7f1cdf6841 also decrypt all matching timeline entries when new key 2021-03-03 14:03:50 +01:00
Bruno Windels
8d7cb2a39a remove unused imports 2021-03-03 14:03:50 +01:00
Bruno Windels
8d080163b3 reattempt decryption for timeline items 2021-03-02 19:39:04 +01:00
Bruno Windels
061e7abd50 don't break on empty room sync response 2021-03-02 19:39:04 +01:00
Bruno Windels
8208464653 only log and clear when actually needed 2021-03-02 19:37:11 +01:00
Bruno Windels
e1821b1753 prevent linking fragment to itself when filling a gap
this seems to happen when at the beginning of the timeline and
make the timeline reader go into an infinite loop
2021-03-02 19:31:00 +01:00
Bruno Windels
6f6346d5c3 detect when hitting beginning of timeline when loading timeline 2021-03-02 19:29:55 +01:00
Bruno Windels
57bb75e864 log login & loading a session 2021-02-23 19:22:25 +01:00
Bruno Windels
f4a3b64da0 log in sync writer (at detail level) and log room ids at info level 2021-02-19 11:57:17 +01:00
Bruno Windels
fd81111bfb merge state machine from AttachmentUpload into PendingEvent
to have less state machines, and we are mostly interested in the
aggregate status of all attachments of an event

this will also drive updates through the pending events collection
that already exists rather than an extra observablevalue, so less
housekeeping to update the UI.
2020-11-18 13:04:23 +01:00
Bruno Windels
d2a4242e5b support multiple attachments per event 2020-11-13 17:19:19 +01:00
Bruno Windels
af4f3f902f wait for attachment to be uploaded in send queue
also expose attachment from PendingEvent(Entry)
2020-11-11 11:51:39 +01:00
Bruno Windels
137264edcb implement subscribing to a single event 2020-10-30 15:19:51 +01:00
Bruno Windels
46fd769dda (re)move old (compile-time) platform code 2020-10-26 10:34:35 +01:00
Bruno Windels
c8dd7b42e7 encountered this very unlikely race while testing, so prevent it 2020-10-13 13:10:35 +02:00
Bruno Windels
07eee8fac1 only create fragments when we will really write events to the timeline store 2020-10-01 17:01:33 +02:00
Bruno Windels
1117c77d05 note for future optimisation 2020-10-01 14:36:00 +02:00
Bruno Windels
76381fbca1 open storage transactions synchronously
this (almost) makes it work in some browsers that otherwise
have throw a TransactionInactiveError on the first operation
you try to do on a store.
2020-09-28 16:06:41 +02:00
Bruno Windels
17f84ab314 fix "this" still being used in readRawTimelineEntries ... 2020-09-23 19:09:44 +02:00
Bruno Windels
d53b5eefb3 fill in the blanks 2020-09-23 17:59:42 +02:00
Bruno Windels
9d41e122a0 draft of falling back to reading entries since last decrypted event key
this change notifyRoomKey(s) to only take one room key at a time
to simplify things
2020-09-23 17:34:25 +02:00
Bruno Windels
241176d6fb WIP 2020-09-22 18:22:37 +02:00
Bruno Windels
8c4d68def9 show decryption errors in timeline 2020-09-14 15:47:00 +02:00
Bruno Windels
9f6822f362 remove needsRoomKey flag on member 2020-09-11 14:38:36 +02:00
Bruno Windels
0dece5b04f make continuation logic work well with pending events
- don't use display name to compare but user id
   (pending doesn't have display name yet)
 - use current time as timestamp
2020-09-11 11:43:40 +02:00
Bruno Windels
de1cc0d739 abort decrypt requests when changing room 2020-09-10 17:43:01 +02:00
Bruno Windels
0bf1723d99 Worker WIP 2020-09-10 15:40:30 +01:00
Bruno Windels
fdbc5f3c1d WIP worker work 2020-09-10 13:00:11 +02:00
Bruno Windels
17412bbb2f more validation 2020-09-10 12:12:39 +02:00
Bruno Windels
1c77c3b876 expose multi-step decryption from RoomEncryption, adjust room timeline
sync code hasn't been adjusted yet
2020-09-10 12:11:25 +02:00
Bruno Windels
650df6fea8 forgot await 2020-09-08 15:00:29 +02:00
Bruno Windels
5a8aac57ac there might not be a member yet 2020-09-08 15:00:20 +02:00
Bruno Windels
bbaf3a5605 write needsRoomKey flag when new members joins to tracked e2ee room 2020-09-08 14:22:11 +02:00
Bruno Windels
c32ac2c764 use decryption result to show message verification status in timeline 2020-09-08 10:50:39 +02:00
Bruno Windels
9137d5dcbb make decryption algorithms return DecryptionResult
which contains curve25519 key and claimed ed25519 key as well as payload
2020-09-08 10:48:11 +02:00
Bruno Windels
a817a9aaf9 return decrypted type and content 2020-09-04 16:41:03 +02:00
Bruno Windels
8e5d5db32b add event prop on entry 2020-09-04 16:40:15 +02:00
Bruno Windels
dc0576f2db cleanup 2020-09-04 15:31:45 +02:00
Bruno Windels
5a731903da implement decrypting when loading timeline 2020-09-04 15:30:06 +02:00
Bruno Windels
62bcb27784 implement decryption retrying and decrypting of gap/load entries
turns out we do have to always check for replay attacks because
failing to decrypt doesn't prevent an item from being stored,
so if you reload and then load you might be decrypting it
for the first time
2020-09-04 15:29:58 +02:00
Bruno Windels
502ba5deea first draft of decryption in Room and RoomEncryption 2020-09-04 12:09:19 +02:00
Bruno Windels
2e67b2b6b8 handle prev_content location ambiguity 2020-08-31 14:21:18 +02:00
Bruno Windels
8482bc95ec pass memberchanges around instead of members
so we can easily tell how their membership changes, (e.g. join -> left)
which we'll need for device tracking.

Not adding this to RoomMember because RoomMember also needs to be
able to represent a member loaded from storage which doesn't contain
this error. A MemberChange exists only within a sync.
2020-08-31 09:50:57 +02:00
Bruno Windels
1fe496eeea fix crash when state is not set (erroneously?) on gap response
this seems to happen when the only event in the room is
a m.room.create
2020-08-27 09:52:30 +02:00
Bruno Windels
5d21ae3fb7 fix error on conduit with state field that is missing when empty 2020-08-21 19:10:28 +02:00
Bruno Windels
2bfbb41ee7 send receipt to server when clearing unread state so notif count clears 2020-08-21 15:16:57 +02:00
Bruno Windels
f5acee02be add comment why we do things in this order 2020-08-20 16:20:35 +02:00
Bruno Windels
fafdf669db use prev_content from later events before state 2020-08-20 15:23:56 +02:00