mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 22:46:10 +00:00
Allow editing sensitive content filtering.
This commit is contained in:
@@ -8,6 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
|
||||
#include "api/api_text_entities.h"
|
||||
#include "api/api_self_destruct.h"
|
||||
#include "api/api_sensitive_content.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_web_page.h"
|
||||
@@ -233,7 +235,9 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
|
||||
//, _feedReadTimer([=] { readFeeds(); }) // #feed
|
||||
, _proxyPromotionTimer([=] { refreshProxyPromotion(); })
|
||||
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); }) {
|
||||
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); })
|
||||
, _selfDestruct(std::make_unique<Api::SelfDestruct>(this))
|
||||
, _sensitiveContent(std::make_unique<Api::SensitiveContent>(this)) {
|
||||
crl::on_main([=] {
|
||||
// You can't use _session->lifetime() in the constructor,
|
||||
// only queued, because it is not constructed yet.
|
||||
@@ -246,6 +250,8 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||
});
|
||||
}
|
||||
|
||||
ApiWrap::~ApiWrap() = default;
|
||||
|
||||
Main::Session &ApiWrap::session() const {
|
||||
return *_session;
|
||||
}
|
||||
@@ -5800,42 +5806,12 @@ auto ApiWrap::blockedUsersSlice() -> rpl::producer<BlockedUsersSlice> {
|
||||
: (_blockedUsersChanges.events() | rpl::type_erased());
|
||||
}
|
||||
|
||||
void ApiWrap::reloadSelfDestruct() {
|
||||
if (_selfDestructRequestId) {
|
||||
return;
|
||||
}
|
||||
_selfDestructRequestId = request(MTPaccount_GetAccountTTL(
|
||||
)).done([=](const MTPAccountDaysTTL &result) {
|
||||
_selfDestructRequestId = 0;
|
||||
result.match([&](const MTPDaccountDaysTTL &data) {
|
||||
setSelfDestructDays(data.vdays().v);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
_selfDestructRequestId = 0;
|
||||
}).send();
|
||||
Api::SelfDestruct &ApiWrap::selfDestruct() {
|
||||
return *_selfDestruct;
|
||||
}
|
||||
|
||||
rpl::producer<int> ApiWrap::selfDestructValue() const {
|
||||
return _selfDestructDays
|
||||
? _selfDestructChanges.events_starting_with_copy(*_selfDestructDays)
|
||||
: (_selfDestructChanges.events() | rpl::type_erased());
|
||||
}
|
||||
|
||||
void ApiWrap::saveSelfDestruct(int days) {
|
||||
request(_selfDestructRequestId).cancel();
|
||||
_selfDestructRequestId = request(MTPaccount_SetAccountTTL(
|
||||
MTP_accountDaysTTL(MTP_int(days))
|
||||
)).done([=](const MTPBool &result) {
|
||||
_selfDestructRequestId = 0;
|
||||
}).fail([=](const RPCError &result) {
|
||||
_selfDestructRequestId = 0;
|
||||
}).send();
|
||||
setSelfDestructDays(days);
|
||||
}
|
||||
|
||||
void ApiWrap::setSelfDestructDays(int days) {
|
||||
_selfDestructDays = days;
|
||||
_selfDestructChanges.fire_copy(days);
|
||||
Api::SensitiveContent &ApiWrap::sensitiveContent() {
|
||||
return *_sensitiveContent;
|
||||
}
|
||||
|
||||
void ApiWrap::createPoll(
|
||||
@@ -6107,5 +6083,3 @@ void ApiWrap::sendReadRequest(not_null<PeerData*> peer, MsgId upTo) {
|
||||
}();
|
||||
_readRequests.emplace(peer, requestId, upTo);
|
||||
}
|
||||
|
||||
ApiWrap::~ApiWrap() = default;
|
||||
|
Reference in New Issue
Block a user