2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Added reactions count to overview in statistics info.

This commit is contained in:
23rd
2023-11-17 04:10:45 +03:00
committed by John Preston
parent 173a5046e8
commit f88eee8047
3 changed files with 20 additions and 3 deletions

View File

@@ -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();