mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Added ability to validate playlists in section of scheduled messages.
This commit is contained in:
parent
1a93f4fa4c
commit
4753a57091
1 changed files with 14 additions and 4 deletions
|
@ -269,7 +269,8 @@ bool Instance::validPlaylist(not_null<Data*> data) {
|
|||
using Key = SliceKey;
|
||||
const auto inSameDomain = [](const Key &a, const Key &b) {
|
||||
return (a.peerId == b.peerId)
|
||||
&& (a.migratedPeerId == b.migratedPeerId);
|
||||
&& (a.migratedPeerId == b.migratedPeerId)
|
||||
&& (a.scheduled == b.scheduled);
|
||||
};
|
||||
const auto countDistanceInData = [&](const Key &a, const Key &b) {
|
||||
return [&](const SparseIdsMergedSlice &data) {
|
||||
|
@ -300,7 +301,11 @@ void Instance::validatePlaylist(not_null<Data*> data) {
|
|||
data->playlistLifetime.destroy();
|
||||
if (const auto key = playlistKey(data)) {
|
||||
data->playlistRequestedKey = key;
|
||||
SharedMediaMergedViewer(
|
||||
|
||||
const auto sharedMediaViewer = key->scheduled
|
||||
? SharedScheduledMediaViewer
|
||||
: SharedMediaMergedViewer;
|
||||
sharedMediaViewer(
|
||||
&data->history->session(),
|
||||
SharedMediaMergedKey(*key, data->overview),
|
||||
kIdsLimit,
|
||||
|
@ -321,7 +326,11 @@ auto Instance::playlistKey(not_null<Data*> data) const
|
|||
-> std::optional<SliceKey> {
|
||||
const auto contextId = data->current.contextId();
|
||||
const auto history = data->history;
|
||||
if (!contextId || !history || !IsServerMsgId(contextId.msg)) {
|
||||
if (!contextId || !history) {
|
||||
return {};
|
||||
}
|
||||
const auto item = data->history->owner().message(contextId);
|
||||
if (!item || (!IsServerMsgId(contextId.msg) && !item->isScheduled())) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -331,7 +340,8 @@ auto Instance::playlistKey(not_null<Data*> data) const
|
|||
return SliceKey(
|
||||
data->history->peer->id,
|
||||
data->migrated ? data->migrated->peer->id : 0,
|
||||
universalId);
|
||||
universalId,
|
||||
item->isScheduled());
|
||||
}
|
||||
|
||||
HistoryItem *Instance::itemByIndex(not_null<Data*> data, int index) {
|
||||
|
|
Loading…
Add table
Reference in a new issue