Use default encryption only for 1-on-1 chats

Signed-off-by: Maxim Logaev <maxlogaev@proton.me>
This commit is contained in:
Maxim Logaev 2024-03-26 19:59:29 +03:00
parent 47365dd7e0
commit 3e352b5a94
2 changed files with 2 additions and 20 deletions

View file

@ -11,7 +11,7 @@
<object class="AdwPreferencesGroup"> <object class="AdwPreferencesGroup">
<child> <child>
<object class="AdwActionRow"> <object class="AdwActionRow">
<property name="title" translatable="yes">Default encryption</property> <property name="title" translatable="yes">Default encryption for 1-on-1 chats</property>
<child> <child>
<object class="GtkBox" id="default_encryption_box"> <object class="GtkBox" id="default_encryption_box">
<child> <child>

View file

@ -119,22 +119,7 @@ public class ConversationViewController : Object {
return; return;
} }
bool visible = false; if (conversation.type_ == Conversation.Type.CHAT && conversation.encryption == UNKNOWN) {
// FIXME duplicate logic from encryption_button.vala
switch (conversation.type_) {
case Conversation.Type.CHAT:
visible = true;
break;
case Conversation.Type.GROUPCHAT_PM:
visible = false;
break;
case Conversation.Type.GROUPCHAT:
visible = stream_interactor.get_module(MucManager.IDENTITY).is_private_room(conversation.account, conversation.counterpart);
break;
}
if (visible && conversation.encryption == UNKNOWN) {
Dino.Entities.Settings settings = Dino.Application.get_default().settings; Dino.Entities.Settings settings = Dino.Application.get_default().settings;
if (settings.default_encryption == UNKNOWN) { if (settings.default_encryption == UNKNOWN) {
@ -182,9 +167,6 @@ public class ConversationViewController : Object {
conversation.encryption = settings.default_encryption; conversation.encryption = settings.default_encryption;
} }
} }
else if (!visible) {
conversation.encryption = Encryption.NONE;
}
} }
public void select_conversation(Conversation? conversation, bool default_initialize_conversation) { public void select_conversation(Conversation? conversation, bool default_initialize_conversation) {