Title this adds a number of options for when messages should be automatically marked as read for the user to choose from.
{width=480 height=262}
Refactor TimelineView to make it more reliable and prepare for read marker choice. This is done by creating signalling from the mode when reset which can be used to move the scrollbar to the newest meassage.
Some of the spaghetti is also removed so there is no need for ChatBar and TimelineView to talk directly.
The code to mark messages as read if they are all visible after 10s has been removed infour of just marking as read on entry if all are visible. This is temporary until a follow up providing user options is finished (although it will be one of the options)
I was originally going to add another test case to this, turns out I
didn't need to. Might as well ship this anyway, as it will make it
trivial to add more in the future.
There were some cases that was hit that revealed some mistakes in the
code block checking code, which is now fixed. Basically, we just needed
to make sure the indices were updated at the right times. I also took
some time to clean up some of the comments, and magic numbers used here.
A new test case was added that was failing before in real-world testing.
This should allow for creating tests more easily than the python-based server, since we can poke at it from C++ code.
The idea is that each test creates the things it needs (rooms in a certain state, etc) programmatically instead of through
the json files we use for the other tests. This allows us to adapt the test data to each test as needed, without having to copy it around a lot.
Similar to spoilers, some Markdown flavors like GitHub's or Discord's
allow you to strike through text with ~~. Normally, the only way to do
this on most Matrix clients (including Element) is surrounding text with
<del> tags. As expected, no one knows how to do this.
So now NeoChat supports the ~~ syntax. We can reuse the existing spoiler
parser for this after making it generic. I have added new test cases for
this syntax. This does not affect the quick format bar yet.
Currently the only two ways to spoiler text in your message is either:
* Using the /spoiler command
* Manually typing the data-mx-spoiler span HTML blocks
Neither one is discoverable, or friendly to users really. Instead, we
should extend our existing Markdown-based formatting syntax with one
that can handle spoiler tags. I chose the || syntax to match Discord,
since Element doesn't seem to adopt one.
Unfortunately, CMark does not support custom extensions (see
https://github.com/commonmark/cmark/pull/123) so we have to implement
our own parsing function. New tests are also added for this too.
This was a mistake in the code that was designed to remove the outside
paragraphs, which seems to be to make way for the quotation marks we
add around the text. Instead of doing that (which turns out, is very
brittle and breaks on multiple paragraphs) insert the quotation marks
*inside* of the paragraph tags.
A test case is added for this as well.
This means that all content models will now come from the same source to remove duplication across multiple models and `chatbarcaches`.
It also handily breaks the dependency on needing `MessageContentModel` for `NeochatRoom`
Make `DelegateSizeHelper` take a `QQuickItem` rather than a width value and move `TimelineDelegate` to use it rather than duplicting the code.
This requires the creation of `LibNeoChat` so that both the main and timeline modules can get access to the class.
Note: ideally more stuff will go into `LibNeoChat` but it turns out our dependencies are kinda spaghetti like and so will take some untangling.
Fix showing polls and update the events and PollHandler to make them easier to work with.
Add a PollAnswerModel to visualise poll answers.
Enable sending polls.
There is no need for NeochatConnection to depend on ThreePIdModel and also this means it's not in memory when not needed.
Also a little cleanup to make sure only a single job can run at a time.
Move the reaction delegate into the bubble so it can be instantiated by the Content model. This aims to make sure we only instantiate it when needed rather than for every event. You can now hover the event to show the ReactionComponent with a button to add a reaction if none are currently present
Added bonus ReactionModel no longer needs an event pointer, the event ID is enough to get reaction from the room so things are less likely to blow up.
- Make an empty message type optional mean "no message"
- Set message type for all actions that send a message through the normal mechanism
- Remove now redundant bool specifying whether a message should be sent
Since _ls is now deprecated this is removed in favour of L1, I've also taken the oportunity to replace QStringLiteral and QLatin1String with their shortened form while we're at it.
There are also a few instances where the string literal type has been switch, the general rule being to use the one that matches the function type or value being compared to avoid conversions.
Some clients - such as Element - can send colored text through <span>,
which fails to display in Qt's rich text parser. So we need to transform
that into CSS styles which is supported by Qt.
Notably this allows you to exchange rainbow shrugs through Matrix, which
is really important. And this means colored backgrounds for text is
supported too, I guess.
Move the fucntionality of ActionsHandler into ChatbarCache and ActionsModel.
At this stage there wasn't much left that is was doing and the functionality could easily move.
It feels weird to have anything that needs MessageComponent have to depend on all of MessageContentModel and pull in it's dependencies. This moves MessageComponent into its own header.
Rework ActionsHandler as static helper functions.
The functions are now invoked from ChatBarCache so there is no need to pass an actions handler object around qml simplifying the code.
Move reply pane to use MessageContentModel. This means the reply pane component is no longer required.
This commit also limits the size of code and image componets in a reply to keep them from getting too huge.
Turns out trying to manage pointers in the model is a bad idea so only save eventId in MessageContentModel, events pointers will now only be obtained temporarily then discarded to avoid both creating additional copies of the event in the model and potential sources of crashes.
This also creates a basic unit test that we can add to going forward.
Change the generic representations of events in event handler to always have a full string to aid translation.
The aggregated list is then converted to be a simple list of single event generic descriptions to avoid string puzzles.
Fixesnetwork/neochat#638
BUG: 466201, BUG: 491024
If there was no space between the tag name and the slash of a self-closing tag,
the code assumes that the tag name is "br/". This commit adds the slash as a
character to close a tag on, so that "<br/>" is treated as a self-closing "br".
BUG: 487377
{width=148 height=210}
Note: there is still an issue where after starting a new thread the threaded messages only appear after a restart as the root event needs re-downloading from the server to get the thread info added. My plan is to tackle this next.
- Clear out unused functions
- All functions are now static
This is because we pretty much always used it in the form:
```
EventHandler eventHandler(room, event);
eventHandler.function();
```
This simplifies it all to a single call.
The intention is that NeochatRoomMember can be created passed to QML and then be fully managed by it. It effectively just grabs the current RoomMember, calls the correct function then discards it so that we don't end up trying to access an already deleted state event.
Create a list model for read markers. The primary reason is to stop `RoomMembers` being accessed after their state event is deleted. With this the read marker doesn't pass and `RoomMember` objects to qml.
Depends on https://github.com/quotient-im/libQuotient/pull/695
Currently basic just to show a working implementation using RoomMember. Currently only the room event and search models are moved over. Will change everything else over once the dependent pr is complete.
This matches previous behavior before
e2eb6ab33c and including the markdown
blockquote breaks edits. This also adds a test to ensure it does indeed
get stripped.