aurpkg/telegram-desktop-patches-ma.../0002-Disable-saving-restric...

199 lines
7.1 KiB
Diff

diff --git a/Telegram/SourceFiles/core/click_handler_types.cpp b/Telegram/SourceFiles/core/click_handler_types.cpp
index e3bbba7..5bc409d 100644
--- a/Telegram/SourceFiles/core/click_handler_types.cpp
+++ b/Telegram/SourceFiles/core/click_handler_types.cpp
@@ -333,9 +333,7 @@ void MonospaceClickHandler::onClick(ClickContext context) const {
if (const auto controller = my.sessionWindow.get()) {
auto &data = controller->session().data();
const auto item = data.message(my.itemId);
- const auto hasCopyRestriction = item
- && (!item->history()->peer->allowsForwarding()
- || item->forbidsForward());
+ const auto hasCopyRestriction = false;
if (hasCopyRestriction) {
controller->showToast(item->history()->peer->isBroadcast()
? tr::lng_error_nocopy_channel(tr::now)
diff --git a/Telegram/SourceFiles/data/data_story.cpp b/Telegram/SourceFiles/data/data_story.cpp
index d5faa43..c6b26dc 100644
--- a/Telegram/SourceFiles/data/data_story.cpp
+++ b/Telegram/SourceFiles/data/data_story.cpp
@@ -318,12 +318,11 @@ bool Story::edited() const {
}
bool Story::canDownloadIfPremium() const {
- return !forbidsForward() || _peer->isSelf();
+ return true;
}
bool Story::canDownloadChecked() const {
- return _peer->isSelf()
- || (canDownloadIfPremium() && _peer->session().premium());
+ return true;
}
bool Story::canShare() const {
diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp
index 2f1dabe..bd6d25f 100644
--- a/Telegram/SourceFiles/history/history_inner_widget.cpp
+++ b/Telegram/SourceFiles/history/history_inner_widget.cpp
@@ -649,14 +649,7 @@ void HistoryInner::setupSharingDisallowed() {
}
bool HistoryInner::hasSelectRestriction() const {
- if (!_sharingDisallowed.current()) {
- return false;
- } else if (const auto chat = _peer->asChat()) {
- return !chat->canDeleteMessages();
- } else if (const auto channel = _peer->asChannel()) {
- return !channel->canDeleteMessages();
- }
- return true;
+ return false;
}
void HistoryInner::messagesReceived(
@@ -2665,12 +2658,12 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
bool HistoryInner::hasCopyRestriction(HistoryItem *item) const {
- return !_peer->allowsForwarding() || (item && item->forbidsForward());
+ return false;
}
bool HistoryInner::hasCopyMediaRestriction(
not_null<HistoryItem*> item) const {
- return hasCopyRestriction(item) || item->forbidsSaving();
+ return false;
}
bool HistoryInner::showCopyRestriction(HistoryItem *item) {
diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp
index 55e1def..745338c 100644
--- a/Telegram/SourceFiles/history/history_item.cpp
+++ b/Telegram/SourceFiles/history/history_item.cpp
@@ -1999,11 +1999,6 @@ bool HistoryItem::forbidsForward() const {
}
bool HistoryItem::forbidsSaving() const {
- if (forbidsForward()) {
- return true;
- } else if (const auto invoice = _media ? _media->invoice() : nullptr) {
- return (invoice->extendedMedia != nullptr);
- }
return false;
}
diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
index 3de0cb2..0359ab3 100644
--- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
+++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
@@ -1420,13 +1420,11 @@ bool ListWidget::isEmpty() const {
}
bool ListWidget::hasCopyRestriction(HistoryItem *item) const {
- return _delegate->listCopyRestrictionType(item)
- != CopyRestrictionType::None;
+ return false;
}
bool ListWidget::hasCopyMediaRestriction(not_null<HistoryItem*> item) const {
- return _delegate->listCopyMediaRestrictionType(item)
- != CopyRestrictionType::None;
+ return false;
}
bool ListWidget::showCopyRestriction(HistoryItem *item) {
@@ -1452,21 +1450,6 @@ bool ListWidget::showCopyMediaRestriction(not_null<HistoryItem*> item) {
}
bool ListWidget::hasCopyRestrictionForSelected() const {
- if (hasCopyRestriction()) {
- return true;
- }
- if (_selected.empty()) {
- if (_selectedTextItem && _selectedTextItem->forbidsForward()) {
- return true;
- }
- }
- for (const auto &[itemId, selection] : _selected) {
- if (const auto item = session().data().message(itemId)) {
- if (item->forbidsForward()) {
- return true;
- }
- }
- }
return false;
}
@@ -1485,8 +1468,7 @@ bool ListWidget::showCopyRestrictionForSelected() {
}
bool ListWidget::hasSelectRestriction() const {
- return _delegate->listSelectRestrictionType()
- != CopyRestrictionType::None;
+ return false;
}
auto ListWidget::findViewForPinnedTracking(int top) const
diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp
index fa0d6ed..a569215 100644
--- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp
+++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp
@@ -1153,15 +1153,14 @@ void TopBarWidget::updateMembersShowArea() {
}
bool TopBarWidget::showSelectedState() const {
- return (_selectedCount > 0)
- && (_canDelete || _canForward || _canSendNow);
+ return _selectedCount > 0;
}
void TopBarWidget::showSelected(SelectedState state) {
auto canDelete = (state.count > 0 && state.count == state.canDeleteCount);
auto canForward = (state.count > 0 && state.count == state.canForwardCount);
auto canSendNow = (state.count > 0 && state.count == state.canSendNowCount);
- auto count = (!canDelete && !canForward && !canSendNow) ? 0 : state.count;
+ auto count = state.count;
if (_selectedCount == count
&& _canDelete == canDelete
&& _canForward == canForward
diff --git a/Telegram/SourceFiles/info/media/info_media_provider.cpp b/Telegram/SourceFiles/info/media/info_media_provider.cpp
index 3e75975..ee23733 100644
--- a/Telegram/SourceFiles/info/media/info_media_provider.cpp
+++ b/Telegram/SourceFiles/info/media/info_media_provider.cpp
@@ -87,14 +87,7 @@ Type Provider::type() {
}
bool Provider::hasSelectRestriction() {
- if (_peer->allowsForwarding()) {
- return false;
- } else if (const auto chat = _peer->asChat()) {
- return !chat->canDeleteMessages();
- } else if (const auto channel = _peer->asChannel()) {
- return !channel->canDeleteMessages();
- }
- return true;
+ return false;
}
rpl::producer<bool> Provider::hasSelectRestrictionChanges() {
diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
index 0a58cdb..626773f 100644
--- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
+++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp
@@ -1031,13 +1031,7 @@ QSize OverlayWidget::flipSizeByRotation(QSize size) const {
}
bool OverlayWidget::hasCopyMediaRestriction(bool skipPremiumCheck) const {
- if (const auto story = _stories ? _stories->story() : nullptr) {
- return skipPremiumCheck
- ? !story->canDownloadIfPremium()
- : !story->canDownloadChecked();
- }
- return (_history && !_history->peer->allowsForwarding())
- || (_message && _message->forbidsSaving());
+ return false;
}
bool OverlayWidget::showCopyMediaRestriction(bool skipPRemiumCheck) {