Commit graph

1775 commits

Author SHA1 Message Date
Bruno Windels
2ebadb36c3 WIP 2021-06-08 13:20:55 +02:00
Bruno Windels
280de98858 fix lint 2021-06-04 16:41:37 +02:00
Bruno Windels
3e47877645 Merge branch 'master' into bwindels/reactions 2021-06-04 16:33:10 +02:00
Bruno Windels
47e74bd598 add glow animation for pending reactions 2021-06-04 16:32:35 +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
919542f8fc Don't assume container node exists when loading bundle
Only look for the container node when needed
2021-06-04 15:36:01 +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
2878208e94 keep the DOM small, avoid a node for reactions on every message 2021-06-04 10:08:07 +02:00
Bruno Windels
4ef5afc011 this is actually not used, so remove it 2021-06-04 10:07:52 +02:00
Bruno Windels
dde26da5a6 add mountView utility to handle error handling on mount
and use it where errorToDOM is used currently for catching mount errors
2021-06-04 10:07:12 +02:00
Bruno Windels
ff370d03db catch errors thrown by childview mount method on add in ListView 2021-06-04 09:37:36 +02:00
Bruno Windels
05cc1f6757 make reactions look like element 2021-06-03 21:01:59 +02:00
Bruno Windels
d91282a767 render reactions in div instead of ul 2021-06-03 21:01:47 +02:00
Bruno Windels
3e2b7ba5fa obsolete, already provided in parent class 2021-06-03 21:01:26 +02:00
Bruno Windels
1385a22e60 don't recreate the reactions after clearing it with the last one removed 2021-06-03 21:00:57 +02:00
Bruno Windels
cc444fa207 we actually don't need any of the view model infrastructure
all the updates go over the observable list
2021-06-03 21:00:25 +02:00
Bruno Windels
8d4d9c6e8d WIP 2021-06-03 19:57:48 +02:00
Bruno Windels
2eb2e4e9b3 more stable sorting order for reactions 2021-06-03 19:57:29 +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
b722691e85 show reactions as ListView of buttons if present 2021-06-03 19:16:19 +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
b05345ee27 only show redacted messages 2021-06-03 16:50:37 +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
41fb30c68b add relations store 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
b83613924c don't assume there is at least 1 tile before loading at top
it can happen that all tiles are not renderable, and we should just
keep calling loadAtTop
2021-06-03 09:25:56 +02:00
Bruno Windels
d965d57be7 don't leak timeline when an error is thrown while opening it
or you are just stuck with "not dealing with race" errors until refresh
2021-06-02 18:44:03 +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
d8acf63e1d change mock event api a bit to be easier to read 2021-06-02 18:38:16 +02:00
Bruno Windels
09bf0f3b4e fix status styling for text messages being broken
as binding was put at argument level rather than className level
2021-06-02 15:25:20 +02:00
Bruno Windels
31075d601f load power levels before decryption closes the txn 2021-06-02 15:06:30 +02:00
Bruno Windels
cef94fea45 fix lint 2021-06-02 12:38:41 +02:00
Bruno Windels
bf951bd322 fix logging wrong value 2021-06-02 12:34:14 +02:00
Bruno Windels
c3754fdbd4 fix the race, make test succeed 2021-06-02 12:34:02 +02:00
Bruno Windels
87ebdbb0b4 add failing test for unhandled race between sync and send
see comments in code
2021-06-02 12:33:15 +02:00
Bruno Windels
8369dcef5f utility to wait until a value becomes truthy in a test 2021-06-02 12:32:50 +02:00
Bruno Windels
ffb6cb372a utility to create events in tests 2021-06-02 12:32:34 +02:00
Bruno Windels
cf6e14ed8b utility for homeserver api mocking 2021-06-02 12:32:19 +02:00
Bruno Windels
6a5679a338 create mock storage using fake-indexeddb 2021-06-02 12:32:03 +02:00
Bruno Windels
edbac25613 prepare storage to work with alternative idb impl 2021-06-02 12:31:13 +02:00
Bruno Windels
8dfed73524
Merge pull request #361 from vector-im/bwindels/redactions
Redactions
2021-06-02 10:22:33 +00:00
Bruno Windels
7a96f84cab also show redaction reason for redaction local echo 2021-06-02 12:17:09 +02:00
Bruno Windels
15f6ab8b7e only show cancel option if not already sending 2021-06-02 11:56:15 +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
25ce06c9d5 clarify 2021-05-31 15:55:31 +02:00
Bruno Windels
dc2e21495b explain why this is needed 2021-05-31 15:46:57 +02:00
Bruno Windels
8196a02f9d don't even need isOwn member anymore 2021-05-31 15:25:01 +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
2bd7c23076 fix lint 2021-05-31 15:08:49 +02:00
Bruno Windels
d68d14358f use lower return 2021-05-31 14:08:45 +02:00
Bruno Windels
492a8fe359 remove extra whiteline 2021-05-31 14:05:37 +02:00
Bruno Windels
5d35caf85f no need to emit, timeline finds out by themselves with remote echo 2021-05-31 14:03:22 +02:00
Bruno Windels
606d40c9d4 simplify canRedact logic in view by overriding in RedactedTile 2021-05-31 13:55:08 +02:00
Bruno Windels
23459aad52 check if you are allowed to redact a message 2021-05-31 13:52:03 +02:00
Bruno Windels
128f9812a6 set destructive flag here too 2021-05-31 13:08:06 +02:00
Bruno Windels
57288f75b0 add avatar & sender as first element in message so they don't occlude 2021-05-31 13:03:41 +02:00
Bruno Windels
d4373eb309 make options button look the same in all browsers 2021-05-31 13:03:23 +02:00
Bruno Windels
d66cdc97cd fix message options button placement in IE11 2021-05-31 13:02:42 +02:00
Bruno Windels
2e34668b91 show errors while mounting list view children 2021-05-31 12:28:42 +02:00
Bruno Windels
762ed96a3b Not needed as both evententry and pendingevententry return timestamp 2021-05-31 11:58:01 +02:00
Bruno Windels
447b98ce6c don't use subviews for showing/hiding avatar & sender on continuation 2021-05-31 11:57:17 +02:00
Bruno Windels
0596ca06b1 emit remove before linking up sibling tiles
otherwise emitting the update from updatePreviousSibling has
the wrong idx
2021-05-31 11:56:41 +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
RMidhunSuresh
849a02cec2 Add aria-label
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-28 20:37:36 +05:30
Bruno Windels
6a5d856093 add destructive flag to delete menu option 2021-05-28 16:25:23 +02:00
Bruno Windels
5b0675b711 fix lint 2021-05-28 16:25:06 +02:00
Bruno Windels
95a680eb83 fix whitespace 2021-05-28 16:24:47 +02:00
Bruno Windels
57d9916746 buttons in ff were not in Inter 2021-05-28 15:30:03 +02:00
Bruno Windels
7f41993648 prevent buttons with negative margin to displace message menu 2021-05-28 15:28:04 +02:00
Bruno Windels
b3749f2d92 prevent long links from creating horizontal scroll 2021-05-28 15:27:44 +02:00
Bruno Windels
5afcfc3e9b fix unsent/unverified message style 2021-05-28 15:27:25 +02:00
Bruno Windels
43c082475b unify cancel option for various tiles in menu option 2021-05-28 15:27:02 +02:00
Bruno Windels
2b0fa22c8a open menu when clicking ... button on message with delete/cancel option 2021-05-28 13:14:55 +02:00
Bruno Windels
63e948fc80 change renderMessage fn to base class
as preparation to create menu items in subclasses
2021-05-28 12:32:19 +02:00
Bruno Windels
100e056d55 style the button 2021-05-28 12:22:47 +02:00
Bruno Windels
f82e873da8 adjust message status styling to css grid changes 2021-05-28 12:17:59 +02:00
RMidhunSuresh
fc898f8c7e Set new svg icon as background-image of button
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-28 15:47:50 +05:30
RMidhunSuresh
ba11cdd83f Remove ellipsis character
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-28 15:47:06 +05:30
RMidhunSuresh
3f99b7247c Bring in vertical ellipsis icon
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-28 15:46:10 +05:30
Bruno Windels
bbf9832d6a switch timeline messages to css grid, and add menu button 2021-05-28 12:09:21 +02:00
Bruno Windels
13ac41b264 delete obsolete code 2021-05-28 12:02:35 +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
c6e2607f1f guard against updates emitted while populating during first subscription
This came up now because Timeline uses a MappedList to map PendingEvents
to PendingEventEntries. In the map function, we setup links between
entries to support local echo for relations. When opening a timeline
that has unsent relations, the initial populating of the MappedList
will try to emit an update for the target entry in remoteEntries.
This all happens while the ListView of the timeline is calling subscribe
and all collections in the chain are populating themselves based on
their sources.

This usually entails calling subscribe on the source,
and now you are subscribed, iterate over the source (as you're not
allowed to query an unsubscribed observable collection, as it might not
be populated yet, and even if it did, it wouldn't be guaranteed to be
up to date as events aren't flowing yet).

So in this concrete example, TilesCollection hadn't populated its tiles
yet and when the update to the target of the unsent relation reached
TilesCollection, the tiles array was still null and it crashed.

I thought what would be the best way to fix this and have a solid model
for observable collections to ensure they are always compatible with
each other. I considered splitting up the subscription process in two
steps where you'd first populate the source and then explicitly start
events flowing.

I didn't go with this way because it's really only updates that
make sense to be emitted during setup.
A missed update wouldn't usually bring the collections out of sync
like a missed add or remove would. It would just mean the UI isn't
updated (or any subsequent filtered collections are not updated),
but this should be fine to ignore during setup, as you can rely
on the subscribing collections down the chain picking up the update
while populating. If we ever want to support add or remove events
during setup, we would have to explicitly support them, but for now
they are correct to throw.

So for now, just ignore update events that happen during setup
where needed.
2021-05-27 10:02:05 +02:00
Bruno Windels
a8e43d4850 remove leftover logging 2021-05-27 09:18:22 +02:00
Bruno Windels
a93b1af047 ensure these don't fail on a gap entry 2021-05-27 09:16:25 +02:00
Bruno Windels
afc3db2f33 unrelated todo note for later 2021-05-27 09:11:57 +02:00
Bruno Windels
2b5dcff836 consistent naming 2021-05-27 09:11:13 +02:00