Add a way to block invites from all users

This is a useful safety feature, not just for people under attack but
also if you have no use for this feature. Currently this is gated for
servers that support Matrix CSAPI 1.18.

Fixes #662
This commit is contained in:
Joshua Goins
2026-02-19 17:55:02 -05:00
parent 3b00e14a9d
commit 1eba52bb7a
3 changed files with 46 additions and 4 deletions

View File

@@ -87,17 +87,31 @@ FormCard.FormCardPage {
title: i18nc("@title:group", "Invites")
}
FormCard.FormCard {
FormCard.FormCheckDelegate {
FormCard.FormRadioDelegate {
text: i18nc("@info:label", "Everyone")
checked: !NeoChatConfig.rejectUnknownInvites && !root.connection.blockAllInvites
description: i18nc("@info:description", "Anyone can send you invites.")
}
FormCard.FormRadioDelegate {
id: rejectInvitationsDelegate
text: i18nc("@option:check", "Reject invitations from unknown users")
description: root.connection.canCheckMutualRooms ? i18nc("@info", "If enabled, NeoChat will reject invitations from users you don't share a room with.") : i18nc("@info", "Your server does not support this setting.")
text: i18nc("@option:check", "Known users")
description: root.connection.canCheckMutualRooms ? i18nc("@info", "Only users you share a room with can send you invites.") : i18nc("@info", "Your server does not support this setting.")
checked: NeoChatConfig.rejectUnknownInvites
enabled: !NeoChatConfig.isRejectUnknownInvitesImmutable && root.connection.canCheckMutualRooms
onToggled: {
onCheckedChanged: {
NeoChatConfig.rejectUnknownInvites = checked;
NeoChatConfig.save();
}
}
FormCard.FormRadioDelegate {
text: i18nc("@info:label", "No one")
checked: root.connection.blockAllInvites
enabled: root.connection.supportsMatrixSpecVersion("v1.18")
description: root.connection.supportsMatrixSpecVersion("v1.18") ? i18nc("@info:description", "No one can send you invites.") : i18nc("@info", "Your server does not support this setting.")
onCheckedChanged: root.connection.blockAllInvites = checked
}
}
FormCard.FormHeader {
title: i18nc("@title:group", "Encryption")