mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
using Key = SliceKey;
|
||||||
const auto inSameDomain = [](const Key &a, const Key &b) {
|
const auto inSameDomain = [](const Key &a, const Key &b) {
|
||||||
return (a.peerId == b.peerId)
|
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) {
|
const auto countDistanceInData = [&](const Key &a, const Key &b) {
|
||||||
return [&](const SparseIdsMergedSlice &data) {
|
return [&](const SparseIdsMergedSlice &data) {
|
||||||
|
@ -300,7 +301,11 @@ void Instance::validatePlaylist(not_null<Data*> data) {
|
||||||
data->playlistLifetime.destroy();
|
data->playlistLifetime.destroy();
|
||||||
if (const auto key = playlistKey(data)) {
|
if (const auto key = playlistKey(data)) {
|
||||||
data->playlistRequestedKey = key;
|
data->playlistRequestedKey = key;
|
||||||
SharedMediaMergedViewer(
|
|
||||||
|
const auto sharedMediaViewer = key->scheduled
|
||||||
|
? SharedScheduledMediaViewer
|
||||||
|
: SharedMediaMergedViewer;
|
||||||
|
sharedMediaViewer(
|
||||||
&data->history->session(),
|
&data->history->session(),
|
||||||
SharedMediaMergedKey(*key, data->overview),
|
SharedMediaMergedKey(*key, data->overview),
|
||||||
kIdsLimit,
|
kIdsLimit,
|
||||||
|
@ -321,7 +326,11 @@ auto Instance::playlistKey(not_null<Data*> data) const
|
||||||
-> std::optional<SliceKey> {
|
-> std::optional<SliceKey> {
|
||||||
const auto contextId = data->current.contextId();
|
const auto contextId = data->current.contextId();
|
||||||
const auto history = data->history;
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +340,8 @@ auto Instance::playlistKey(not_null<Data*> data) const
|
||||||
return SliceKey(
|
return SliceKey(
|
||||||
data->history->peer->id,
|
data->history->peer->id,
|
||||||
data->migrated ? data->migrated->peer->id : 0,
|
data->migrated ? data->migrated->peer->id : 0,
|
||||||
universalId);
|
universalId,
|
||||||
|
item->isScheduled());
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryItem *Instance::itemByIndex(not_null<Data*> data, int index) {
|
HistoryItem *Instance::itemByIndex(not_null<Data*> data, int index) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue