Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2610,10 +2610,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_group_requests_add" = "Add to Group";
"lng_group_requests_add_channel" = "Add to Channel";
"lng_group_requests_dismiss" = "Dismiss";
"lng_group_requests_dismiss_all" = "Dismiss all";
"lng_group_requests_ban_all" = "Ban all";
"lng_group_requests_was_added" = "{user} has been added to the group.";
"lng_group_requests_was_added_channel" = "{user} has been added to the channel.";
"lng_group_requests_none" = "There are no pending join requests.";
"lng_group_requests_none_channel" = "There are no pending join requests.";
"lng_group_requests_dismiss_all_confirm" = "Are you sure you want to dismiss all pending join requests?";
"lng_group_requests_ban_all_confirm" = "Are you sure you want to ban all users who requested to join?";
"lng_group_requests_ban_too_much_users" = "You cannot ban so many users at once. Try dismissing them instead.";

"lng_channel_public_link_copied" = "Link copied to clipboard.";
"lng_context_about_private_link" = "This link will only work for members of this chat.";
Expand Down
10 changes: 10 additions & 0 deletions Telegram/SourceFiles/boxes/boxes.style
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,16 @@ requestsRejectButton: RoundButton(defaultLightButton) {
textTop: 6px;
}
requestsBanButton: RoundButton(defaultActiveButton) {
textBg: banButtonBg;
textBgOver: banButtonBgOver;
width: -28px;
height: 30px;
textTop: 6px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: banButtonBgRipple;
}
Comment on lines +1029 to +1036
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses spaces while surrounding lines use tabs. Should use tabs to match the file's indentation style.

Suggested change
textBg: banButtonBg;
textBgOver: banButtonBgOver;
width: -28px;
height: 30px;
textTop: 6px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: banButtonBgRipple;
}
textBg: banButtonBg;
textBgOver: banButtonBgOver;
width: -28px;
height: 30px;
textTop: 6px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: banButtonBgRipple;
}

Copilot uses AI. Check for mistakes.
Comment on lines +1035 to +1036
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: this line uses spaces while surrounding lines use tabs. Should use tabs to match the file's indentation style.

Suggested change
color: banButtonBgRipple;
}
color: banButtonBgRipple;
}

Copilot uses AI. Check for mistakes.
}
requestsBanAllButton: RoundButton(requestsBanButton) {
width: -28px;
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Negative width value -28px is likely incorrect. This should be a positive value or use a different sizing approach.

Copilot uses AI. Check for mistakes.
height: 30px;
textTop: 6px;
Expand Down
117 changes: 116 additions & 1 deletion Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ For license and copyright information please follow this link:
#include "ui/painter.h"
#include "ui/round_rect.h"
#include "ui/text/text_utilities.h"
#include "ui/widgets/buttons.h"
#include "ui/boxes/confirm_box.h"
#include "window/window_session_controller.h"
#include "styles/style_boxes.h"

Expand Down Expand Up @@ -398,9 +400,123 @@ void RequestsBoxController::prepare() {
: tr::lng_manage_peer_requests());
setDescriptionText(tr::lng_contacts_loading(tr::now));
setSearchNoResultsText(tr::lng_blocked_list_not_found(tr::now));
delegate()->peerListSetAboveWidget(createBatchActionsWidget());
loadMoreRows();
}

object_ptr<Ui::RpWidget> RequestsBoxController::createBatchActionsWidget() {
auto result = object_ptr<Ui::RpWidget>(static_cast<QWidget*>(nullptr));
const auto container = result.data();

const auto dismissAll = Ui::CreateChild<Ui::RoundButton>(
container,
tr::lng_group_requests_dismiss_all(),
st::requestsRejectButton);
dismissAll->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
dismissAll->setClickedCallback([=] {
dismissAllRequests();
});

const auto banAll = Ui::CreateChild<Ui::RoundButton>(
container,
tr::lng_group_requests_ban_all(),
st::requestsBanAllButton);
banAll->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
banAll->setClickedCallback([=] {
banAllRequests();
});

container->widthValue(
) | rpl::start_with_next([=](int width) {
const auto padding = st::requestButtonsSkip * 2;
const auto buttonWidth = (width - padding * 3) / 2;
const auto height = st::requestsAcceptButton.height + st::requestButtonsSkip * 2;
container->resize(width, height);
dismissAll->setGeometry(
padding,
st::requestButtonsSkip,
buttonWidth,
st::requestsAcceptButton.height);
banAll->setGeometry(
padding * 2 + buttonWidth,
st::requestButtonsSkip,
buttonWidth,
st::requestsAcceptButton.height);
}, container->lifetime());

return result;
}

void RequestsBoxController::dismissAllRequests() {
const auto count = delegate()->peerListFullRowsCount();
if (count == 0) {
return;
}

const auto guard = base::make_weak(this);
delegate()->peerListUiShow()->showBox(Ui::MakeConfirmBox({
.text = tr::lng_group_requests_dismiss_all_confirm(tr::now),
.confirmed = [=] {
if (!guard) {
return;
}
// Collect all users
std::vector<not_null<UserData*>> users;
const auto fullCount = delegate()->peerListFullRowsCount();
for (auto i = 0; i < fullCount; ++i) {
Comment on lines +464 to +466
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code duplicates the user collection logic between dismissAllRequests() and banAllRequests(). Consider extracting this into a private helper method that returns the vector of users.

Copilot uses AI. Check for mistakes.
const auto row = delegate()->peerListRowAt(i);
if (const auto user = row->peer()->asUser()) {
users.push_back(user);
}
}

// Process all requests
for (const auto user : users) {
processRequest(user, false, false);
}
Comment on lines +463 to +476
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This user collection and processing logic is duplicated in both dismissAllRequests() and banAllRequests(). Consider extracting this into a helper method that takes a callback or boolean parameter to reduce code duplication.

Copilot uses AI. Check for mistakes.
}
}));
}

void RequestsBoxController::banAllRequests() {
const auto count = delegate()->peerListFullRowsCount();
if (count == 0) {
return;
}

if (count >= 20) {
delegate()->peerListUiShow()->showBox(Ui::MakeConfirmBox({
.text = tr::lng_group_requests_ban_too_much_users(tr::now),
.inform = true
}));
return;
}

const auto guard = base::make_weak(this);
delegate()->peerListUiShow()->showBox(Ui::MakeConfirmBox({
.text = tr::lng_group_requests_ban_all_confirm(tr::now),
.confirmed = [=] {
if (!guard) {
return;
}
// Collect all users
std::vector<not_null<UserData*>> users;
const auto fullCount = delegate()->peerListFullRowsCount();
for (auto i = 0; i < fullCount; ++i) {
const auto row = delegate()->peerListRowAt(i);
if (const auto user = row->peer()->asUser()) {
users.push_back(user);
}
}

// Process all requests
for (const auto user : users) {
processRequest(user, false, true);
}
}
}));
}

void RequestsBoxController::loadMoreRows() {
if (searchController() && searchController()->loadMoreRows()) {
return;
Expand Down Expand Up @@ -589,7 +705,6 @@ void RequestsBoxController::RowHelper::rowPaintBan(
std::unique_ptr<Ui::RippleAnimation> &ripple,
int outerWidth,
bool over) {
_banRect.setColor(st::banButtonBg);
paintButton(
p,
geometry,
Expand Down
4 changes: 4 additions & 0 deletions Telegram/SourceFiles/boxes/peers/edit_peer_requests_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class RequestsBoxController final
void refreshDescription();
void processRequest(not_null<UserData*> user, bool approved, bool banned);

[[nodiscard]] object_ptr<Ui::RpWidget> createBatchActionsWidget();
void dismissAllRequests();
void banAllRequests();

void subscribeToMigration();
void migrate(not_null<ChatData*> chat, not_null<ChannelData*> channel);

Expand Down
2 changes: 1 addition & 1 deletion Telegram/lib_ui
Submodule lib_ui updated 1 files
+3 −1 ui/colors.palette