Commit graph

368 commits

Author SHA1 Message Date
Bruno Windels b58e10521f don't log tryInsert failures anymore as everything is logged in Store 2021-09-22 10:23:28 +02:00
Bruno Windels 704d7b32da add tests 2021-09-21 21:04:29 +02:00
Bruno Windels 6cded5319a change timelineEventStore.insert to tryInsert 2021-09-21 21:04:10 +02:00
Danila Fedorin a3a743881d Make test adjustments requested in PR. 2021-09-20 19:37:39 -07:00
Danila Fedorin 50c8b995c3 Undo GapWriter algorithm changes 2021-09-20 18:41:01 -07:00
Danila Fedorin 9f6c48cf0c Merge branch 'master' into DanilaFe/backfill-changes 2021-09-17 15:19:16 -07:00
Danila Fedorin 820b048272 Finish up the more difficult tests 2021-09-17 10:57:51 -07:00
Bruno Windels 53a0d29244 example how to get more context for the failure of a write operation 2021-09-17 18:25:28 +02:00
Danila Fedorin 82c35355b6 Start translating GapWriter tests to using MockTimeline 2021-09-16 23:54:13 -07:00
Bruno Windels 9a9b206bf5
Merge pull request #486 from vector-im/bwindels/fix-scroll-jumps
Fix scroll jumps and loading of gaps not at top of the timeline
2021-09-16 17:14:17 +02:00
Bruno Windels 381a12db20 load 20 entries initially in timeline, otherwise it flickers a bit 2021-09-16 16:34:13 +02:00
Danila Fedorin d2b604e1dd Stop using at to fix tests. 2021-09-14 15:57:32 -07:00
Danila Fedorin df273c5e2c Store more events from backfill 2021-09-14 15:40:15 -07:00
Danila Fedorin b2b5690739 Add more tests 2021-09-14 13:54:14 -07:00
Danila Fedorin 41e568f783 Add more tests and extract common test code 2021-09-14 11:15:13 -07:00
Danila Fedorin 31577cd496 Draft first two tests 2021-09-14 10:24:18 -07:00
Danila Fedorin b3df37b0bc Add the beginning of a tests function for GapWriter 2021-09-13 17:01:32 -07:00
Bruno Windels 9411e6f065 WIP 2021-09-10 14:47:05 +02:00
Bruno Windels 5953cdf0cc turns out we do write these 2021-09-06 13:10:36 +02:00
Bruno Windels 7cb686ce8e convert EventKey to ts 2021-09-06 13:07:41 +02:00
Bruno Windels 85c8415acd convert Direction to ts 2021-09-06 13:06:20 +02:00
Bruno Windels 6cec583661 fix #483 2021-09-01 14:21:21 +02:00
Bruno Windels 3d66d71c97 fix conflict 2021-08-31 08:39:12 +02:00
Bruno Windels 7fb5412176 keep comment where it was 2021-08-30 15:12:25 +02:00
Bruno Windels ddb6753f8d fix refactor error 2021-08-27 20:05:53 +02:00
Bruno Windels 6a6762f036 ensure memberwriter works with undefined for state/timeline events array 2021-08-27 20:05:34 +02:00
Bruno Windels a61f052fe8 fix lint 2021-08-27 17:23:32 +02:00
Bruno Windels 826de7e9cb Write all members of a sync in one go
so state member events written but not causing a memberChange.hasJoined
don't prevent timeline member events for the same user from doing so
2021-08-27 17:11:29 +02:00
Danila Fedorin 904a2cbe74 Merge branch 'master' into snowpack-ts-storage-1 2021-08-26 17:07:25 -07:00
Bruno Windels d0c1ddb51b add failing test 2021-08-26 15:18:31 +02:00
Bruno Windels e105bc4237 fix lint warnings 2021-08-24 15:31:18 +02:00
Bruno Windels 4b5f5ddffa fix ts lint error by making methods abstract 2021-08-18 18:15:03 +02:00
Bruno Windels 02e422f3ac
Merge pull request #448 from vector-im/snowpack-mvp
Snowpack MVP
2021-08-18 13:09:02 +00:00
Danila Fedorin 5579c018d1 Migrate common.js to TypeScript
Add initial stab at annotating common

Add missing return types and semicolons
2021-08-17 16:30:05 -07:00
Danila Fedorin 8ec8de67b8 Merge branch 'snowpack-mvp' into snowpack-ts-storage-1 2021-08-17 16:29:47 -07:00
Bruno Windels c3177b06bf
Merge pull request #418 from vector-im/replies
Sending replies
2021-08-06 21:28:42 +00:00
Danila Fedorin 3c5b186e31 Switch BaseEntry to TypeScript 2021-08-06 12:54:06 -07:00
Danila Fedorin 1207203b00 Prefer relations from encrypted content 2021-08-06 10:22:43 -07:00
Danila Fedorin 5a0bc55e54 Rename reply function in reply.js 2021-08-06 10:16:20 -07:00
RMidhunSuresh be57352f71 Move PowerLevels.js into /room
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-08-06 19:49:48 +05:30
RMidhunSuresh b75760c437 Add event type string
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-08-06 17:15:40 +05:30
Danila Fedorin 06961ff693 Add isReply flag to entries 2021-08-04 15:30:35 -07:00
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