Allow blocking invites from people you don't share a room with
Matrix currently has a significant moderation loophole, thanks to invites. Right now, anyone can invite anyone to a room - and clients like NeoChat will gladly display these rooms to them and even give you a notification. However, this creates a pretty easy attack since room names and avatars are arbitrary and this is a known vector of harassment in the Matrix community. There's currently no tools to block this server-side, so let's try to improve the situation where we can. This adds a new setting to the Security page, wherein it allows you to block invites from people you don't share a room with. This prevents the notification from appearing and NeoChat will attempt to leave the room immediately. Since this depends on MSC 2666 - a currently unstable feature - the server may not support it and NeoChat will disable the setting in this case.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <Quotient/csapi/content-repo.h>
|
||||
#include <Quotient/csapi/profile.h>
|
||||
#include <Quotient/csapi/versions.h>
|
||||
#include <Quotient/database.h>
|
||||
#include <Quotient/jobs/downloadfilejob.h>
|
||||
#include <Quotient/qt_connection_util.h>
|
||||
@@ -132,6 +133,21 @@ void NeoChatConnection::connectSignals()
|
||||
Q_EMIT homeNotificationsChanged();
|
||||
Q_EMIT homeHaveHighlightNotificationsChanged();
|
||||
});
|
||||
|
||||
// Fetch unstable features
|
||||
// TODO: Expose unstableFeatures() in libQuotient
|
||||
connect(
|
||||
this,
|
||||
&Connection::connected,
|
||||
this,
|
||||
[this] {
|
||||
auto job = callApi<GetVersionsJob>(BackgroundRequest);
|
||||
connect(job, &GetVersionsJob::success, this, [this, job] {
|
||||
m_canCheckMutualRooms = job->unstableFeatures().contains("uk.half-shot.msc2666.query_mutual_rooms"_ls);
|
||||
Q_EMIT canCheckMutualRoomsChanged();
|
||||
});
|
||||
},
|
||||
Qt::SingleShotConnection);
|
||||
}
|
||||
|
||||
int NeoChatConnection::badgeNotificationCount() const
|
||||
@@ -200,6 +216,11 @@ QVariantList NeoChatConnection::getSupportedRoomVersions() const
|
||||
return supportedRoomVersions;
|
||||
}
|
||||
|
||||
bool NeoChatConnection::canCheckMutualRooms() const
|
||||
{
|
||||
return m_canCheckMutualRooms;
|
||||
}
|
||||
|
||||
void NeoChatConnection::changePassword(const QString ¤tPassword, const QString &newPassword)
|
||||
{
|
||||
auto job = callApi<NeochatChangePasswordJob>(newPassword, false);
|
||||
|
||||
Reference in New Issue
Block a user