mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Allow sending star reactions to discussion roots.
This commit is contained in:
parent
7d52c13625
commit
a4ac00acbd
3 changed files with 15 additions and 3 deletions
|
@ -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<Data::MessageReactions>(this);
|
||||
|
|
|
@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#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();
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#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<HistoryItem*> 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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue