Skip to content

Commit 0543491

Browse files
committed
Guarded api requests in search calendar controller.
1 parent cb13636 commit 0543491

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Telegram/SourceFiles/data/data_search_calendar.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ SearchCalendarController::SearchCalendarController(
2727
Storage::SharedMediaType type)
2828
: _session(session)
2929
, _peerId(peerId)
30-
, _type(type) {
30+
, _type(type)
31+
, _api(&session->mtp()) {
3132
}
3233

3334
void SearchCalendarController::monthThumbnails(
@@ -65,7 +66,7 @@ void SearchCalendarController::performMonthRequest(const MonthKey &key) {
6566

6667
auto &state = _months[key].state;
6768

68-
_months[key].requestId = _session->api().request(
69+
_months[key].requestId = _api.request(
6970
MTPmessages_GetSearchResultsCalendar(
7071
MTP_flags(0),
7172
peer->input(),

Telegram/SourceFiles/data/data_search_calendar.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ For license and copyright information please follow this link:
77
*/
88
#pragma once
99

10+
#include "mtproto/sender.h"
1011
#include "storage/storage_shared_media.h"
1112

1213
namespace Main {
@@ -87,6 +88,8 @@ class SearchCalendarController final {
8788
const PeerId _peerId;
8889
const Storage::SharedMediaType _type;
8990

91+
MTP::Sender _api;
92+
9093
base::flat_map<MonthKey, MonthData> _months;
9194

9295
};

0 commit comments

Comments
 (0)