From 4f8e914d535d9b33c1d5770b7739b271ad1ff50f Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 15 Aug 2024 00:32:37 +0300 Subject: [PATCH 01/17] Added button to media viewer for photo from sponsored messages. --- .../SourceFiles/history/view/media/history_view_photo.cpp | 1 + .../SourceFiles/media/view/media_view_overlay_widget.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index a8a5f6da9c..bb24f43f89 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -258,6 +258,7 @@ QSize Photo::countCurrentSize(int newWidth) { const auto enlargeOuter = 2 * st::historyPageEnlargeSkip + enlargeInner; const auto showEnlarge = (_parent->media() != this) && _parent->data()->media() + && !_parent->data()->isSponsored() && _parent->data()->media()->webpage() && _parent->data()->media()->webpage()->suggestEnlargePhoto() && (newWidth >= enlargeOuter) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 9345656eff..f45539f038 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -1510,10 +1510,10 @@ void OverlayWidget::refreshSponsoredButtonGeometry() { (controllerBottom // Duplicated in recountSkipTop(). - ((_streamed && _streamed->controls) ? (_streamed->controls->height() - + st::mediaviewCaptionMargin.height()) + + st::mediaviewCaptionPadding.bottom()) : 0) - _sponsoredButton->height() - - st::mediaviewCaptionPadding.bottom())); + - st::mediaviewCaptionMargin.height())); Ui::SendPendingMoveResizeEvents(_sponsoredButton.get()); } @@ -3483,6 +3483,8 @@ void OverlayWidget::displayPhoto( initStreaming(); } + initSponsoredButton(); + refreshCaption(); _blurred = true; From 520de600a0ee4edaf0a8047ba6fb0371a7e3d939 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 15 Aug 2024 08:19:18 +0200 Subject: [PATCH 02/17] Fix manifest for Windows Store version. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index bd94c0239c..bce114ea92 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -37,8 +37,8 @@ - + Date: Thu, 15 Aug 2024 09:48:59 +0200 Subject: [PATCH 03/17] Fix focus search on topic open. --- Telegram/SourceFiles/mainwidget.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 836a915e42..d116c0c1c1 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1185,23 +1185,32 @@ Image *MainWidget::newBackgroundThumb() { } void MainWidget::setInnerFocus() { + const auto setTo = [&](auto &&widget) { + if (widget->isHidden()) { + // If we try setting focus inside a hidden widget, we may + // end up focusing search field in dialogs on window activation. + setFocus(); + } else { + widget->setInnerFocus(); + } + }; if (_dialogs && _dialogs->searchHasFocus()) { - _dialogs->setInnerFocus(); + setTo(_dialogs); } else if (_hider || !_history->peer()) { if (!_hider && _mainSection) { - _mainSection->setInnerFocus(); + setTo(_mainSection); } else if (!_hider && _thirdSection) { - _thirdSection->setInnerFocus(); + setTo(_thirdSection); } else if (_dialogs) { - _dialogs->setInnerFocus(); + setTo(_dialogs); } else { // Maybe we're just closing a child window, content is destroyed. _history->setFocus(); } } else if (_mainSection) { - _mainSection->setInnerFocus(); + setTo(_mainSection); } else { - _history->setInnerFocus(); + setTo(_history); } } From a4ac00acbd7870c19032f65205e723523133486f Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 15 Aug 2024 10:14:30 +0200 Subject: [PATCH 04/17] Allow sending star reactions to discussion roots. --- Telegram/SourceFiles/history/history_item.cpp | 2 +- .../SourceFiles/history/view/history_view_list_widget.cpp | 8 ++++++++ .../SourceFiles/payments/payments_reaction_process.cpp | 8 ++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index cebb425cad..70b38bcf24 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -2533,7 +2533,7 @@ bool HistoryItem::canReact() const { void HistoryItem::addPaidReaction(int count, bool anonymous) { Expects(count >= 0); - Expects(_history->peer->isBroadcast()); + Expects(_history->peer->isBroadcast() || isDiscussionPost()); if (!_reactions) { _reactions = std::make_unique(this); diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 97aa4e81f6..a84464bc3c 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -36,6 +36,7 @@ For license and copyright information please follow this link: #include "api/api_who_reacted.h" #include "api/api_views.h" #include "layout/layout_selection.h" +#include "payments/payments_reaction_process.h" #include "window/section_widget.h" #include "window/window_adaptive.h" #include "window/window_session_controller.h" @@ -2801,6 +2802,13 @@ void ListWidget::reactionChosen(ChosenReaction reaction) { const auto item = session().data().message(reaction.context); if (!item) { return; + } else if (reaction.id.paid()) { + Payments::ShowPaidReactionDetails( + controller(), + item, + viewForItem(item), + HistoryReactionSource::Selector); + return; } else if (_delegate->listShowReactPremiumError(item, reaction.id)) { if (_menu) { _menu->hideMenu(); diff --git a/Telegram/SourceFiles/payments/payments_reaction_process.cpp b/Telegram/SourceFiles/payments/payments_reaction_process.cpp index 57de72432a..d66063b330 100644 --- a/Telegram/SourceFiles/payments/payments_reaction_process.cpp +++ b/Telegram/SourceFiles/payments/payments_reaction_process.cpp @@ -11,6 +11,7 @@ For license and copyright information please follow this link: #include "boxes/send_credits_box.h" // CreditsEmojiSmall. #include "core/ui_integration.h" // MarkedTextContext. #include "data/components/credits.h" +#include "data/data_channel.h" #include "data/data_message_reactions.h" #include "data/data_session.h" #include "data/data_user.h" @@ -120,7 +121,8 @@ void ShowPaidReactionDetails( not_null item, HistoryView::Element *view, HistoryReactionSource source) { - Expects(item->history()->peer->isBroadcast()); + Expects(item->history()->peer->isBroadcast() + || item->isDiscussionPost()); const auto show = controller->uiShow(); const auto itemId = item->fullId(); @@ -229,11 +231,13 @@ void ShowPaidReactionDetails( } ranges::sort(top, ranges::greater(), &Ui::PaidReactionTop::count); + const auto linked = item->discussionPostOriginalSender(); + const auto channel = (linked ? linked : item->history()->peer.get()); state->selectBox = show->show(Ui::MakePaidReactionBox({ .chosen = chosen, .max = max, .top = std::move(top), - .channel = item->history()->peer->name(), + .channel = channel->name(), .submit = std::move(submitText), .balanceValue = session->credits().balanceValue(), .send = [=](int count, bool anonymous) { From 3a7a485dd07d9672134b9968fb65842ab49a57e9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 15 Aug 2024 10:45:55 +0200 Subject: [PATCH 05/17] Fix switching profiles in a channel. --- .../history/view/history_view_message.cpp | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 345ecf9543..c0ece7602e 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -4232,13 +4232,28 @@ int Message::resizeContentGetHeight(int newWidth) { return height(); } + const auto item = data(); + const auto postShowingAuthor = item->isPostShowingAuthor() ? 1 : 0; + if (_postShowingAuthor != postShowingAuthor) { + _postShowingAuthor = postShowingAuthor; + _fromNameVersion = -1; + previousInBlocksChanged(); + + const auto size = _bottomInfo.currentSize(); + _bottomInfo.update(BottomInfoDataFromMessage(this), newWidth); + if (size != _bottomInfo.currentSize()) { + // maxWidth may have changed, full recount required. + setPendingResize(); + return resizeGetHeight(newWidth); + } + } + auto newHeight = minHeight(); if (const auto service = Get()) { service->resizeToWidth(newWidth, delegate()->elementIsChatWide()); } - const auto item = data(); const auto botTop = item->isFakeAboutView() ? Get() : nullptr; @@ -4246,14 +4261,6 @@ int Message::resizeContentGetHeight(int newWidth) { const auto mediaDisplayed = media ? media->isDisplayed() : false; const auto bubble = drawBubble(); - const auto postShowingAuthor = item->isPostShowingAuthor() ? 1 : 0; - if (_postShowingAuthor != postShowingAuthor) { - _postShowingAuthor = postShowingAuthor; - _bottomInfo.update(BottomInfoDataFromMessage(this), newWidth); - _fromNameVersion = -1; - previousInBlocksChanged(); - } - item->resolveDependent(); // This code duplicates countGeometry() but also resizes media. From 838d5669ed45650fc94af5f01adfb275e15f1a08 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 15 Aug 2024 16:06:04 +0300 Subject: [PATCH 06/17] Replaced api for credits rate. --- .../SourceFiles/data/components/credits.cpp | 25 ++++--------------- .../ui/boxes/edit_invite_link_session.cpp | 21 ++++++---------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/Telegram/SourceFiles/data/components/credits.cpp b/Telegram/SourceFiles/data/components/credits.cpp index 016d8ef4a4..34520f9230 100644 --- a/Telegram/SourceFiles/data/components/credits.cpp +++ b/Telegram/SourceFiles/data/components/credits.cpp @@ -9,6 +9,7 @@ For license and copyright information please follow this link: #include "api/api_credits.h" #include "data/data_user.h" +#include "main/main_app_config.h" #include "main/main_session.h" namespace Data { @@ -31,26 +32,10 @@ void Credits::apply(const MTPDupdateStarsBalance &data) { rpl::producer Credits::rateValue( not_null ownedBotOrChannel) { - // Should be replaced in the future. - if (_rate > 0) { - return rpl::single(_rate); - } - return [=](auto consumer) { - auto lifetime = rpl::lifetime(); - - const auto api = lifetime.make_state( - ownedBotOrChannel); - api->request( - ) | rpl::start_with_done([=] { - _rate = api->data().usdRate; - if (_rate > 0) { - consumer.put_next_copy(_rate); - consumer.put_done(); - } - }, lifetime); - - return lifetime; - }; + return rpl::single( + _session->appConfig().get( + u"stars_usd_withdraw_rate_x1000"_q, + 1200) / 1000.); } void Credits::load(bool force) { diff --git a/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp b/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp index 8b0260d3a9..862b6b6797 100644 --- a/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp +++ b/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp @@ -7,7 +7,7 @@ For license and copyright information please follow this link: */ #include "ui/boxes/edit_invite_link_session.h" -#include "api/api_credits.h" +#include "data/components/credits.h" #include "data/data_peer.h" #include "data/data_session.h" #include "data/stickers/data_custom_emoji.h" @@ -39,7 +39,7 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( not_null box, not_null peer) { struct State final { - float64 usdRate = 0; + rpl::variable usdRate = 0; }; const auto state = box->lifetime().make_state(); const auto currency = u"USD"_q; @@ -101,7 +101,7 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( }); priceOverlay->paintRequest( ) | rpl::start_with_next([=, right = st::boxRowPadding.right()] { - if (state->usdRate <= 0) { + if (state->usdRate.current() <= 0) { return; } const auto amount = input->getLastText().toDouble(); @@ -111,7 +111,9 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( const auto text = tr::lng_group_invite_subscription_price( tr::now, lt_cost, - Ui::FillAmountAndCurrency(amount * state->usdRate, currency)); + Ui::FillAmountAndCurrency( + amount * state->usdRate.current(), + currency)); auto p = QPainter(priceOverlay); p.setFont(st.placeholderFont); p.setPen(st.placeholderFg); @@ -120,16 +122,7 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( p.drawText(priceOverlay->rect() - m, text, style::al_right); }, priceOverlay->lifetime()); - { - auto &lifetime = priceOverlay->lifetime(); - const auto api = lifetime.make_state( - peer); - api->request( - ) | rpl::start_with_done([=] { - state->usdRate = api->data().usdRate; - priceOverlay->update(); - }, priceOverlay->lifetime()); - } + state->usdRate = peer->session().credits().rateValue(peer); const auto arrow = Ui::Text::SingleCustomEmoji( peer->owner().customEmojiManager().registerInternalEmoji( From 0c3cabf4ac3e0dd4c1265c4b77523e8d707b9789 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 15 Aug 2024 16:08:52 +0300 Subject: [PATCH 07/17] Removed interface for subscription links from mega groups. --- .../SourceFiles/boxes/peers/edit_peer_invite_link.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 19ed13c31b..203a027f0b 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -1577,9 +1577,11 @@ object_ptr EditLinkBox( const auto isGroup = !peer->isBroadcast(); const auto isPublic = peer->isChannel() && peer->asChannel()->isPublic(); auto object = Box([=](not_null box) { - const auto fill = [=] { - return Ui::FillCreateInviteLinkSubscriptionToggle(box, peer); - }; + const auto fill = isGroup + ? Fn(nullptr) + : [=] { + return Ui::FillCreateInviteLinkSubscriptionToggle(box, peer); + }; if (creating) { Ui::CreateInviteLinkBox(box, fill, isGroup, isPublic, done); } else { From 3905fc7c3801490cffeea1692074533515aab03d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 15 Aug 2024 16:16:41 +0300 Subject: [PATCH 08/17] Slightly improved input of credits with large numbers for invite links. --- Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp b/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp index 862b6b6797..7bd6ee08fc 100644 --- a/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp +++ b/Telegram/SourceFiles/ui/boxes/edit_invite_link_session.cpp @@ -73,7 +73,7 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( st, tr::lng_group_invite_subscription_ph(), QString(), - maxCredits); + std::pow(QString::number(maxCredits).size(), 10)); wrap->toggledValue() | rpl::start_with_next([=](bool shown) { if (shown) { input->setFocus(); @@ -97,6 +97,10 @@ InviteLinkSubscriptionToggle FillCreateInviteLinkSubscriptionToggle( }, input->lifetime()); ToggleChildrenVisibility(inputContainer, true); QObject::connect(input, &Ui::MaskedInputField::changed, [=] { + const auto amount = input->getLastText().toDouble(); + if (amount > maxCredits) { + input->setText(QString::number(maxCredits)); + } priceOverlay->update(); }); priceOverlay->paintRequest( From 73c018667d3cafa13a9ac47d046fef8d6eb6a806 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2024 09:11:05 +0200 Subject: [PATCH 09/17] Place star reaction always first. --- .../history/view/reactions/history_view_reactions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp index fb99cc6356..c1be784a2b 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp @@ -141,14 +141,14 @@ void InlineList::layoutButtons() { not_null b) { const auto acount = a->count - (a->my ? 1 : 0); const auto bcount = b->count - (b->my ? 1 : 0); - if (acount > bcount) { - return true; - } else if (acount < bcount) { - return false; - } else if (b->id.paid()) { + if (b->id.paid()) { return false; } else if (a->id.paid()) { return true; + } else if (acount > bcount) { + return true; + } else if (acount < bcount) { + return false; } return ranges::find(list, a->id, &::Data::Reaction::id) < ranges::find(list, b->id, &::Data::Reaction::id); From dc1df14a711dfc59f6a44eff3afed9c6d7119255 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2024 09:45:17 +0200 Subject: [PATCH 10/17] Fix send_as appearance in channels. --- .../SourceFiles/main/session/send_as_peers.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/main/session/send_as_peers.cpp b/Telegram/SourceFiles/main/session/send_as_peers.cpp index ab75de1031..373a5ef40e 100644 --- a/Telegram/SourceFiles/main/session/send_as_peers.cpp +++ b/Telegram/SourceFiles/main/session/send_as_peers.cpp @@ -29,14 +29,16 @@ SendAsPeers::SendAsPeers(not_null session) ) | rpl::map([=](const Data::PeerUpdate &update) { const auto peer = update.peer; const auto channel = peer->asChannel(); - return std::tuple( - peer, - peer->amAnonymous(), - channel ? channel->isPublic() : false); + const auto bits = 0 + | (peer->amAnonymous() ? (1 << 0) : 0) + | ((channel && channel->isPublic()) ? (1 << 1) : 0) + | ((channel && channel->addsSignature()) ? (1 << 2) : 0) + | ((channel && channel->signatureProfiles()) ? (1 << 3) : 0); + return std::tuple(peer, bits); }) | rpl::distinct_until_changed( - ) | rpl::filter([=](not_null peer, bool, bool) { - return _lists.contains(peer); - }) | rpl::start_with_next([=](not_null peer, bool, bool) { + ) | rpl::filter([=](not_null peer, int) { + return _lists.contains(peer) || _lastRequestTime.contains(peer); + }) | rpl::start_with_next([=](not_null peer, int) { refresh(peer, true); }, _lifetime); } From f3dca6efb74afd5928d69938fcc6fa5c178a3bd1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2024 10:54:02 +0200 Subject: [PATCH 11/17] Show correct signature in send-as channel posts. --- Telegram/SourceFiles/api/api_sending.cpp | 49 +++------------ Telegram/SourceFiles/apiwrap.cpp | 61 ++++--------------- Telegram/SourceFiles/history/history_item.cpp | 13 +--- Telegram/SourceFiles/history/history_item.h | 4 -- .../history/history_item_helpers.cpp | 28 ++++++++- .../history/history_item_helpers.h | 4 ++ .../main/session/send_as_peers.cpp | 10 ++- 7 files changed, 60 insertions(+), 109 deletions(-) diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index fb096e6269..8655619c0a 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -165,25 +165,15 @@ void SendExistingMedia( flags |= MessageFlag::HasReplyInfo; sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to; } - const auto anonymousPost = peer->amAnonymous(); const auto silentPost = ShouldSendSilent(peer, action.options); InnerFillMessagePostFlags(action.options, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } const auto sendAs = action.options.sendAs; - const auto messageFromId = sendAs - ? sendAs->id - : anonymousPost - ? 0 - : session->userPeerId(); if (sendAs) { sendFlags |= MTPmessages_SendMedia::Flag::f_send_as; } - const auto messagePostAuthor = peer->isBroadcast() - ? session->user()->name() - : QString(); - auto caption = TextWithEntities{ message.textWithTags.text, TextUtilities::ConvertTextTagsToEntities(message.textWithTags.tags) @@ -219,11 +209,11 @@ void SendExistingMedia( history->addNewLocalMessage({ .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = action.replyTo, - .date = HistoryItem::NewMessageDate(action.options), + .date = NewMessageDate(action.options), .shortcutId = action.options.shortcutId, - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), .effectId = action.options.effectId, }, media, caption); @@ -361,25 +351,15 @@ bool SendDice(MessageToSend &message) { flags |= MessageFlag::HasReplyInfo; sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to; } - const auto anonymousPost = peer->amAnonymous(); const auto silentPost = ShouldSendSilent(peer, action.options); InnerFillMessagePostFlags(action.options, peer, flags); if (silentPost) { sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } const auto sendAs = action.options.sendAs; - const auto messageFromId = sendAs - ? sendAs->id - : anonymousPost - ? 0 - : session->userPeerId(); if (sendAs) { sendFlags |= MTPmessages_SendMedia::Flag::f_send_as; } - const auto messagePostAuthor = peer->isBroadcast() - ? session->user()->name() - : QString(); - if (action.options.scheduled) { flags |= MessageFlag::IsOrWasScheduled; sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_date; @@ -401,11 +381,11 @@ bool SendDice(MessageToSend &message) { history->addNewLocalMessage({ .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = action.replyTo, - .date = HistoryItem::NewMessageDate(action.options), + .date = NewMessageDate(action.options), .shortcutId = action.options.shortcutId, - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), .effectId = action.options.effectId, }, TextWithEntities(), MTP_messageMediaDice( MTP_int(0), @@ -529,7 +509,6 @@ void SendConfirmedFile( if (file->to.replyTo) { flags |= MessageFlag::HasReplyInfo; } - const auto anonymousPost = peer->amAnonymous(); FillMessagePostFlags(action, peer, flags); if (file->to.options.scheduled) { flags |= MessageFlag::IsOrWasScheduled; @@ -551,16 +530,6 @@ void SendConfirmedFile( if (file->to.options.invertCaption) { flags |= MessageFlag::InvertMedia; } - - const auto messageFromId = file->to.options.sendAs - ? file->to.options.sendAs->id - : anonymousPost - ? PeerId() - : session->userPeerId(); - const auto messagePostAuthor = peer->isBroadcast() - ? session->user()->name() - : QString(); - const auto media = MTPMessageMedia([&] { if (file->type == SendMediaType::Photo) { using Flag = MTPDmessageMediaPhoto::Flag; @@ -626,11 +595,11 @@ void SendConfirmedFile( history->addNewLocalMessage({ .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = file->to.replyTo, - .date = HistoryItem::NewMessageDate(file->to.options), + .date = NewMessageDate(file->to.options), .shortcutId = file->to.options.shortcutId, - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), .groupedId = groupId, .effectId = file->to.options.effectId, }, caption, media); diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 5220341a36..5023fdc5df 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3283,7 +3283,6 @@ void ApiWrap::forwardMessages( histories.readInbox(history); } const auto sendAs = action.options.sendAs; - const auto anonymousPost = peer->amAnonymous(); const auto silentPost = ShouldSendSilent(peer, action.options); using SendFlag = MTPmessages_ForwardMessages::Flag; @@ -3376,22 +3375,14 @@ void ApiWrap::forwardMessages( peer->id, _session->data().nextLocalMessageId()); const auto self = _session->user(); - const auto messageFromId = sendAs - ? sendAs->id - : anonymousPost - ? PeerId(0) - : self->id; - const auto messagePostAuthor = peer->isBroadcast() - ? self->name() - : QString(); history->addNewLocalMessage({ .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = { .topicRootId = topMsgId }, - .date = HistoryItem::NewMessageDate(action.options), + .date = NewMessageDate(action.options), .shortcutId = action.options.shortcutId, - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), // forwarded messages don't have effects //.effectId = action.options.effectId, @@ -3466,8 +3457,6 @@ void ApiWrap::sendSharedContact( const auto newId = FullMsgId( peer->id, _session->data().nextLocalMessageId()); - const auto anonymousPost = peer->amAnonymous(); - auto flags = NewMessageFlags(peer); if (action.replyTo) { flags |= MessageFlag::HasReplyInfo; @@ -3479,22 +3468,14 @@ void ApiWrap::sendSharedContact( if (action.options.shortcutId) { flags |= MessageFlag::ShortcutMessage; } - const auto messageFromId = action.options.sendAs - ? action.options.sendAs->id - : anonymousPost - ? PeerId() - : _session->userPeerId(); - const auto messagePostAuthor = peer->isBroadcast() - ? _session->user()->name() - : QString(); const auto item = history->addNewLocalMessage({ .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = action.replyTo, - .date = HistoryItem::NewMessageDate(action.options), + .date = NewMessageDate(action.options), .shortcutId = action.options.shortcutId, - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), .effectId = action.options.effectId, }, TextWithEntities(), MTP_messageMediaContact( MTP_string(phone), @@ -3780,7 +3761,6 @@ void ApiWrap::sendMessage(MessageToSend &&message) { MTP_string(fields.url), MTP_int(page->pendingTill))); } - const auto anonymousPost = peer->amAnonymous(); const auto silentPost = ShouldSendSilent(peer, action.options); FillMessagePostFlags(action, peer, flags); if ((exactWebPage && !ignoreWebPage && message.webPage.invert) @@ -3808,18 +3788,10 @@ void ApiWrap::sendMessage(MessageToSend &&message) { history->startSavingCloudDraft(draftTopicRootId); } const auto sendAs = action.options.sendAs; - const auto messageFromId = sendAs - ? sendAs->id - : anonymousPost - ? PeerId() - : _session->userPeerId(); if (sendAs) { sendFlags |= MTPmessages_SendMessage::Flag::f_send_as; mediaFlags |= MTPmessages_SendMedia::Flag::f_send_as; } - const auto messagePostAuthor = peer->isBroadcast() - ? _session->user()->name() - : QString(); if (action.options.scheduled) { flags |= MessageFlag::IsOrWasScheduled; sendFlags |= MTPmessages_SendMessage::Flag::f_schedule_date; @@ -3837,11 +3809,11 @@ void ApiWrap::sendMessage(MessageToSend &&message) { lastMessage = history->addNewLocalMessage({ .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = action.replyTo, - .date = HistoryItem::NewMessageDate(action.options), + .date = NewMessageDate(action.options), .shortcutId = action.options.shortcutId, - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), .effectId = action.options.effectId, }, sending, media); const auto done = [=]( @@ -3987,7 +3959,6 @@ void ApiWrap::sendInlineResult( flags |= MessageFlag::HasReplyInfo; sendFlags |= SendFlag::f_reply_to; } - const auto anonymousPost = peer->amAnonymous(); const auto silentPost = ShouldSendSilent(peer, action.options); FillMessagePostFlags(action, peer, flags); if (silentPost) { @@ -4006,30 +3977,22 @@ void ApiWrap::sendInlineResult( } const auto sendAs = action.options.sendAs; - const auto messageFromId = sendAs - ? sendAs->id - : anonymousPost ? PeerId() - : _session->userPeerId(); if (sendAs) { sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_send_as; } - const auto messagePostAuthor = peer->isBroadcast() - ? _session->user()->name() - : QString(); - _session->data().registerMessageRandomId(randomId, newId); data->addToHistory(history, { .id = newId.msg, .flags = flags, - .from = messageFromId, + .from = NewMessageFromId(action), .replyTo = action.replyTo, - .date = HistoryItem::NewMessageDate(action.options), + .date = NewMessageDate(action.options), .shortcutId = action.options.shortcutId, .viaBotId = ((bot && !action.options.hideViaBot) ? peerToUser(bot->id) : UserId()), - .postAuthor = messagePostAuthor, + .postAuthor = NewMessagePostAuthor(action), }); history->clearCloudDraft(topicRootId); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 70b38bcf24..6d89ca4560 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -671,9 +671,7 @@ HistoryItem::HistoryItem( .flags = (MessageFlag::Local | MessageFlag::Sponsored | (history->peer->isChannel() ? MessageFlag::Post : MessageFlag(0))), - .date = HistoryItem::NewMessageDate(injectedAfter - ? injectedAfter->date() - : 0), + .date = NewMessageDate(injectedAfter ? injectedAfter->date() : 0), }) { const auto webpage = history->peer->owner().webpage( history->peer->owner().nextLocalMessageId().bare, @@ -761,15 +759,6 @@ TimeId HistoryItem::date() const { return _date; } -TimeId HistoryItem::NewMessageDate(TimeId scheduled) { - return scheduled ? scheduled : base::unixtime::now(); -} - -TimeId HistoryItem::NewMessageDate( - const Api::SendOptions &options) { - return options.shortcutId ? 1 : NewMessageDate(options.scheduled); -} - HistoryServiceDependentData *HistoryItem::GetServiceDependentData() { if (const auto pinned = Get()) { return pinned; diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 682075e605..f3ad4b854f 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -482,10 +482,6 @@ class HistoryItem final : public RuntimeComposer { [[nodiscard]] Data::MessagePosition position() const; [[nodiscard]] TimeId date() const; - [[nodiscard]] static TimeId NewMessageDate(TimeId scheduled); - [[nodiscard]] static TimeId NewMessageDate( - const Api::SendOptions &options); - [[nodiscard]] Data::Media *media() const { return _media.get(); } diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index 463f709524..dabd0ee838 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -187,6 +187,32 @@ MessageFlags NewMessageFlags(not_null peer) { | (peer->isSelf() ? MessageFlag() : MessageFlag::Outgoing); } +TimeId NewMessageDate(TimeId scheduled) { + return scheduled ? scheduled : base::unixtime::now(); +} + +TimeId NewMessageDate(const Api::SendOptions &options) { + return options.shortcutId ? 1 : NewMessageDate(options.scheduled); +} + +PeerId NewMessageFromId(const Api::SendAction &action) { + return action.options.sendAs + ? action.options.sendAs->id + : action.history->peer->amAnonymous() + ? PeerId() + : action.history->session().userPeerId(); +} + +QString NewMessagePostAuthor(const Api::SendAction &action) { + return !action.history->peer->isBroadcast() + ? QString() + : (action.options.sendAs == action.history->peer) + ? QString() + : action.options.sendAs + ? action.options.sendAs->name() + : action.history->session().user()->name(); +} + bool ShouldSendSilent( not_null peer, const Api::SendOptions &options) { @@ -320,7 +346,7 @@ ClickHandlerPtr JumpToMessageClickHandler( const auto separate = Core::App().separateWindowFor(peer); const auto controller = separate ? separate->sessionController() - : peer->session().tryResolveWindow(); + : peer->session().tryResolveWindow(peer); if (controller) { auto params = Window::SectionShow{ Window::SectionShow::Way::Forward diff --git a/Telegram/SourceFiles/history/history_item_helpers.h b/Telegram/SourceFiles/history/history_item_helpers.h index 3d67e29ec1..dd5121dbed 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.h +++ b/Telegram/SourceFiles/history/history_item_helpers.h @@ -83,6 +83,10 @@ void RequestDependentMessageStory( PeerId peerId, StoryId storyId); [[nodiscard]] MessageFlags NewMessageFlags(not_null peer); +[[nodiscard]] TimeId NewMessageDate(TimeId scheduled); +[[nodiscard]] TimeId NewMessageDate(const Api::SendOptions &options); +[[nodiscard]] PeerId NewMessageFromId(const Api::SendAction &action); +[[nodiscard]] QString NewMessagePostAuthor(const Api::SendAction &action); [[nodiscard]] bool ShouldSendSilent( not_null peer, const Api::SendOptions &options); diff --git a/Telegram/SourceFiles/main/session/send_as_peers.cpp b/Telegram/SourceFiles/main/session/send_as_peers.cpp index 373a5ef40e..050c87f6ed 100644 --- a/Telegram/SourceFiles/main/session/send_as_peers.cpp +++ b/Telegram/SourceFiles/main/session/send_as_peers.cpp @@ -117,6 +117,12 @@ not_null SendAsPeers::ResolveChosen( not_null peer, const std::vector &list, PeerId chosen) { + const auto fallback = peer->amAnonymous() + ? peer + : peer->session().user(); + if (!chosen) { + chosen = fallback->id; + } const auto i = ranges::find(list, chosen, [](const SendAsPeer &as) { return as.peer->id; }); @@ -124,9 +130,7 @@ not_null SendAsPeers::ResolveChosen( ? i->peer : !list.empty() ? list.front().peer - : peer->amAnonymous() - ? peer - : peer->session().user(); + : fallback; } void SendAsPeers::request(not_null peer) { From 62a20ba97539bd18977e4a0e66d95e417349cb05 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2024 10:57:30 +0200 Subject: [PATCH 12/17] Fix incorrect window activation on message jump. Fixes #28275. --- Telegram/SourceFiles/mainwidget.cpp | 16 ++++++++++++++++ .../window/window_session_controller.cpp | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index d116c0c1c1..866f3ebf94 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1295,6 +1295,9 @@ void MainWidget::showHistory( const SectionShow ¶ms, MsgId showAtMsgId) { if (peerId && _controller->window().locked()) { + if (params.activation != anim::activation::background) { + _controller->window().activate(); + } return; } else if (auto peer = session().data().peerLoaded(peerId)) { if (peer->migrateTo()) { @@ -1317,6 +1320,9 @@ void MainWidget::showHistory( && _mainSection && _mainSection->showMessage(peerId, params, showAtMsgId)) { session().data().hideShownSpoilers(); + if (params.activation != anim::activation::background) { + _controller->window().activate(); + } return; } else if (showHistoryInDifferentWindow(peerId, params, showAtMsgId)) { return; @@ -1502,16 +1508,26 @@ void MainWidget::showMessage( if (!v::is_null(params.origin)) { if (_mainSection) { if (_mainSection->showMessage(peerId, params, itemId)) { + if (params.activation != anim::activation::background) { + _controller->window().activate(); + } return; } } else if (_history->peer() == item->history()->peer) { + // showHistory may be redirected to different window, + // so we don't call activate() on current controller's window. showHistory(peerId, params, itemId); return; } } if (const auto topic = item->topic()) { _controller->showTopic(topic, item->id, params); + if (params.activation != anim::activation::background) { + _controller->window().activate(); + } } else { + // showPeerHistory may be redirected to different window, + // so we don't call activate() on current controller's window. _controller->showPeerHistory( item->history(), params, diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index ef1bddf245..b42fbcc00a 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -2487,12 +2487,12 @@ void SessionController::showMessage( std::make_shared( item->history()), params); + if (params.activation != anim::activation::background) { + controller->window().activate(); + } } else { controller->content()->showMessage(item, params); } - if (params.activation != anim::activation::background) { - controller->window().activate(); - } }); } From 754b3a5ae8e0657b29580ce72901312d87cb9842 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2024 11:16:18 +0200 Subject: [PATCH 13/17] Fix bottom text and info layout in albums. --- .../SourceFiles/history/view/history_view_message.cpp | 11 +++++------ .../SourceFiles/history/view/history_view_message.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index c0ece7602e..0a4fcded4a 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -831,7 +831,7 @@ QSize Message::performCountOptimalSize() { refreshReactions(); } refreshRightBadge(); - refreshInfoSkipBlock(); + refreshInfoSkipBlock(textItem); const auto botTop = item->isFakeAboutView() ? Get() @@ -4485,17 +4485,16 @@ QSize Message::performCountCurrentSize(int newWidth) { return { newWidth, newHeight }; } -void Message::refreshInfoSkipBlock() { - const auto item = data(); +void Message::refreshInfoSkipBlock(HistoryItem *textItem) { const auto media = this->media(); const auto hasTextSkipBlock = [&] { - if (item->_text.empty()) { + if (!textItem || textItem->_text.empty()) { if (const auto media = data()->media()) { return media->storyExpired(); } return false; - } else if (item->Has() - || factcheckBlock()) { + } else if (factcheckBlock() + || data()->Has()) { return false; } else if (media && media->isDisplayed() && !_invertMedia) { return false; diff --git a/Telegram/SourceFiles/history/view/history_view_message.h b/Telegram/SourceFiles/history/view/history_view_message.h index 6b8c28d48e..af97b8b951 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.h +++ b/Telegram/SourceFiles/history/view/history_view_message.h @@ -285,7 +285,7 @@ class Message final : public Element { void ensureRightAction() const; void refreshTopicButton(); - void refreshInfoSkipBlock(); + void refreshInfoSkipBlock(HistoryItem *textItem); [[nodiscard]] int monospaceMaxWidth() const; void validateInlineKeyboard(HistoryMessageReplyMarkup *markup); From f2ea0edc951e80445d2af78263eb2410882df229 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 16 Aug 2024 11:16:35 +0200 Subject: [PATCH 14/17] Fix link confirmation box in media viewer. --- Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index f45539f038..ee22b936e4 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -5952,7 +5952,7 @@ void OverlayWidget::handleMouseRelease( QVariant::fromValue(ClickHandlerContext{ .itemId = _message ? _message->fullId() : FullMsgId(), .sessionWindow = base::make_weak(findWindow()), - .show = _stories ? _stories->uiShow() : nullptr, + .show = _stories ? _stories->uiShow() : uiShow(), .dark = true, }) }); From bfbdf1b935b803298df02d7972d332d41918f91b Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 16 Aug 2024 14:07:49 +0300 Subject: [PATCH 15/17] Removed currency stat from channel earn section when it's not available. --- .../earn/info_channel_earn_list.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp index 756fb72296..a482628733 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp @@ -386,7 +386,13 @@ void InnerWidget::load() { void InnerWidget::fill() { const auto container = this; - const auto &data = _state.currencyEarn; + const auto channel = _peer->asChannel(); + const auto canViewCurrencyEarn = channel + ? (channel->flags() & ChannelDataFlag::CanViewRevenue) + : true; + const auto &data = canViewCurrencyEarn + ? _state.currencyEarn + : Data::EarnStatistics(); const auto &creditsData = _state.creditsEarn; auto currencyStateValue = rpl::single( @@ -417,7 +423,6 @@ void InnerWidget::fill() { const auto nonInteractive = base::unixtime::now() < kNonInteractivePeriod; const auto session = &_peer->session(); - const auto channel = _peer->asChannel(); const auto withdrawalEnabled = WithdrawalEnabled(session) && !nonInteractive; const auto makeContext = [=](not_null l) { @@ -1486,10 +1491,15 @@ void InnerWidget::fill() { [] {}); } if (!isLocked) { - Api::RestrictSponsored(channel, value, [=](const QString &e) { - toggled->fire(false); - _controller->uiShow()->showToast(e); - }); + const auto weak = Ui::MakeWeak(this); + const auto show = _controller->uiShow(); + const auto failed = [=](const QString &e) { + if (weak.data()) { + toggled->fire(false); + show->showToast(e); + } + }; + Api::RestrictSponsored(channel, value, failed); } }, button->lifetime()); From eec59611ef7b5acde4a5c07746496341655073a0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 17 Aug 2024 17:09:28 +0200 Subject: [PATCH 16/17] Fix leaving forum glitch. --- Telegram/SourceFiles/data/data_session.cpp | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 8016381b28..ed31b1683f 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -1271,24 +1271,31 @@ History *Session::historyLoaded(const PeerData *peer) { } void Session::deleteConversationLocally(not_null peer) { - const auto history = historyLoaded(peer); - if (history) { + const auto markLeft = [&] { + if (const auto channel = peer->asMegagroup()) { + channel->addFlags(ChannelDataFlag::Left); + if (const auto from = channel->getMigrateFromChat()) { + if (const auto migrated = historyLoaded(from)) { + migrated->updateChatListExistence(); + } + } + } + }; + if (const auto history = historyLoaded(peer)) { if (history->folderKnown()) { setChatPinned(history, FilterId(), false); } removeChatListEntry(history); history->clearFolder(); + + // We want to mark the channel as left before unloading the history, + // otherwise some parts of updating may return us to the chats list. + markLeft(); history->clear(peer->isChannel() ? History::ClearType::Unload : History::ClearType::DeleteChat); - } - if (const auto channel = peer->asMegagroup()) { - channel->addFlags(ChannelDataFlag::Left); - if (const auto from = channel->getMigrateFromChat()) { - if (const auto migrated = historyLoaded(from)) { - migrated->updateChatListExistence(); - } - } + } else { + markLeft(); } } From 2c1788a63a9eacf90dbf2676cee933e55907e977 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 17 Aug 2024 15:41:01 +0200 Subject: [PATCH 17/17] Version 5.4.1. - Fix crash when sending Star Reaction in comments. - Fix loading "Send As" channels in a channel. - Place Star Reaction always first in list. - Removed paid Invite Links in groups. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/apiwrap.cpp | 1 - Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/build/version | 8 ++++---- changelog.txt | 7 +++++++ docs/building-win-x64.md | 1 - 8 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index bce114ea92..3a9d2ec929 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.4.1.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index c581188b10..07aed63b5f 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,4,0,0 - PRODUCTVERSION 5,4,0,0 + FILEVERSION 5,4,1,0 + PRODUCTVERSION 5,4,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "5.4.0.0" + VALUE "FileVersion", "5.4.1.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.4.0.0" + VALUE "ProductVersion", "5.4.1.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 9c4c92496d..ef100d47b5 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,4,0,0 - PRODUCTVERSION 5,4,0,0 + FILEVERSION 5,4,1,0 + PRODUCTVERSION 5,4,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "5.4.0.0" + VALUE "FileVersion", "5.4.1.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "5.4.0.0" + VALUE "ProductVersion", "5.4.1.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 5023fdc5df..7ad009d6ea 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3374,7 +3374,6 @@ void ApiWrap::forwardMessages( const auto newId = FullMsgId( peer->id, _session->data().nextLocalMessageId()); - const auto self = _session->user(); history->addNewLocalMessage({ .id = newId.msg, .flags = flags, diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 1cbc2e97a4..1f4403d66f 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Telegram Desktop"_cs; constexpr auto AppFile = "Telegram"_cs; -constexpr auto AppVersion = 5004000; -constexpr auto AppVersionStr = "5.4"; +constexpr auto AppVersion = 5004001; +constexpr auto AppVersionStr = "5.4.1"; constexpr auto AppBetaVersion = false; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index 7cde97d32b..2027f103c0 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 5004000 +AppVersion 5004001 AppVersionStrMajor 5.4 -AppVersionStrSmall 5.4 -AppVersionStr 5.4.0 +AppVersionStrSmall 5.4.1 +AppVersionStr 5.4.1 BetaChannel 0 AlphaVersion 0 -AppVersionOriginal 5.4 +AppVersionOriginal 5.4.1 diff --git a/changelog.txt b/changelog.txt index e5c349e748..80729610f0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +5.4.1 (17.08.24) + +- Fix crash when sending Star Reaction in comments. +- Fix loading "Send As" channels in a channel. +- Place Star Reaction always first in list. +- Removed paid Invite Links in groups. + 5.4 (14.08.24) - Super Channels with post authors' profiles. diff --git a/docs/building-win-x64.md b/docs/building-win-x64.md index a85ce116fe..476aaf1106 100644 --- a/docs/building-win-x64.md +++ b/docs/building-win-x64.md @@ -21,7 +21,6 @@ You will require **api_id** and **api_hash** to access the Telegram API servers. ## Install third party software * Download **Python 3.10** installer from [https://www.python.org/downloads/](https://www.python.org/downloads/) and install it with adding to PATH. -* Download **CMake 3.21 or later** installer from [https://cmake.org/download/](https://cmake.org/download/) and install it. * Download **Git** installer from [https://git-scm.com/download/win](https://git-scm.com/download/win) and install it. ## Clone source code and prepare libraries