Skip to content

Commit

Permalink
Use default encryption only for 1-on-1 chats
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Logaev <[email protected]>
  • Loading branch information
mxlgv committed Mar 26, 2024
1 parent 47365dd commit 3e352b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion main/data/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<object class="AdwPreferencesGroup">
<child>
<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>
<object class="GtkBox" id="default_encryption_box">
<child>
Expand Down
20 changes: 1 addition & 19 deletions main/src/ui/conversation_view_controller.vala
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,7 @@ public class ConversationViewController : Object {
return;
}

bool visible = false;

// 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) {
if (conversation.type_ == Conversation.Type.CHAT && conversation.encryption == UNKNOWN) {
Dino.Entities.Settings settings = Dino.Application.get_default().settings;

if (settings.default_encryption == UNKNOWN) {
Expand Down Expand Up @@ -182,9 +167,6 @@ public class ConversationViewController : Object {
conversation.encryption = settings.default_encryption;
}
}
else if (!visible) {
conversation.encryption = Encryption.NONE;
}
}

public void select_conversation(Conversation? conversation, bool default_initialize_conversation) {
Expand Down

0 comments on commit 3e352b5

Please sign in to comment.