Commit graph

368 commits

Author SHA1 Message Date
Bruno Windels 2152d5e833 expose reactions on base message tile as vm with observable list 2021-06-03 19:15:49 +02:00
Bruno Windels b05345ee27 only show redacted messages 2021-06-03 16:50:37 +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 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 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 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 762ed96a3b Not needed as both evententry and pendingevententry return timestamp 2021-05-31 11:58:01 +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 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 56495c9d13 fix gap failing to fill 2nd time + unit regression test 2021-05-27 09:10:10 +02:00
Bruno Windels ca4d09e923 add logging and return promise from Tile.redact 2021-05-26 13:08:54 +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 cb622be653 rerender tile when becoming or stopped being redacted 2021-05-25 12:58:20 +02:00
Bruno Windels 8a8c5569dc provide redact method on tile and room
also add some logging
2021-05-20 14:53:17 +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
RMidhunSuresh 72f58b6001 Change lines[i] to line
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-18 14:26:56 +05:30
RMidhunSuresh 11d551f8a3 Add js-doc for parsePlainBody
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-17 20:39:23 +05:30
RMidhunSuresh d671bcec31 Add js-docs for linkify function
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-17 20:32:35 +05:30
Bruno Windels 645470cd03 no need for private prop here 2021-05-17 12:45:55 +02:00
Bruno Windels ce976226f9 rename MessageTile to BaseMessageTile
since MessageTile doesn't have a shape property anymore
2021-05-17 12:15:13 +02:00
Bruno Windels 67714040e7 rename BaseTextMessageTile to BaseTextTile 2021-05-17 12:14:15 +02:00
Bruno Windels 054c51b82f add caching MessageBody in BaseTextMessageTile,use in EncryptedEventTile
missing body in EncryptedEventTile was what caused the bug
2021-05-17 11:27:30 +02:00
Bruno Windels 01b8b397b6 expose sourceString on result of parsing message body
and also do some cleanup
2021-05-17 11:26:30 +02:00
Bruno Windels 62bb891e79 don't accept closing parenthesis as last character of url 2021-05-12 22:49:34 +02:00
RMidhunSuresh 851e8d34a4 Incorporate better regex from review
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-12 16:15:30 +05:30
RMidhunSuresh 00bcdbab37 Fix broken test
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-12 16:15:07 +05:30
RMidhunSuresh bb74656348 Grammar fix
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-12 15:59:44 +05:30
RMidhunSuresh 2e657fbbbd Add failing test for link ending with <
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-12 15:56:33 +05:30
RMidhunSuresh 55b7c55efe Pull callback args into variables
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-12 15:52:05 +05:30
RMidhunSuresh 9d898bdf47 Change word to improve meaning
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:32:05 +05:30
RMidhunSuresh b521797f4d Explain the reason for double escapes
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:28:14 +05:30
RMidhunSuresh ef15968a3d Add some helpful pointers
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:26:45 +05:30
RMidhunSuresh c6d7cef491 Refactor regex to improve readability
- Split regex into components
- Add informative comments

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:21:37 +05:30
RMidhunSuresh 31740f4ec6 Put regex into separate file
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:18:52 +05:30
RMidhunSuresh 6f0362802a Move linkify.js to separate directory
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:17:08 +05:30
RMidhunSuresh 027f6020e7 Modified regex to allow unicode in fragment
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 22:15:36 +05:30
RMidhunSuresh e20810b0cb Add test for unicode after fragment without path
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 20:44:39 +05:30
RMidhunSuresh 7be9f93909 Make regex module-level constant
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 20:32:36 +05:30
RMidhunSuresh 03208b88d5 Move link tests to linkify
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 20:19:29 +05:30
RMidhunSuresh dbe76e973e Add braces to all blocks
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 17:59:03 +05:30
RMidhunSuresh 3830a95af2 Cache result in TextTile
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 16:03:14 +05:30
RMidhunSuresh 051771397c Fix bug in which links preceeded text
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 13:59:45 +05:30
RMidhunSuresh 3beaf88a8b Rename messageFormat to body
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 13:46:38 +05:30
RMidhunSuresh 070bc96186 Fallback to empty string if content is undefined
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 13:43:54 +05:30
RMidhunSuresh 577883a1d4 Refactor loop
Don't handle last element separately

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 13:31:33 +05:30
RMidhunSuresh 03b971d898 Added tests for new linkify
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-11 12:55:39 +05:30
RMidhunSuresh 17be7c4f4d Add newline to message
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-10 22:10:50 +05:30
RMidhunSuresh fc3b391aa9 Use MessageBodyBuilder instead of linkify
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-10 21:41:57 +05:30
RMidhunSuresh 55f2d79d07 Move newline handling to MessageBodyBuilder
- Also add a insert method to reflect new design.

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-10 21:37:27 +05:30
RMidhunSuresh 787d438a74 Refactored Linkifier class into single function
Modified design so that linkify interacts with MessageBodyBuilder
through callbacks.

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-10 21:30:11 +05:30
RMidhunSuresh dca649dfd4 Moved files into more appropriate locations
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-10 19:53:40 +05:30
RMidhunSuresh 2f883d049c Return new message format instead of message text
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-05-08 19:20:07 +05:30
Bruno Windels e1d4c75d18 pass avatar sizes from view to view model rather than repeating there
and risk a mismatch resulting in too large/small image
2021-04-28 14:11:35 +02:00
RMidhunSuresh 3d1ddccbd8 Add previous name in name change announcement
- Fixes issue 269 in which the announcement generated when a member
  changes their name would show as :
  <new_name> changed their name to <new_name>
  instead of:
  <old_name> changed their name to <new_name>

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-03-19 23:28:50 +05:30
Bruno Windels a672b0c78a better error handling in video decoding 2021-03-10 13:40:11 +01:00
Bruno Windels 35e6dffd0b don't rely on mime-types to decide to use main url for thumbnail
so it does not break when clients forget to set the mimetype
2021-03-10 10:01:07 +01:00
Bruno Windels ee6f3e5457 render video messages 2021-03-09 19:35:10 +01:00
Bruno Windels 299fcfd4d1 extract base class from image tile to inherit from for video tile 2021-03-09 19:33:54 +01:00
Bruno Windels 2d4003379e Fix #97 2021-03-08 22:25:18 +01:00
Bruno Windels 961d0cb224
Merge pull request #249 from vector-im/bwindels/ui-sent-status
show message already as black when sent but no remote echo yet
2021-03-03 13:08:46 +00:00
Bruno Windels 6f6346d5c3 detect when hitting beginning of timeline when loading timeline 2021-03-02 19:29:55 +01:00
Bruno Windels 856001160b show message already as black when sent but no remote echo yet 2021-02-26 10:40:08 +01:00
Bruno Windels 1093895133 log opening timeline
also load the timeline when opening it in the room, so logging
starts in the room (and we don't need to pass the logger to Timeline)
and also API-wise it makes more sense to
not return uninitialized objects
2021-02-24 11:21:04 +01:00
Bruno Windels 2f0f168c6e show 'sending' while waiting for remote echo for filetile instead of unknown status 2020-11-20 16:38:16 +01:00
Bruno Windels f7a07a9e79 adjust fileview/tile to pendingevent changes 2020-11-20 11:45:14 +01:00
Bruno Windels 8b8d06cf3e show error for attachments still need upload but missing after refresh 2020-11-19 14:42:29 +01:00
Bruno Windels 59a92bdf97 vm changes for improved image view 2020-11-18 20:10:05 +01:00
Bruno Windels 47147f2d46 progress bar for upload, add cancel button, no lightbox while uploading 2020-11-18 20:06:34 +01:00
Bruno Windels a930dec8db adjust ImageTile to state machine changes 2020-11-18 13:05:10 +01:00
Bruno Windels 671e23a123 basic reporting of image upload progress in % 2020-11-16 15:10:44 +01:00
Bruno Windels 41738ad660 local echo for image tiles 2020-11-13 19:15:21 +01:00
Bruno Windels d2a4242e5b support multiple attachments per event 2020-11-13 17:19:19 +01:00
Bruno Windels 8b16d8bc99 handle upload failures better 2020-11-11 13:06:03 +01:00
Bruno Windels fd9eccec4d support local echo in FileTile while uploading 2020-11-11 11:52:06 +01:00
Bruno Windels 2cfffa015d WIP 2020-11-10 22:36:26 +01:00
Bruno Windels c65e8bea11 clean up properly 2020-11-10 19:05:50 +01:00
Bruno Windels 2d8000d11d file tile view 2020-11-10 17:50:53 +01:00
Bruno Windels a3ca0feda9 file tile view model 2020-11-10 17:50:38 +01:00
Bruno Windels 373a42c7a8 allow downloading plaintext attachments also, with or without cache 2020-11-10 17:49:48 +01:00
Bruno Windels a4f610ad3f support emotes 2020-11-10 15:13:31 +01:00
Bruno Windels 7d81306a49 return BufferHandles from the media repository
BufferHandles are platform specific handles to a buffer. On web,
they have a .blob and .url property.
2020-10-30 15:18:27 +01:00
Bruno Windels 68a0dd30ca add lightbox navigation and basic view & view model 2020-10-29 11:12:32 +01:00
Bruno Windels fe6e4464fd pass all viewmodel options to tile view models 2020-10-29 11:10:34 +01:00
Bruno Windels 862a0ba56b show image decryption error 2020-10-29 10:29:08 +01:00
Bruno Windels d1e78a735a show error in label for now 2020-10-29 10:18:05 +01:00
Bruno Windels 97c3a4b8f3 store error when loading encrypted images 2020-10-27 16:21:08 +01:00
Bruno Windels e7ff6decbf remove unneeded quotes 2020-10-27 16:20:41 +01:00
Bruno Windels 77dca5dd55 add update parameter when replacing tile 2020-10-27 16:19:36 +01:00
Bruno Windels fcc4c21ad2 filter mime types for blob urls 2020-10-27 14:35:33 +01:00
Bruno Windels ee1e62207c apply platform changes to decrypting images 2020-10-26 17:18:17 +01:00
Bruno Windels 3ed5ea8b0b Merge branch 'master' into bwindels/decrypt-images 2020-10-26 17:08:29 +01:00
Bruno Windels 03351d2e1f extract platform class to put all platform specific code in 2020-10-26 15:44:11 +01:00
Bruno Windels 2e0d1363c7 fix 2020-10-26 10:16:23 +01:00
Bruno Windels a6224135e3 extract blob url code to platform (WIP) 2020-10-26 10:14:46 +01:00
Bruno Windels cbd48aa528 only load main image when clicking thumbnail 2020-10-26 09:49:42 +01:00
Bruno Windels 3a6268f0c1 basic PoC of image decryption working
needs looooaaads of cleanup still
2020-10-23 17:25:11 +02:00
Bruno Windels cdcdc07c06 fix a crash when switching rooms before the messages have loaded
as we were not disposing the timeline view model
(but still not leaking though)
2020-10-19 12:57:21 +02:00
Bruno Windels 1d33ab20a5 fix decrypted tiles not corresponding to a tile 2020-09-18 13:36:16 +02:00
Bruno Windels a11b612640 await this 2020-09-14 17:45:02 +02:00
Bruno Windels b2e6e8687e dispose tiles
also add more defence against emitting event when disposed
2020-09-14 17:44:37 +02:00
Bruno Windels 9ea961ae53 don't crash when we don't have a subscription anymore 2020-09-14 17:43:06 +02:00
Bruno Windels 8555fd5f18 a little extra caution 2020-09-14 15:47:00 +02:00
Bruno Windels aa5d55bbf2 show when e2ee is enabled in timeline 2020-09-14 15:47:00 +02:00
Bruno Windels 8c4d68def9 show decryption errors in timeline 2020-09-14 15:47:00 +02:00
Bruno Windels 4875095ea3 fix event tiles not updating when event is decrypted when room keys come 2020-09-11 17:47:35 +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 fdbc5f3c1d WIP worker work 2020-09-10 13:00: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 f0d0dbb30f fix member event reporting 2020-08-20 17:43:51 +02:00
Bruno Windels cff39019cb extract renderAvatar
and use avatarTitle instead of sender for img title
2020-08-20 17:32:18 +02:00
Bruno Windels 59bdd2b015 render avatar on message tiles 2020-08-20 16:03:52 +02:00
Bruno Windels 5d0ee21267 move mxcUrl functions to media repo class 2020-08-20 15:40:43 +02:00
Bruno Windels 843f4fa0f7 fix flood issue when back-filling isn't available 2020-08-20 15:28:22 +02:00
Bruno Windels 036b305c96 use display name for room name change tiles 2020-08-20 15:24:16 +02:00
Bruno Windels d31a1b5fff render display name in timeline 2020-08-20 10:26:28 +02:00
Bruno Windels 2526198251 replace usage of readPath with ?. 2020-08-19 11:36:43 +02:00
Bruno Windels 614a00b741 don't continue messages from more than 5min ago 2020-08-19 10:28:09 +02:00
Bruno Windels fad728069a don't show date & time on pending events 2020-08-19 10:27:27 +02:00
Bruno Windels 1c779cf95c render encrypted tiles as such so we don't fetch the whole history 2020-08-17 17:41:57 +02:00
Bruno Windels 0b1d9bf25e unused now 2020-08-17 17:41:49 +02:00
Bruno Windels 37597e2acb mark fragment in storage when start of timeline is reached
so we don't keep looping to fetch more messages
when scrolled all the way up
2020-08-17 17:41:10 +02:00
Bruno Windels 1e4f331989 fill top gap instead of loading more events from storage 2020-08-17 15:13:12 +02:00
Bruno Windels cf0af775e3 make SimpleTile inherit from ViewModel
to use same update mechanism and have viewmodel infra available for tile
2020-08-17 15:11:39 +02:00
Bruno Windels 9745c58144 use readPath in ImageTile 2020-08-17 14:20:54 +02:00
Bruno Windels 70e6515b5c dont crash on m.image without url 2020-08-17 10:29:29 +02:00
Bruno Windels 19e5d310e0 move avatar one level lower because we'll need it in the session picker 2020-08-14 14:33:13 +02:00
Bruno Windels 44cc691c79 add avatar and sender user colors 2020-08-13 12:41:00 +02:00
Bruno Windels 00a85697ab add license header in all source files 2020-08-05 18:38:55 +02:00
Bruno Windels e2c8b5e595 pass vm field to emitChange 2020-06-24 22:43:29 +02:00
Bruno Windels 2b17d0f691 spell height correctly 2020-05-09 21:21:55 +02:00
Bruno Windels 7f221cda65 show images intimeline 2020-05-09 20:02:08 +02:00
Bruno Windels cc87e35f23 use ViewModel super class for all view models that need binding 2020-05-04 19:23:11 +02:00
Bruno Windels 001dbefbcf stop using default exports
because it becomes hard to remember where you used them and where not
2020-04-20 21:26:39 +02:00
Bruno Windels e4563135bf look at prev_content when handling member events 2020-03-30 21:59:44 +02:00
Bruno Windels 6d68ec1bac move fillGap to room 2020-03-21 23:40:40 +01:00
Bruno Windels f729108226 pass emit update fn through setter so we control when tile can update 2020-03-21 14:28:09 +01:00
Bruno Windels a3714f49cc group public methods for a tile together 2020-03-21 14:26:56 +01:00
Bruno Windels 4176af56ea add failing test for problem 2020-03-21 14:22:16 +01:00
Bruno Windels 8665bcb897 concat synced events in timeline with pending events for local echo 2019-07-29 19:53:58 +02:00
Bruno Windels e23abe209f fixup: leftover from removing access to events 2019-07-29 19:53:07 +02:00
Bruno Windels 9b94c4bb61 don't expose raw event object from entry, pending event doesn't have it
it only has content and *some* of the meta fields,
but we want to threat pendingevententry and evententry as one
and the same in the rest of the application, so don't give access
to entire event object.
2019-07-29 10:27:12 +02:00
Bruno Windels 9cd5257959 load more events when scrolled to top 2019-06-16 17:29:33 +02:00
Bruno Windels d34a26f0da store new gap entry on update so we can paginate again 2019-06-16 16:47:56 +02:00
Bruno Windels a1c23f715a always show date for now (but omit year to make it less annoying) 2019-06-16 16:19:26 +02:00
Bruno Windels a09c3e7bed hide sender name if previous message was by same sender 2019-06-16 15:48:54 +02:00
Bruno Windels 4a657b279d apply css from prototype, other small changes, keep scroll at bottom 2019-06-16 15:21:20 +02:00
Bruno Windels a4bc2dd2b0 support isOwn on messages 2019-06-16 10:53:23 +02:00
Bruno Windels a5a333b71a organize view code in directory like viewmodels 2019-06-16 10:53:01 +02:00
Bruno Windels 64f126ba68 support updates originating from tile, and removing tile on update 2019-06-12 21:57:13 +02:00
Bruno Windels e3b4f898d0 show eventkey in ui for debugging purposes 2019-06-02 18:15:24 +02:00
Bruno Windels a269f612b6 space 2019-06-02 15:46:44 +02:00
Bruno Windels bdad0ad86b fix some gap fill errors 2019-06-02 15:46:24 +02:00
Bruno Windels 674007d892 don't fail when insert first or appending a tile 2019-06-02 15:15:14 +02:00
Bruno Windels e339cb7321 more fixes, timeline is showing again 2019-06-02 14:59:30 +02:00
Bruno Windels a1e527ccbc first round of fixes after running the app again in the browser! 2019-06-02 00:49:47 +02:00
Bruno Windels 210a00d541 first attempt at making UI work again, with tiles and gaps 2019-06-02 00:03:55 +02:00
Bruno Windels b10aa269d2 very quick emote support 2019-06-01 18:32:17 +02:00
Bruno Windels 039bbe038c adjust tiles(collection) to entry changes 2019-06-01 18:29:02 +02:00
Bruno Windels 784588440c WIP for fragment support 2019-05-19 20:49:46 +02:00
Bruno Windels c8749a1a06 rought impl of tiles collection 2019-03-09 00:40:17 +01:00
Bruno Windels 153d54a285 work on tile view models 2019-03-09 00:40:03 +01:00
Bruno Windels 1f5d488105 draft of timeline tiles support 2019-03-08 20:04:56 +01:00