Update API scheme on layer 138.
This commit is contained in:
parent
846cabeda5
commit
581b84afe0
9 changed files with 59 additions and 53 deletions
|
@ -190,7 +190,7 @@ messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int =
|
||||||
messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;
|
messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;
|
||||||
messageActionChatJoinedByRequest#ebbca3cb = MessageAction;
|
messageActionChatJoinedByRequest#ebbca3cb = MessageAction;
|
||||||
|
|
||||||
dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
|
dialog#a8edd0f5 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
|
||||||
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
|
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
|
||||||
|
|
||||||
photoEmpty#2331b22d id:long = Photo;
|
photoEmpty#2331b22d id:long = Photo;
|
||||||
|
@ -1307,11 +1307,9 @@ auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut
|
||||||
|
|
||||||
reactionCount#6fb250d1 flags:# chosen:flags.0?true reaction:string count:int = ReactionCount;
|
reactionCount#6fb250d1 flags:# chosen:flags.0?true reaction:string count:int = ReactionCount;
|
||||||
|
|
||||||
messageReactions#87b6e36 flags:# min:flags.0?true can_see_list:flags.2?true results:Vector<ReactionCount> recent_reactons:flags.1?Vector<MessageUserReaction> = MessageReactions;
|
messageReactions#4f2b9479 flags:# min:flags.0?true can_see_list:flags.2?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> = MessageReactions;
|
||||||
|
|
||||||
messageUserReaction#932844fa user_id:long reaction:string = MessageUserReaction;
|
messages.messageReactionsList#31bd492d flags:# count:int reactions:Vector<MessagePeerReaction> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.MessageReactionsList;
|
||||||
|
|
||||||
messages.messageReactionsList#a366923c flags:# count:int reactions:Vector<MessageUserReaction> users:Vector<User> next_offset:flags.0?string = messages.MessageReactionsList;
|
|
||||||
|
|
||||||
availableReaction#c077ec01 flags:# inactive:flags.0?true reaction:string title:string static_icon:Document appear_animation:Document select_animation:Document activate_animation:Document effect_animation:Document around_animation:flags.1?Document center_icon:flags.1?Document = AvailableReaction;
|
availableReaction#c077ec01 flags:# inactive:flags.0?true reaction:string title:string static_icon:Document appear_animation:Document select_animation:Document activate_animation:Document effect_animation:Document around_animation:flags.1?Document center_icon:flags.1?Document = AvailableReaction;
|
||||||
|
|
||||||
|
@ -1321,6 +1319,8 @@ messages.availableReactions#768e3aad hash:int reactions:Vector<AvailableReaction
|
||||||
messages.translateNoResult#67ca4737 = messages.TranslatedText;
|
messages.translateNoResult#67ca4737 = messages.TranslatedText;
|
||||||
messages.translateResultText#a214f7d0 text:string = messages.TranslatedText;
|
messages.translateResultText#a214f7d0 text:string = messages.TranslatedText;
|
||||||
|
|
||||||
|
messagePeerReaction#51b67eff flags:# big:flags.0?true unread:flags.1?true peer_id:Peer reaction:string = MessagePeerReaction;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1599,13 +1599,15 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe
|
||||||
messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates;
|
messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates;
|
||||||
messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates;
|
messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates;
|
||||||
messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool;
|
messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool;
|
||||||
messages.sendReaction#25690ce4 flags:# peer:InputPeer msg_id:int reaction:flags.0?string = Updates;
|
messages.sendReaction#25690ce4 flags:# big:flags.1?true peer:InputPeer msg_id:int reaction:flags.0?string = Updates;
|
||||||
messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates;
|
messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates;
|
||||||
messages.getMessageReactionsList#e0ee6b77 flags:# peer:InputPeer id:int reaction:flags.0?string offset:flags.1?string limit:int = messages.MessageReactionsList;
|
messages.getMessageReactionsList#e0ee6b77 flags:# peer:InputPeer id:int reaction:flags.0?string offset:flags.1?string limit:int = messages.MessageReactionsList;
|
||||||
messages.setChatAvailableReactions#14050ea6 peer:InputPeer available_reactions:Vector<string> = Updates;
|
messages.setChatAvailableReactions#14050ea6 peer:InputPeer available_reactions:Vector<string> = Updates;
|
||||||
messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;
|
messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;
|
||||||
messages.setDefaultReaction#d960c4d4 reaction:string = Bool;
|
messages.setDefaultReaction#d960c4d4 reaction:string = Bool;
|
||||||
messages.translateText#24ce6dee flags:# peer:flags.0?InputPeer msg_id:flags.0?int text:flags.1?string from_lang:flags.2?string to_lang:string = messages.TranslatedText;
|
messages.translateText#24ce6dee flags:# peer:flags.0?InputPeer msg_id:flags.0?int text:flags.1?string from_lang:flags.2?string to_lang:string = messages.TranslatedText;
|
||||||
|
messages.getUnreadReactions#e85bae1a peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||||
|
messages.readReactions#82e251d7 peer:InputPeer = messages.AffectedHistory;
|
||||||
|
|
||||||
updates.getState#edd4882a = updates.State;
|
updates.getState#edd4882a = updates.State;
|
||||||
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
|
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
|
||||||
|
|
|
@ -289,6 +289,7 @@ struct State {
|
||||||
result.match([&](
|
result.match([&](
|
||||||
const MTPDmessages_messageReactionsList &data) {
|
const MTPDmessages_messageReactionsList &data) {
|
||||||
session->data().processUsers(data.vusers());
|
session->data().processUsers(data.vusers());
|
||||||
|
session->data().processChats(data.vchats());
|
||||||
|
|
||||||
auto parsed = PeersWithReactions{
|
auto parsed = PeersWithReactions{
|
||||||
.fullReactionsCount = data.vcount().v,
|
.fullReactionsCount = data.vcount().v,
|
||||||
|
@ -297,7 +298,7 @@ struct State {
|
||||||
for (const auto &vote : data.vreactions().v) {
|
for (const auto &vote : data.vreactions().v) {
|
||||||
vote.match([&](const auto &data) {
|
vote.match([&](const auto &data) {
|
||||||
parsed.list.push_back(PeerWithReaction{
|
parsed.list.push_back(PeerWithReaction{
|
||||||
.peer = peerFromUser(data.vuser_id()),
|
.peer = peerFromMTP(data.vpeer_id()),
|
||||||
.reaction = qs(data.vreaction()),
|
.reaction = qs(data.vreaction()),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
#include "main/main_app_config.h"
|
#include "main/main_app_config.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
|
@ -516,7 +517,7 @@ void MessageReactions::remove() {
|
||||||
|
|
||||||
void MessageReactions::set(
|
void MessageReactions::set(
|
||||||
const QVector<MTPReactionCount> &list,
|
const QVector<MTPReactionCount> &list,
|
||||||
const QVector<MTPMessageUserReaction> &recent,
|
const QVector<MTPMessagePeerReaction> &recent,
|
||||||
bool ignoreChosen) {
|
bool ignoreChosen) {
|
||||||
auto &owner = _item->history()->owner();
|
auto &owner = _item->history()->owner();
|
||||||
if (owner.reactions().sending(_item)) {
|
if (owner.reactions().sending(_item)) {
|
||||||
|
@ -558,12 +559,13 @@ void MessageReactions::set(
|
||||||
}
|
}
|
||||||
auto parsed = base::flat_map<
|
auto parsed = base::flat_map<
|
||||||
QString,
|
QString,
|
||||||
std::vector<not_null<UserData*>>>();
|
std::vector<not_null<PeerData*>>>();
|
||||||
for (const auto &reaction : recent) {
|
for (const auto &reaction : recent) {
|
||||||
reaction.match([&](const MTPDmessageUserReaction &data) {
|
reaction.match([&](const MTPDmessagePeerReaction &data) {
|
||||||
const auto emoji = qs(data.vreaction());
|
const auto emoji = qs(data.vreaction());
|
||||||
if (_list.contains(emoji)) {
|
if (_list.contains(emoji)) {
|
||||||
parsed[emoji].push_back(owner.user(data.vuser_id()));
|
parsed[emoji].push_back(
|
||||||
|
owner.peer(peerFromMTP(data.vpeer_id())));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -582,7 +584,7 @@ const base::flat_map<QString, int> &MessageReactions::list() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto MessageReactions::recent() const
|
auto MessageReactions::recent() const
|
||||||
-> const base::flat_map<QString, std::vector<not_null<UserData*>>> & {
|
-> const base::flat_map<QString, std::vector<not_null<PeerData*>>> & {
|
||||||
return _recent;
|
return _recent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,11 @@ public:
|
||||||
void remove();
|
void remove();
|
||||||
void set(
|
void set(
|
||||||
const QVector<MTPReactionCount> &list,
|
const QVector<MTPReactionCount> &list,
|
||||||
const QVector<MTPMessageUserReaction> &recent,
|
const QVector<MTPMessagePeerReaction> &recent,
|
||||||
bool ignoreChosen);
|
bool ignoreChosen);
|
||||||
[[nodiscard]] const base::flat_map<QString, int> &list() const;
|
[[nodiscard]] const base::flat_map<QString, int> &list() const;
|
||||||
[[nodiscard]] auto recent() const
|
[[nodiscard]] auto recent() const
|
||||||
-> const base::flat_map<QString, std::vector<not_null<UserData*>>> &;
|
-> const base::flat_map<QString, std::vector<not_null<PeerData*>>> &;
|
||||||
[[nodiscard]] QString chosen() const;
|
[[nodiscard]] QString chosen() const;
|
||||||
[[nodiscard]] bool empty() const;
|
[[nodiscard]] bool empty() const;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ private:
|
||||||
|
|
||||||
QString _chosen;
|
QString _chosen;
|
||||||
base::flat_map<QString, int> _list;
|
base::flat_map<QString, int> _list;
|
||||||
base::flat_map<QString, std::vector<not_null<UserData*>>> _recent;
|
base::flat_map<QString, std::vector<not_null<PeerData*>>> _recent;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@ void HistoryItem::setReactions(const MTPMessageReactions *reactions) {
|
||||||
}
|
}
|
||||||
_reactions->set(
|
_reactions->set(
|
||||||
data.vresults().v,
|
data.vresults().v,
|
||||||
data.vrecent_reactons().value_or_empty(),
|
data.vrecent_reactions().value_or_empty(),
|
||||||
data.is_min());
|
data.is_min());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -877,10 +877,10 @@ const base::flat_map<QString, int> &HistoryItem::reactions() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto HistoryItem::recentReactions() const
|
auto HistoryItem::recentReactions() const
|
||||||
-> const base::flat_map<QString, std::vector<not_null<UserData*>>> & {
|
-> const base::flat_map<QString, std::vector<not_null<PeerData*>>> & {
|
||||||
static const auto kEmpty = base::flat_map<
|
static const auto kEmpty = base::flat_map<
|
||||||
QString,
|
QString,
|
||||||
std::vector<not_null<UserData*>>>();
|
std::vector<not_null<PeerData*>>>();
|
||||||
return _reactions ? _reactions->recent() : kEmpty;
|
return _reactions ? _reactions->recent() : kEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ public:
|
||||||
void updateReactionsUnknown();
|
void updateReactionsUnknown();
|
||||||
[[nodiscard]] const base::flat_map<QString, int> &reactions() const;
|
[[nodiscard]] const base::flat_map<QString, int> &reactions() const;
|
||||||
[[nodiscard]] auto recentReactions() const
|
[[nodiscard]] auto recentReactions() const
|
||||||
-> const base::flat_map<QString, std::vector<not_null<UserData*>>> &;
|
-> const base::flat_map<QString, std::vector<not_null<PeerData*>>> &;
|
||||||
[[nodiscard]] bool canViewReactions() const;
|
[[nodiscard]] bool canViewReactions() const;
|
||||||
[[nodiscard]] QString chosenReaction() const;
|
[[nodiscard]] QString chosenReaction() const;
|
||||||
[[nodiscard]] QString lookupHisReaction() const;
|
[[nodiscard]] QString lookupHisReaction() const;
|
||||||
|
|
|
@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/view/history_view_group_call_bar.h"
|
#include "history/view/history_view_group_call_bar.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
#include "data/data_message_reactions.h"
|
#include "data/data_message_reactions.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_peer.h"
|
||||||
#include "lang/lang_tag.h"
|
#include "lang/lang_tag.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
#include "styles/style_chat.h"
|
#include "styles/style_chat.h"
|
||||||
|
@ -125,18 +125,18 @@ void InlineList::setButtonCount(Button &button, int count) {
|
||||||
|
|
||||||
void InlineList::setButtonUserpics(
|
void InlineList::setButtonUserpics(
|
||||||
Button &button,
|
Button &button,
|
||||||
const std::vector<not_null<UserData*>> &users) {
|
const std::vector<not_null<PeerData*>> &peers) {
|
||||||
if (!button.userpics) {
|
if (!button.userpics) {
|
||||||
button.userpics = std::make_unique<Userpics>();
|
button.userpics = std::make_unique<Userpics>();
|
||||||
}
|
}
|
||||||
const auto count = button.count = int(users.size());
|
const auto count = button.count = int(peers.size());
|
||||||
auto &list = button.userpics->list;
|
auto &list = button.userpics->list;
|
||||||
const auto regenerate = [&] {
|
const auto regenerate = [&] {
|
||||||
if (list.size() != count) {
|
if (list.size() != count) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (auto i = 0; i != count; ++i) {
|
for (auto i = 0; i != count; ++i) {
|
||||||
if (users[i] != list[i].peer) {
|
if (peers[i] != list[i].peer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,10 +150,10 @@ void InlineList::setButtonUserpics(
|
||||||
for (auto i = 0; i != count; ++i) {
|
for (auto i = 0; i != count; ++i) {
|
||||||
if (i == list.size()) {
|
if (i == list.size()) {
|
||||||
list.push_back(UserpicInRow{
|
list.push_back(UserpicInRow{
|
||||||
users[i]
|
peers[i]
|
||||||
});
|
});
|
||||||
} else if (list[i].peer != users[i]) {
|
} else if (list[i].peer != peers[i]) {
|
||||||
list[i].peer = users[i];
|
list[i].peer = peers[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (list.size() > count) {
|
while (list.size() > count) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct InlineListData {
|
||||||
using Flags = base::flags<Flag>;
|
using Flags = base::flags<Flag>;
|
||||||
|
|
||||||
base::flat_map<QString, int> reactions;
|
base::flat_map<QString, int> reactions;
|
||||||
base::flat_map<QString, std::vector<not_null<UserData*>>> recent;
|
base::flat_map<QString, std::vector<not_null<PeerData*>>> recent;
|
||||||
QString chosenReaction;
|
QString chosenReaction;
|
||||||
Flags flags = {};
|
Flags flags = {};
|
||||||
};
|
};
|
||||||
|
@ -101,7 +101,7 @@ private:
|
||||||
void setButtonCount(Button &button, int count);
|
void setButtonCount(Button &button, int count);
|
||||||
void setButtonUserpics(
|
void setButtonUserpics(
|
||||||
Button &button,
|
Button &button,
|
||||||
const std::vector<not_null<UserData*>> &users);
|
const std::vector<not_null<PeerData*>> &peers);
|
||||||
[[nodiscard]] Button prepareButtonWithEmoji(const QString &emoji);
|
[[nodiscard]] Button prepareButtonWithEmoji(const QString &emoji);
|
||||||
void resolveUserpicsImage(const Button &button) const;
|
void resolveUserpicsImage(const Button &button) const;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/controls/who_reacted_context_action.h"
|
#include "ui/controls/who_reacted_context_action.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_peer.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
|
||||||
namespace HistoryView {
|
namespace HistoryView {
|
||||||
|
@ -61,13 +61,13 @@ public:
|
||||||
void loadMoreRows() override;
|
void loadMoreRows() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using AllEntry = std::pair<not_null<UserData*>, QString>;
|
using AllEntry = std::pair<not_null<PeerData*>, QString>;
|
||||||
|
|
||||||
void fillWhoRead();
|
void fillWhoRead();
|
||||||
void loadMore(const QString &reaction);
|
void loadMore(const QString &reaction);
|
||||||
bool appendRow(not_null<UserData*> user, QString reaction);
|
bool appendRow(not_null<PeerData*> peer, QString reaction);
|
||||||
std::unique_ptr<PeerListRow> createRow(
|
std::unique_ptr<PeerListRow> createRow(
|
||||||
not_null<UserData*> user,
|
not_null<PeerData*> peer,
|
||||||
QString reaction) const;
|
QString reaction) const;
|
||||||
void showReaction(const QString &reaction);
|
void showReaction(const QString &reaction);
|
||||||
|
|
||||||
|
@ -77,12 +77,12 @@ private:
|
||||||
|
|
||||||
QString _shownReaction;
|
QString _shownReaction;
|
||||||
std::shared_ptr<Api::WhoReadList> _whoReadIds;
|
std::shared_ptr<Api::WhoReadList> _whoReadIds;
|
||||||
std::vector<not_null<UserData*>> _whoRead;
|
std::vector<not_null<PeerData*>> _whoRead;
|
||||||
|
|
||||||
std::vector<AllEntry> _all;
|
std::vector<AllEntry> _all;
|
||||||
QString _allOffset;
|
QString _allOffset;
|
||||||
|
|
||||||
std::vector<not_null<UserData*>> _filtered;
|
std::vector<not_null<PeerData*>> _filtered;
|
||||||
QString _filteredOffset;
|
QString _filteredOffset;
|
||||||
|
|
||||||
mtpRequestId _loadRequestId = 0;
|
mtpRequestId _loadRequestId = 0;
|
||||||
|
@ -179,8 +179,8 @@ void Controller::showReaction(const QString &reaction) {
|
||||||
fillWhoRead();
|
fillWhoRead();
|
||||||
} else if (_shownReaction.isEmpty()) {
|
} else if (_shownReaction.isEmpty()) {
|
||||||
_filtered.clear();
|
_filtered.clear();
|
||||||
for (const auto &[user, reaction] : _all) {
|
for (const auto &[peer, reaction] : _all) {
|
||||||
appendRow(user, reaction);
|
appendRow(peer, reaction);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_filtered = _all | ranges::view::filter([&](const AllEntry &entry) {
|
_filtered = _all | ranges::view::filter([&](const AllEntry &entry) {
|
||||||
|
@ -188,8 +188,8 @@ void Controller::showReaction(const QString &reaction) {
|
||||||
}) | ranges::view::transform(
|
}) | ranges::view::transform(
|
||||||
&AllEntry::first
|
&AllEntry::first
|
||||||
) | ranges::to_vector;
|
) | ranges::to_vector;
|
||||||
for (const auto user : _filtered) {
|
for (const auto peer : _filtered) {
|
||||||
appendRow(user, _shownReaction);
|
appendRow(peer, _shownReaction);
|
||||||
}
|
}
|
||||||
_filteredOffset = QString();
|
_filteredOffset = QString();
|
||||||
}
|
}
|
||||||
|
@ -204,13 +204,13 @@ void Controller::fillWhoRead() {
|
||||||
if (_whoReadIds && !_whoReadIds->list.empty() && _whoRead.empty()) {
|
if (_whoReadIds && !_whoReadIds->list.empty() && _whoRead.empty()) {
|
||||||
auto &owner = _window->session().data();
|
auto &owner = _window->session().data();
|
||||||
for (const auto &peerId : _whoReadIds->list) {
|
for (const auto &peerId : _whoReadIds->list) {
|
||||||
if (const auto user = owner.userLoaded(peerToUser(peerId))) {
|
if (const auto peer = owner.peerLoaded(peerId)) {
|
||||||
_whoRead.push_back(user);
|
_whoRead.push_back(peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto &user : _whoRead) {
|
for (const auto &peer : _whoRead) {
|
||||||
appendRow(user, QString());
|
appendRow(peer, QString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,18 +255,19 @@ void Controller::loadMore(const QString &reaction) {
|
||||||
result.match([&](const MTPDmessages_messageReactionsList &data) {
|
result.match([&](const MTPDmessages_messageReactionsList &data) {
|
||||||
const auto sessionData = &session().data();
|
const auto sessionData = &session().data();
|
||||||
sessionData->processUsers(data.vusers());
|
sessionData->processUsers(data.vusers());
|
||||||
|
sessionData->processChats(data.vchats());
|
||||||
(filtered ? _filteredOffset : _allOffset)
|
(filtered ? _filteredOffset : _allOffset)
|
||||||
= data.vnext_offset().value_or_empty();
|
= data.vnext_offset().value_or_empty();
|
||||||
for (const auto &reaction : data.vreactions().v) {
|
for (const auto &reaction : data.vreactions().v) {
|
||||||
reaction.match([&](const MTPDmessageUserReaction &data) {
|
reaction.match([&](const MTPDmessagePeerReaction &data) {
|
||||||
const auto user = sessionData->userLoaded(
|
const auto peer = sessionData->peerLoaded(
|
||||||
data.vuser_id().v);
|
peerFromMTP(data.vpeer_id()));
|
||||||
const auto reaction = qs(data.vreaction());
|
const auto reaction = qs(data.vreaction());
|
||||||
if (user && (!shown || appendRow(user, reaction))) {
|
if (peer && (!shown || appendRow(peer, reaction))) {
|
||||||
if (filtered) {
|
if (filtered) {
|
||||||
_filtered.emplace_back(user);
|
_filtered.emplace_back(peer);
|
||||||
} else {
|
} else {
|
||||||
_all.emplace_back(user, reaction);
|
_all.emplace_back(peer, reaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -287,18 +288,18 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Controller::appendRow(not_null<UserData*> user, QString reaction) {
|
bool Controller::appendRow(not_null<PeerData*> peer, QString reaction) {
|
||||||
if (delegate()->peerListFindRow(user->id.value)) {
|
if (delegate()->peerListFindRow(peer->id.value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
delegate()->peerListAppendRow(createRow(user, reaction));
|
delegate()->peerListAppendRow(createRow(peer, reaction));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> Controller::createRow(
|
std::unique_ptr<PeerListRow> Controller::createRow(
|
||||||
not_null<UserData*> user,
|
not_null<PeerData*> peer,
|
||||||
QString reaction) const {
|
QString reaction) const {
|
||||||
return std::make_unique<Row>(user, reaction);
|
return std::make_unique<Row>(peer, reaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue