Moved PeerId parameter to SearchCalendarController constructor.

This commit is contained in:
23rd
2026-02-09 18:15:37 +03:00
parent b6121a5d64
commit e04b6e9201
3 changed files with 6 additions and 4 deletions
@@ -23,18 +23,19 @@ namespace Api {
SearchCalendarController::SearchCalendarController(
not_null<Main::Session*> session,
PeerId peerId,
Storage::SharedMediaType type)
: _session(session)
, _peerId(peerId)
, _type(type) {
}
void SearchCalendarController::monthThumbnails(
PeerId peerId,
TimeId date,
Fn<void(std::vector<DayThumbnail>)> onFinish) {
const auto parsed = base::unixtime::parse(date).date();
const auto key = MonthKey{
.peerId = peerId,
.peerId = _peerId,
.year = parsed.year(),
.month = parsed.month(),
};
@@ -42,10 +42,10 @@ class SearchCalendarController final {
public:
SearchCalendarController(
not_null<Main::Session*> session,
PeerId peerId,
Storage::SharedMediaType type);
void monthThumbnails(
PeerId peerId,
TimeId date,
Fn<void(std::vector<DayThumbnail>)> onFinish);
@@ -81,6 +81,7 @@ private:
bool noMoreData);
const not_null<Main::Session*> _session;
const PeerId _peerId;
const Storage::SharedMediaType _type;
base::flat_map<MonthKey, MonthData> _months;
@@ -2818,6 +2818,7 @@ void SessionController::showCalendar(ShowCalendarDescriptor &&descriptor) {
}
const auto search = std::make_shared<Api::SearchCalendarController>(
&session(),
history->peer->id,
(descriptor.mediaPhoto && descriptor.mediaVideo)
? Storage::SharedMediaType::PhotoVideo
: descriptor.mediaPhoto
@@ -2825,7 +2826,6 @@ void SessionController::showCalendar(ShowCalendarDescriptor &&descriptor) {
: Storage::SharedMediaType::Video);
return (ReturnType)[=](QDate date, Ui::CalendarImageSetter set) {
search->monthThumbnails(
peerId,
base::unixtime::serialize(QDateTime(date, QTime())),
[=](const std::vector<Api::DayThumbnail> &thumbnails) {
for (const auto &thumb : thumbnails) {