Added support of admin log filter for extended subscriptions.

This commit is contained in:
23rd 2024-09-03 22:12:27 +03:00 committed by John Preston
parent e44aca06cb
commit 0241129948
4 changed files with 13 additions and 4 deletions

View File

@ -4407,6 +4407,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_admin_log_filter_invite_links" = "Invite links";
"lng_admin_log_filter_members_removed" = "Leaving members";
"lng_admin_log_filter_topics" = "Topics";
"lng_admin_log_filter_sub_extend" = "Subscription Renewals";
"lng_admin_log_filter_all_admins" = "All users and admins";
"lng_admin_log_filter_actions_admins_subtitle" = "Filter actions by admins";
"lng_admin_log_filter_actions_admins_section" = "Show Actions by All Admins";

View File

@ -50,6 +50,10 @@ EditFlagsDescriptor<FilterValue::Flags> FilterValueLabels(bool isChannel) {
? tr::lng_admin_log_filter_voice_chats
: tr::lng_admin_log_filter_voice_chats_channel)(tr::now),
},
{
Flag::SubExtend,
tr::lng_admin_log_filter_sub_extend(tr::now),
},
};
if (!isChannel) {
settings.push_back({

View File

@ -28,8 +28,9 @@ struct FilterValue final {
GroupCall = (1U << 14),
Invites = (1U << 15),
Topics = (1U << 16),
SubExtend = (1U << 17),
MAX_FIELD = (1U << 16),
MAX_FIELD = (1U << 17),
};
using Flags = base::flags<Flag>;
friend inline constexpr bool is_flag_type(Flag) { return true; };

View File

@ -572,11 +572,13 @@ void InnerWidget::showFilter(Fn<void(FilterValue &&filter)> callback) {
const auto users = ranges::views::all(
peers
) | ranges::views::transform([](not_null<PeerData*> p) {
return not_null{ p->asUser() };
return not_null{ p->asUser() };
}) | ranges::to_vector;
callback(FilterValue{
.flags = collectFlags(),
.admins = users,
.admins = (admins.size() == users.size())
? std::nullopt
: std::optional(users),
});
});
box->addButton(tr::lng_cancel(), [box] { box->closeBox(); });
@ -835,7 +837,8 @@ void InnerWidget::preloadMore(Direction direction) {
| ((f & LocalFlag::Delete) ? Flag::f_delete : empty)
| ((f & LocalFlag::GroupCall) ? Flag::f_group_call : empty)
| ((f & LocalFlag::Invites) ? Flag::f_invites : empty)
| ((f & LocalFlag::Topics) ? Flag::f_forums : empty);
| ((f & LocalFlag::Topics) ? Flag::f_forums : empty)
| ((f & LocalFlag::SubExtend) ? Flag::f_sub_extend : empty);
}();
if (_filter.flags != 0) {
flags |= MTPchannels_GetAdminLog::Flag::f_events_filter;