Commit graph

278 commits

Author SHA1 Message Date
Danila Fedorin
78d7d556e4 Add blockquote and del elements. 2021-07-14 12:38:55 -07:00
Danila Fedorin
763e1cd5de Add tentative version of linkification. 2021-07-13 16:56:46 -07:00
Danila Fedorin
0c05ff459c Add another test. 2021-07-13 15:14:03 -07:00
Danila Fedorin
5e39eb8f6c Do some additional validation, blocking block nodes inside inline nodes. 2021-07-13 14:47:10 -07:00
Danila Fedorin
4b92903ddd Add a test for auto-closing tags. 2021-07-12 15:16:04 -07:00
Danila Fedorin
4022c6121b Switch to DOMPurify in platform layer for sanitization. 2021-07-12 15:00:16 -07:00
Danila Fedorin
012ef2b215 Validate w/h and avoid use of properties object. 2021-07-12 13:42:39 -07:00
Danila Fedorin
1e9cdbafd4 Move test-specific code into the testing function. 2021-07-12 13:31:33 -07:00
Danila Fedorin
fd17ffecfb Pass parameters to parseHTMLBody directly instead of via object. 2021-07-12 12:55:33 -07:00
Danila Fedorin
c261b9fb23 Avoid intermediate objects while parsing TextTiles' bodies. 2021-07-12 12:47:22 -07:00
Danila Fedorin
9304ca330e Rewrite deserialize as a class to avoid passing options around. 2021-07-12 12:19:51 -07:00
Danila Fedorin
abd62373e5 Remove copy of MediaRepository mxcUrl parsing. 2021-07-09 13:09:19 -07:00
Danila Fedorin
1435c2c9a2 Add HTML sanitization to domain layer. 2021-07-09 13:06:24 -07:00
Danila Fedorin
d38c52d311 Display images in messages 2021-07-08 00:16:58 -07:00
Danila Fedorin
c582b723bd Start working on images. 2021-07-07 23:40:16 -07:00
Danila Fedorin
eca5308742 Move deserialization into domain and fix tests. 2021-07-07 12:21:10 -07:00
Danila Fedorin
e56b15237e Parse formatted message bodies in addition to plain ones. 2021-07-06 16:14:04 -07:00
Danila Fedorin
6ba2deffef Make small tweaks to formatted representation. 2021-07-02 18:19:40 -07:00
Danila Fedorin
94f6c99ea6 Begin a parser implementation from HTML into an internal representation. 2021-07-02 00:18:37 -07:00
Danila Fedorin
4ee15005f5 Inline code blocks don't contain other elements 2021-07-01 13:55:01 -07:00
Danila Fedorin
fd12baae3b Add some other message parts as demo. 2021-07-01 13:55:01 -07:00
Danila Fedorin
ad868818c7 Add some initial thoughts on the implementation. 2021-07-01 13:55:01 -07:00
Bruno Windels
dbaef5117a
Merge pull request #384 from vector-im/bwindels/reactions
Reactions
2021-06-24 15:01:44 +00:00
Bruno Windels
bb6417dab9 fix lint 2021-06-24 15:24:53 +02:00
Bruno Windels
5984e8dd6d don't show reactions for redacted messages 2021-06-24 14:49:43 +02:00
Bruno Windels
787308375c prevent toggling in vm while already busy
otherwise the check in SendQueue to prevent duplicates might fail
2021-06-24 14:33:16 +02:00
Bruno Windels
299294daff prevent re(d)action in left/kicked room 2021-06-24 14:24:22 +02:00
Bruno Windels
3fa0f234bb not used 2021-06-24 14:12:55 +02:00
Bruno Windels
366d3761b8 remove waiting for update event (it might not come in case of dupe)
also remove duplicate logging impl for re(d)action at cost of
double haveAnnotation call
2021-06-24 13:35:59 +02:00
Bruno Windels
7557e2f437 not used 2021-06-24 13:26:14 +02:00
Bruno Windels
38b465cb9d rename vm.toggleReaction to vm.toggle 2021-06-24 13:15:20 +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
c585d76ce5 also clear pending reaction promise when an error is thrown 2021-06-23 17:47:47 +02:00
Bruno Windels
1a5a64864a don't double log redactReaction 2021-06-23 17:47:18 +02:00
Bruno Windels
48588687a5 share logic whether have reacted already between basemsgtile & reactvm 2021-06-23 15:38:12 +02:00
Bruno Windels
a1d24894eb this will block if we have a pending redaction & reaction
so the reaction won't be aborted
2021-06-23 11:45:24 +02:00
Bruno Windels
442d4cce03 make the react/redactReaction promise only return after update happened 2021-06-23 11:44:53 +02:00
Bruno Windels
18562d30d8 integration tests for local echo of toggling reactions 2021-06-23 11:43:14 +02:00
Bruno Windels
b153613200 determine toggle state correctly with both pending redaction & reaction 2021-06-23 11:41:28 +02:00
RMidhunSuresh
12305be06a Fix issue #397
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-06-19 16:01:02 +05:30
Bruno Windels
099f99a96b check power levels to see if we can react 2021-06-17 09:41:25 +02:00
Bruno Windels
fd54539e1c clarify comment 2021-06-17 09:41:10 +02:00
Bruno Windels
94635a18e0 actually, 0 or -1 mean you have a local redaction 2021-06-16 12:41:42 +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
81a721f880 make equality stable in comparator for reaction 2021-06-11 11:04:48 +02:00
Bruno Windels
1d9709d4e3 also compare by key if the timestamps are the same 2021-06-11 11:02:31 +02:00
Bruno Windels
757e08c62c WIP 4 2021-06-10 18:29:10 +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
280de98858 fix lint 2021-06-04 16:41:37 +02:00
Bruno Windels
b7402ce43c support local echo for adding a reaction 2021-06-04 15:34:44 +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
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