11diff --git a/Telegram/SourceFiles/core/click_handler_types.cpp b/Telegram/SourceFiles/core/click_handler_types.cpp
2- index e3bbba7..5bc409d 100644
2+ index 915b12f..78c88e8 100644
33--- a/Telegram/SourceFiles/core/click_handler_types.cpp
44+++ b/Telegram/SourceFiles/core/click_handler_types.cpp
5- @@ -333,9 +333,7 @@ void MonospaceClickHandler::onClick(ClickContext context) const {
5+ @@ -366,15 +366,6 @@ void MonospaceClickHandler::onClick(ClickContext context) const {
66 if (const auto controller = my.sessionWindow.get()) {
77 auto &data = controller->session().data();
88 const auto item = data.message(my.itemId);
99- const auto hasCopyRestriction = item
1010- && (!item->history()->peer->allowsForwarding()
1111- || item->forbidsForward());
12- + const auto hasCopyRestriction = false;
13- if (hasCopyRestriction) {
14- controller->showToast(item->history()->peer->isBroadcast()
15- ? tr::lng_error_nocopy_channel(tr::now)
12+ - if (hasCopyRestriction) {
13+ - controller->showToast(item->history()->peer->isBroadcast()
14+ - ? tr::lng_error_nocopy_channel(tr::now)
15+ - : tr::lng_error_nocopy_group(tr::now));
16+ - return;
17+ - }
18+ controller->showToast(tr::lng_text_copied(tr::now));
19+ }
20+ TextUtilities::SetClipboardText(TextForMimeData::Simple(_text.trimmed()));
1621diff --git a/Telegram/SourceFiles/data/data_story.cpp b/Telegram/SourceFiles/data/data_story.cpp
17- index d5faa43..c6b26dc 100644
22+ index 38ea28a..53ccc5a 100644
1823--- a/Telegram/SourceFiles/data/data_story.cpp
1924+++ b/Telegram/SourceFiles/data/data_story.cpp
20- @@ -318 ,12 +318 ,11 @@ bool Story::edited () const {
25+ @@ -458 ,12 +458 ,11 @@ bool Story::out () const {
2126 }
2227
2328 bool Story::canDownloadIfPremium() const {
@@ -33,10 +38,10 @@ index d5faa43..c6b26dc 100644
3338
3439 bool Story::canShare() const {
3540diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp
36- index 2f1dabe..bd6d25f 100644
41+ index 7838dda..cd77292 100644
3742--- a/Telegram/SourceFiles/history/history_inner_widget.cpp
3843+++ b/Telegram/SourceFiles/history/history_inner_widget.cpp
39- @@ -649 ,14 +649 ,7 @@ void HistoryInner::setupSharingDisallowed() {
44+ @@ -558 ,14 +558 ,7 @@ void HistoryInner::setupSharingDisallowed() {
4045 }
4146
4247 bool HistoryInner::hasSelectRestriction() const {
@@ -52,7 +57,7 @@ index 2f1dabe..bd6d25f 100644
5257 }
5358
5459 void HistoryInner::messagesReceived(
55- @@ -2665,12 +2658,12 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
60+ @@ -2847,52 +2840,27 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
5661 }
5762
5863 bool HistoryInner::hasCopyRestriction(HistoryItem *item) const {
@@ -67,27 +72,69 @@ index 2f1dabe..bd6d25f 100644
6772 }
6873
6974 bool HistoryInner::showCopyRestriction(HistoryItem *item) {
75+ - if (!hasCopyRestriction(item)) {
76+ - return false;
77+ - }
78+ - _controller->showToast(_peer->isBroadcast()
79+ - ? tr::lng_error_nocopy_channel(tr::now)
80+ - : tr::lng_error_nocopy_group(tr::now));
81+ - return true;
82+ + return false;
83+ }
84+
85+ bool HistoryInner::showCopyMediaRestriction(not_null<HistoryItem*> item) {
86+ - if (!hasCopyMediaRestriction(item)) {
87+ - return false;
88+ - }
89+ - _controller->showToast(_peer->isBroadcast()
90+ - ? tr::lng_error_nocopy_channel(tr::now)
91+ - : tr::lng_error_nocopy_group(tr::now));
92+ - return true;
93+ + return false;
94+ }
95+
96+ bool HistoryInner::hasCopyRestrictionForSelected() const {
97+ - if (hasCopyRestriction()) {
98+ - return true;
99+ - }
100+ - for (const auto &[item, selection] : _selected) {
101+ - if (item && item->forbidsForward()) {
102+ - return true;
103+ - }
104+ - }
105+ return false;
106+ }
107+
108+ bool HistoryInner::showCopyRestrictionForSelected() {
109+ - for (const auto &[item, selection] : _selected) {
110+ - if (showCopyRestriction(item)) {
111+ - return true;
112+ - }
113+ - }
114+ return false;
115+ }
116+
70117diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp
71- index 55e1def..745338c 100644
118+ index d2386e7..5f61381 100644
72119--- a/Telegram/SourceFiles/history/history_item.cpp
73120+++ b/Telegram/SourceFiles/history/history_item.cpp
74- @@ -1999 ,11 +1999 ,6 @@ bool HistoryItem::forbidsForward() const {
121+ @@ -2244 ,11 +2244 ,6 @@ bool HistoryItem::forbidsForward() const {
75122 }
76123
77124 bool HistoryItem::forbidsSaving() const {
78125- if (forbidsForward()) {
79126- return true;
80127- } else if (const auto invoice = _media ? _media->invoice() : nullptr) {
81- - return ( invoice->extendedMedia != nullptr );
128+ - return HasExtendedMedia(* invoice);
82129- }
83130 return false;
84131 }
85132
86133diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
87- index 3de0cb2..0359ab3 100644
134+ index 4155adf..5ea96fa 100644
88135--- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
89136+++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
90- @@ -1420,13 +1420,11 @@ bool ListWidget::isEmpty() const {
137+ @@ -1515,73 +1515,31 @@ bool ListWidget::isEmpty() const {
91138 }
92139
93140 bool ListWidget::hasCopyRestriction(HistoryItem *item) const {
@@ -103,7 +150,27 @@ index 3de0cb2..0359ab3 100644
103150 }
104151
105152 bool ListWidget::showCopyRestriction(HistoryItem *item) {
106- @@ -1452,21 +1450,6 @@ bool ListWidget::showCopyMediaRestriction(not_null<HistoryItem*> item) {
153+ - const auto type = _delegate->listCopyRestrictionType(item);
154+ - if (type == CopyRestrictionType::None) {
155+ - return false;
156+ - }
157+ - _delegate->listUiShow()->showToast((type == CopyRestrictionType::Channel)
158+ - ? tr::lng_error_nocopy_channel(tr::now)
159+ - : tr::lng_error_nocopy_group(tr::now));
160+ - return true;
161+ + return false;
162+ }
163+
164+ bool ListWidget::showCopyMediaRestriction(not_null<HistoryItem*> item) {
165+ - const auto type = _delegate->listCopyMediaRestrictionType(item);
166+ - if (type == CopyRestrictionType::None) {
167+ - return false;
168+ - }
169+ - _delegate->listUiShow()->showToast((type == CopyRestrictionType::Channel)
170+ - ? tr::lng_error_nocopy_channel(tr::now)
171+ - : tr::lng_error_nocopy_group(tr::now));
172+ - return true;
173+ + return false;
107174 }
108175
109176 bool ListWidget::hasCopyRestrictionForSelected() const {
@@ -125,7 +192,18 @@ index 3de0cb2..0359ab3 100644
125192 return false;
126193 }
127194
128- @@ -1485,8 +1468,7 @@ bool ListWidget::showCopyRestrictionForSelected() {
195+ bool ListWidget::showCopyRestrictionForSelected() {
196+ - if (_selected.empty()) {
197+ - if (_selectedTextItem && showCopyRestriction(_selectedTextItem)) {
198+ - return true;
199+ - }
200+ - }
201+ - for (const auto &[itemId, selection] : _selected) {
202+ - if (showCopyRestriction(session().data().message(itemId))) {
203+ - return true;
204+ - }
205+ - }
206+ return false;
129207 }
130208
131209 bool ListWidget::hasSelectRestriction() const {
@@ -134,34 +212,37 @@ index 3de0cb2..0359ab3 100644
134212+ return false;
135213 }
136214
137- auto ListWidget::findViewForPinnedTracking (int top ) const
215+ Element * ListWidget::lookupItemByY (int y ) const {
138216diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp
139- index fa0d6ed..a569215 100644
217+ index 92bd218..57c5150 100644
140218--- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp
141219+++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp
142- @@ -1153 ,15 +1153 ,14 @@ void TopBarWidget::updateMembersShowArea() {
220+ @@ -1240 ,15 +1240 ,14 @@ void TopBarWidget::updateMembersShowArea() {
143221 }
144222
145223 bool TopBarWidget::showSelectedState() const {
146224- return (_selectedCount > 0)
147225- && (_canDelete || _canForward || _canSendNow);
148- + return _selectedCount > 0;
226+ + return ( _selectedCount > 0) ;
149227 }
150228
151229 void TopBarWidget::showSelected(SelectedState state) {
152- auto canDelete = (state.count > 0 && state.count == state.canDeleteCount);
153- auto canForward = (state.count > 0 && state.count == state.canForwardCount);
154- auto canSendNow = (state.count > 0 && state.count == state.canSendNowCount);
230+ - auto canDelete = (state.count > 0 && state.count == state.canDeleteCount);
231+ - auto canForward = (state.count > 0 && state.count == state.canForwardCount);
232+ - auto canSendNow = (state.count > 0 && state.count == state.canSendNowCount);
155233- auto count = (!canDelete && !canForward && !canSendNow) ? 0 : state.count;
234+ + auto canDelete = (state.count > 0);
235+ + auto canForward = (state.count > 0);
236+ + auto canSendNow = (state.count > 0);
156237+ auto count = state.count;
157238 if (_selectedCount == count
158239 && _canDelete == canDelete
159240 && _canForward == canForward
160241diff --git a/Telegram/SourceFiles/info/media/info_media_provider.cpp b/Telegram/SourceFiles/info/media/info_media_provider.cpp
161- index 3e75975..ee23733 100644
242+ index 2fc6973..e3101f3 100644
162243--- a/Telegram/SourceFiles/info/media/info_media_provider.cpp
163244+++ b/Telegram/SourceFiles/info/media/info_media_provider.cpp
164- @@ -87,14 +87,7 @@ Type Provider::type() {
245+ @@ -88,13 +88,6 @@ Type Provider::type() {
165246 }
166247
167248 bool Provider::hasSelectRestriction() {
@@ -172,16 +253,14 @@ index 3e75975..ee23733 100644
172253- } else if (const auto channel = _peer->asChannel()) {
173254- return !channel->canDeleteMessages();
174255- }
175- - return true;
176- + return false;
256+ return true;
177257 }
178258
179- rpl::producer<bool> Provider::hasSelectRestrictionChanges() {
180259diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
181- index 0a58cdb..626773f 100644
260+ index c6a7e9c..8407567 100644
182261--- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
183262+++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
184- @@ -1031,13 +1031,7 @@ QSize OverlayWidget::flipSizeByRotation(QSize size) const {
263+ @@ -1033,26 +1033,11 @@ QSize OverlayWidget::flipSizeByRotation(QSize size) const {
185264 }
186265
187266 bool OverlayWidget::hasCopyMediaRestriction(bool skipPremiumCheck) const {
@@ -196,3 +275,17 @@ index 0a58cdb..626773f 100644
196275 }
197276
198277 bool OverlayWidget::showCopyMediaRestriction(bool skipPRemiumCheck) {
278+ - if (!hasCopyMediaRestriction(skipPRemiumCheck)) {
279+ - return false;
280+ - } else if (_stories) {
281+ - uiShow()->showToast(tr::lng_error_nocopy_story(tr::now));
282+ - } else if (_history) {
283+ - uiShow()->showToast(_history->peer->isBroadcast()
284+ - ? tr::lng_error_nocopy_channel(tr::now)
285+ - : tr::lng_error_nocopy_group(tr::now));
286+ - }
287+ - return true;
288+ + return false;
289+ }
290+
291+ bool OverlayWidget::videoShown() const {
0 commit comments