mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
void HistoryItem::addPaidReaction(int count, bool anonymous) {
|
||||||
Expects(count >= 0);
|
Expects(count >= 0);
|
||||||
Expects(_history->peer->isBroadcast());
|
Expects(_history->peer->isBroadcast() || isDiscussionPost());
|
||||||
|
|
||||||
if (!_reactions) {
|
if (!_reactions) {
|
||||||
_reactions = std::make_unique<Data::MessageReactions>(this);
|
_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_who_reacted.h"
|
||||||
#include "api/api_views.h"
|
#include "api/api_views.h"
|
||||||
#include "layout/layout_selection.h"
|
#include "layout/layout_selection.h"
|
||||||
|
#include "payments/payments_reaction_process.h"
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
#include "window/window_adaptive.h"
|
#include "window/window_adaptive.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
|
@ -2801,6 +2802,13 @@ void ListWidget::reactionChosen(ChosenReaction reaction) {
|
||||||
const auto item = session().data().message(reaction.context);
|
const auto item = session().data().message(reaction.context);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
|
} else if (reaction.id.paid()) {
|
||||||
|
Payments::ShowPaidReactionDetails(
|
||||||
|
controller(),
|
||||||
|
item,
|
||||||
|
viewForItem(item),
|
||||||
|
HistoryReactionSource::Selector);
|
||||||
|
return;
|
||||||
} else if (_delegate->listShowReactPremiumError(item, reaction.id)) {
|
} else if (_delegate->listShowReactPremiumError(item, reaction.id)) {
|
||||||
if (_menu) {
|
if (_menu) {
|
||||||
_menu->hideMenu();
|
_menu->hideMenu();
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/send_credits_box.h" // CreditsEmojiSmall.
|
#include "boxes/send_credits_box.h" // CreditsEmojiSmall.
|
||||||
#include "core/ui_integration.h" // MarkedTextContext.
|
#include "core/ui_integration.h" // MarkedTextContext.
|
||||||
#include "data/components/credits.h"
|
#include "data/components/credits.h"
|
||||||
|
#include "data/data_channel.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reactions.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
@ -120,7 +121,8 @@ void ShowPaidReactionDetails(
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
HistoryView::Element *view,
|
HistoryView::Element *view,
|
||||||
HistoryReactionSource source) {
|
HistoryReactionSource source) {
|
||||||
Expects(item->history()->peer->isBroadcast());
|
Expects(item->history()->peer->isBroadcast()
|
||||||
|
|| item->isDiscussionPost());
|
||||||
|
|
||||||
const auto show = controller->uiShow();
|
const auto show = controller->uiShow();
|
||||||
const auto itemId = item->fullId();
|
const auto itemId = item->fullId();
|
||||||
|
@ -229,11 +231,13 @@ void ShowPaidReactionDetails(
|
||||||
}
|
}
|
||||||
ranges::sort(top, ranges::greater(), &Ui::PaidReactionTop::count);
|
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({
|
state->selectBox = show->show(Ui::MakePaidReactionBox({
|
||||||
.chosen = chosen,
|
.chosen = chosen,
|
||||||
.max = max,
|
.max = max,
|
||||||
.top = std::move(top),
|
.top = std::move(top),
|
||||||
.channel = item->history()->peer->name(),
|
.channel = channel->name(),
|
||||||
.submit = std::move(submitText),
|
.submit = std::move(submitText),
|
||||||
.balanceValue = session->credits().balanceValue(),
|
.balanceValue = session->credits().balanceValue(),
|
||||||
.send = [=](int count, bool anonymous) {
|
.send = [=](int count, bool anonymous) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue