Compare commits

..

3 Commits

Author SHA1 Message Date
James Graham
685ce5b874 Set a color to avoid heap-buffer overflow 2023-07-22 20:40:36 +01:00
Carl Schwan
ed5bb270ff Discard wrong avatar urls 2023-07-22 17:51:03 +00:00
Carl Schwan
c8b4da2b96 Scroll to top of RoomDrawer on loading of header 2023-07-22 17:50:32 +00:00
4 changed files with 10 additions and 31 deletions

View File

@@ -4,10 +4,12 @@
#include <QObject>
#include <QTest>
#include "neochatuser.h"
#include "texthandler.h"
#include <Quotient/quotient_common.h>
#include <Quotient/syncdata.h>
#include <Quotient/user.h>
#include <qnamespace.h>
using namespace Quotient;
@@ -555,9 +557,9 @@ void TextHandlerTest::receiveRichPlainUrl()
void TextHandlerTest::receiveRichEmote()
{
auto event = room->messageEvents().at(1).get();
auto author = static_cast<NeoChatUser *>(room->user(event->senderId()));
auto author = new NeoChatUser(event->senderId(), connection);
const QString testInputString = QStringLiteral("This is an emote.");
const QString testOutputString = QStringLiteral("* <a href=\"https://matrix.to/#/@example:example.org\" style=\"color:") + author->color().name()
const QString testOutputString = QStringLiteral("* <a href=\"https://matrix.to/#/@example:example.org\" style=\"color:#000000")
+ QStringLiteral("\">@example:example.org</a> This is an emote.");
TextHandler testTextHandler;
@@ -644,5 +646,5 @@ void TextHandlerTest::linkPreviewsReject()
QCOMPARE(testTextHandler.getLinkPreviews(), testOutputLinks);
}
QTEST_GUILESS_MAIN(TextHandlerTest)
QTEST_MAIN(TextHandlerTest)
#include "texthandlertest.moc"

View File

@@ -1941,7 +1941,7 @@ QByteArray NeoChatRoom::roomAcountDataJson(const QString &eventType)
QUrl NeoChatRoom::avatarForMember(NeoChatUser *user) const
{
const auto &url = memberAvatarUrl(user->id());
if (url.isEmpty()) {
if (url.isEmpty() || url.scheme() != "mxc"_ls) {
return {};
}
auto avatar = connection()->makeMediaUrl(url);

View File

@@ -105,10 +105,6 @@ TimelineContainer {
Layout.preferredHeight: imageHeight
source: root.mediaInfo.source
Drag.active: dragHandler.active
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Image {
anchors.fill: parent
source: root.mediaInfo.tempInfo.source
@@ -145,28 +141,6 @@ TimelineContainer {
}
}
Item {
anchors.fill: parent
DragHandler {
id: dragHandler
enabled: img.status === Image.Ready
onActiveChanged: {
if (active) {
img.grabToImage((result) => {
img.Drag.mimeData = {
"image/png": result.image,
};
img.Drag.active = dragHandler.active;
});
} else {
img.Drag.active = false;
}
}
}
}
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: {

View File

@@ -74,7 +74,7 @@ Kirigami.OverlayDrawer {
active: roomDrawer.drawerOpen
sourceComponent: ColumnLayout {
readonly property string userSearchText: userListView.headerItem.userListSearchField.text
readonly property string userSearchText: userListView.headerItem ? userListView.headerItem.userListSearchField.text : ''
property alias highlightedUser: userListView.currentIndex
spacing: 0
@@ -129,6 +129,9 @@ Kirigami.OverlayDrawer {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.smallSpacing
sourceComponent: room.isDirectChat() ? directChatDrawerHeader : groupChatDrawerHeader
onItemChanged: if (item) {
userListView.positionViewAtBeginning();
}
}
Kirigami.ListSectionHeader {