mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-25 10:01:00 +00:00
Added reactions count to overview in statistics info.
This commit is contained in:
parent
173a5046e8
commit
f88eee8047
@ -458,6 +458,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
.publicForwards = total,
|
||||
.privateForwards = info.forwardsCount - total,
|
||||
.views = info.viewsCount,
|
||||
.reactions = info.reactionsCount,
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -474,6 +475,13 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
const auto process = [&](const MTPVector<MTPMessage> &messages) {
|
||||
const auto &message = messages.v.front();
|
||||
return message.match([&](const MTPDmessage &data) {
|
||||
auto reactionsCount = 0;
|
||||
if (const auto tlReactions = data.vreactions()) {
|
||||
const auto &tlCounts = tlReactions->data().vresults();
|
||||
for (const auto &tlCount : tlCounts.v) {
|
||||
reactionsCount += tlCount.data().vcount().v;
|
||||
}
|
||||
}
|
||||
return Data::StatisticsMessageInteractionInfo{
|
||||
.messageId = IdFromMessage(message),
|
||||
.viewsCount = data.vviews()
|
||||
@ -482,6 +490,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
|
||||
.forwardsCount = data.vforwards()
|
||||
? data.vforwards()->v
|
||||
: 0,
|
||||
.reactionsCount = reactionsCount,
|
||||
};
|
||||
}, [](const MTPDmessageEmpty &) {
|
||||
return Data::StatisticsMessageInteractionInfo();
|
||||
|
@ -15,6 +15,7 @@ struct StatisticsMessageInteractionInfo final {
|
||||
MsgId messageId;
|
||||
int viewsCount = 0;
|
||||
int forwardsCount = 0;
|
||||
int reactionsCount = 0;
|
||||
};
|
||||
|
||||
struct StatisticsMessageSenderInfo final {
|
||||
@ -115,6 +116,7 @@ struct MessageStatistics final {
|
||||
int publicForwards = 0;
|
||||
int privateForwards = 0;
|
||||
int views = 0;
|
||||
int reactions = 0;
|
||||
};
|
||||
|
||||
struct AnyStatistics final {
|
||||
|
@ -394,12 +394,12 @@ void FillOverview(
|
||||
const auto bottomLeftLabel = isChannel
|
||||
? addPrimary(channel.meanViewCount)
|
||||
: isMessage
|
||||
? addPrimary({ .value = float64(stats.message.privateForwards) })
|
||||
? addPrimary({ .value = float64(stats.message.reactions) })
|
||||
: addPrimary(supergroup.viewerCount);
|
||||
const auto bottomRightLabel = isChannel
|
||||
? addPrimary(channel.meanShareCount)
|
||||
: isMessage
|
||||
? addPrimary({ .value = -1. })
|
||||
? addPrimary({ .value = float64(stats.message.privateForwards) })
|
||||
: addPrimary(supergroup.senderCount);
|
||||
if (const auto &s = channel) {
|
||||
addSub(
|
||||
@ -448,10 +448,16 @@ void FillOverview(
|
||||
{},
|
||||
tr::lng_stats_overview_message_public_shares);
|
||||
}
|
||||
if (s.privateForwards >= 0) {
|
||||
if (s.reactions >= 0) {
|
||||
addSub(
|
||||
bottomLeftLabel,
|
||||
{},
|
||||
tr::lng_manage_peer_reactions);
|
||||
}
|
||||
if (s.privateForwards >= 0) {
|
||||
addSub(
|
||||
bottomRightLabel,
|
||||
{},
|
||||
tr::lng_stats_overview_message_private_shares);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user