Skip to content

Commit

Permalink
Added support of admin log filter for extended subscriptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd authored and john-preston committed Sep 6, 2024
1 parent e44aca0 commit 0241129
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(); });
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0241129

Please sign in to comment.