From 01a547ef18a52064cc85d1050c60f37bb50bd028 Mon Sep 17 00:00:00 2001 From: Miquel Lionel Date: Sun, 8 Oct 2023 17:45:16 +0200 Subject: Allow blocking entire domain from conversation details - the block domain option is in a drop down of the block button - when blocking the domain, the "Blocked domain" button appears and block button disappears and vice versa. --- main/src/ui/conversation_details.vala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'main/src/ui') diff --git a/main/src/ui/conversation_details.vala b/main/src/ui/conversation_details.vala index 1c82f105..7a00c786 100644 --- a/main/src/ui/conversation_details.vala +++ b/main/src/ui/conversation_details.vala @@ -10,6 +10,7 @@ namespace Dino.Ui.ConversationDetails { model.conversation = conversation; model.display_name = stream_interactor.get_module(ContactModels.IDENTITY).get_display_name_model(conversation); model.blocked = stream_interactor.get_module(BlockingManager.IDENTITY).is_blocked(model.conversation.account, model.conversation.counterpart); + model.domain_blocked = stream_interactor.get_module(BlockingManager.IDENTITY).is_blocked(model.conversation.account, model.conversation.counterpart, true); if (conversation.type_ == Conversation.Type.GROUPCHAT) { stream_interactor.get_module(MucManager.IDENTITY).get_config_form.begin(conversation.account, conversation.counterpart, (_, res) => { @@ -58,6 +59,7 @@ namespace Dino.Ui.ConversationDetails { return true; }); model.bind_property("blocked", view_model, "blocked", BindingFlags.SYNC_CREATE); + model.bind_property("domain_blocked", view_model, "domain_blocked", BindingFlags.SYNC_CREATE); model.bind_property("data-form", view_model, "room-configuration-rows", BindingFlags.SYNC_CREATE, (_, from, ref to) => { var data_form = (DataForms.DataForm) from; if (data_form == null) return true; @@ -85,6 +87,14 @@ namespace Dino.Ui.ConversationDetails { } view_model.blocked = !view_model.blocked; }); + view_model.domain_block_changed.connect(() => { + if (view_model.domain_blocked) { + stream_interactor.get_module(BlockingManager.IDENTITY).unblock(model.conversation.account, model.conversation.counterpart, true); + } else { + stream_interactor.get_module(BlockingManager.IDENTITY).block(model.conversation.account, model.conversation.counterpart, true); + } + view_model.domain_blocked = !view_model.domain_blocked; + }); view_model.notification_changed.connect((setting) => { switch (setting) { case ON: @@ -189,4 +199,4 @@ namespace Dino.Ui.ConversationDetails { break; } } -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2