summarylogtreecommitdiffstats
path: root/334.patch
blob: 98a67e2abfcbe531642f1fe6ffceebb11a514950 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
From d95b85c16af87f35ba5489277a7e46402fe72b48 Mon Sep 17 00:00:00 2001
From: blank X <blankie@nixnetmail.com>
Date: Sat, 12 Mar 2022 21:26:49 +0700
Subject: [PATCH] Add option to disable short info box

Fixes #332
---
 Telegram/Resources/langs/rewrites/en.json                    | 1 +
 Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp   | 3 ++-
 Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp  | 5 +++++
 .../history/view/reactions/message_reactions_list.cpp        | 5 +++++
 Telegram/SourceFiles/kotato/kotato_settings.cpp              | 3 +++
 Telegram/SourceFiles/kotato/kotato_settings_menu.cpp         | 1 +
 6 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json
index e50ac3e253..3d6481d69e 100644
--- a/Telegram/Resources/langs/rewrites/en.json
+++ b/Telegram/Resources/langs/rewrites/en.json
@@ -274,5 +274,6 @@
 	"ktg_settings_view_profile_on_top_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.",
 	"ktg_settings_emoji_sidebar": "Enable emoji sidebar",
 	"ktg_settings_emoji_sidebar_right_click": "Emoji sidebar on right click",
+	"ktg_settings_disable_short_info_box": "Disable short info box",
 	"dummy_last_string": ""
 }
diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
index 83bf0fb6fb..9b0d9119e5 100644
--- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
 */
 #include "boxes/peers/edit_participants_box.h"
 
+#include "kotato/kotato_settings.h"
 #include "kotato/kotato_lang.h"
 #include "api/api_chat_participants.h"
 #include "boxes/peer_list_controllers.h"
@@ -1495,7 +1496,7 @@ void ParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
 		showRestricted(user);
 	} else {
 		Assert(_navigation != nullptr);
-		if (_role != Role::Profile) {
+		if (_role != Role::Profile && !::Kotato::JsonSettings::GetBool("disable_short_info_box")) {
 			_navigation->parentController()->show(PrepareShortInfoBox(
 				participant,
 				_navigation));
diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp
index 02370e74a9..f64254e4dd 100644
--- a/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
 */
 #include "boxes/peers/edit_peer_requests_box.h"
 
+#include "kotato/kotato_settings.h"
 #include "ui/effects/ripple_animation.h"
 #include "boxes/peer_list_controllers.h"
 #include "boxes/peers/edit_participants_box.h" // SubscribeToMigration
@@ -355,6 +356,10 @@ void RequestsBoxController::refreshDescription() {
 }
 
 void RequestsBoxController::rowClicked(not_null<PeerListRow*> row) {
+	if (::Kotato::JsonSettings::GetBool("disable_short_info_box")) {
+		_navigation->showPeerInfo(row->peer());
+		return;
+	}
 	_navigation->parentController()->show(PrepareShortInfoBox(
 		row->peer(),
 		_navigation));
diff --git a/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp b/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp
index a5f6e67991..8731933996 100644
--- a/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp
+++ b/Telegram/SourceFiles/history/view/reactions/message_reactions_list.cpp
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
 */
 #include "history/view/reactions/message_reactions_list.h"
 
+#include "kotato/kotato_settings.h"
 #include "history/view/reactions/message_reactions_selector.h"
 #include "boxes/peer_list_box.h"
 #include "boxes/peers/prepare_short_info_box.h"
@@ -284,6 +285,10 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
 	const auto window = _window;
 	const auto peer = row->peer();
 	crl::on_main(window, [=] {
+		if (::Kotato::JsonSettings::GetBool("disable_short_info_box")) {
+			window->showPeerInfo(peer);
+			return;
+		}
 		window->show(PrepareShortInfoBox(peer, window));
 	});
 }
diff --git a/Telegram/SourceFiles/kotato/kotato_settings.cpp b/Telegram/SourceFiles/kotato/kotato_settings.cpp
index 9b0513d82d..28640c00fa 100644
--- a/Telegram/SourceFiles/kotato/kotato_settings.cpp
+++ b/Telegram/SourceFiles/kotato/kotato_settings.cpp
@@ -471,6 +471,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
 	{ "emoji_sidebar_right_click", {
 		.type = SettingType::BoolSetting,
 		.defaultValue = false, }},
+	{ "disable_short_info_box", {
+		.type = SettingType::BoolSetting,
+		.defaultValue = false, }},
 };
 
 using OldOptionKey = QString;
diff --git a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp
index 88249d0d37..2f65eb3f4b 100644
--- a/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp
+++ b/Telegram/SourceFiles/kotato/kotato_settings_menu.cpp
@@ -770,6 +770,7 @@ void SetupKotatoOther(
 	});
 
 	SettingsMenuJsonSwitch(ktg_settings_call_confirm, confirm_before_calls);
+	SettingsMenuJsonSwitch(ktg_settings_disable_short_info_box, disable_short_info_box);
 	SettingsMenuJsonSwitch(ktg_settings_remember_compress_images, remember_compress_images);
 	AddButton(
 		container,