From 20b19dbf8fd2a338143d7cd4a0dc036848be80a6 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Mon, 31 Jul 2023 00:34:40 +0300 Subject: 2023-07-31 --- modules/common/common/nix/default.nix | 8 +++- .../common/nix/patches/tdesktop-no-ads.patch | 45 ++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 modules/common/common/nix/patches/tdesktop-no-ads.patch (limited to 'modules') diff --git a/modules/common/common/nix/default.nix b/modules/common/common/nix/default.nix index 43586d3..29db931 100644 --- a/modules/common/common/nix/default.nix +++ b/modules/common/common/nix/default.nix @@ -95,8 +95,12 @@ with lib; { plugins = with kubernetes-helmPlugins; [helm-secrets]; }; - alejandra = super.alejandra.overrideAttrs (_: _: { - patches = [./patches/alejandra-no-ads.patch]; + alejandra = super.alejandra.overrideAttrs (_: final: { + patches = final.patches ++ [./patches/alejandra-no-ads.patch]; + }); + + tdesktop = super.tdesktop.overrideAttrs (_: final: { + patches = final.patches ++ [./patches/tdesktop-no-ads.patch]; }); openmw = super.openmw.overrideAttrs (_: final: { diff --git a/modules/common/common/nix/patches/tdesktop-no-ads.patch b/modules/common/common/nix/patches/tdesktop-no-ads.patch new file mode 100644 index 0000000..d066066 --- /dev/null +++ b/modules/common/common/nix/patches/tdesktop-no-ads.patch @@ -0,0 +1,45 @@ +diff --git i/Telegram/SourceFiles/data/data_sponsored_messages.cpp w/Telegram/SourceFiles/data/data_sponsored_messages.cpp +index fa21af469..263ea3e61 100644 +--- i/Telegram/SourceFiles/data/data_sponsored_messages.cpp ++++ w/Telegram/SourceFiles/data/data_sponsored_messages.cpp +@@ -179,39 +179,7 @@ bool SponsoredMessages::canHaveFor(not_null history) const { + } + + void SponsoredMessages::request(not_null history, Fn done) { +- if (!canHaveFor(history)) { +- return; +- } +- auto &request = _requests[history]; +- if (request.requestId || TooEarlyForRequest(request.lastReceived)) { +- return; +- } +- { +- const auto it = _data.find(history); +- if (it != end(_data)) { +- auto &list = it->second; +- // Don't rebuild currently displayed messages. +- const auto proj = [](const Entry &e) { +- return e.item != nullptr; +- }; +- if (ranges::any_of(list.entries, proj)) { +- return; +- } +- } +- } +- const auto channel = history->peer->asChannel(); +- Assert(channel != nullptr); +- request.requestId = _session->api().request( +- MTPchannels_GetSponsoredMessages( +- channel->inputChannel) +- ).done([=](const MTPmessages_sponsoredMessages &result) { +- parse(history, result); +- if (done) { +- done(); +- } +- }).fail([=] { +- _requests.remove(history); +- }).send(); ++ return; + } + + void SponsoredMessages::parse( -- cgit 1.4.1