2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Edit join public group request requirement.

This commit is contained in:
John Preston
2022-04-15 20:57:03 +04:00
parent a752c4d9f3
commit c3386fba52
8 changed files with 275 additions and 89 deletions

View File

@@ -913,6 +913,16 @@ Dialogs::EntryState HistoryWidget::computeDialogsEntryState() const {
};
}
void HistoryWidget::refreshJoinChannelText() {
if (const auto channel = _peer ? _peer->asChannel() : nullptr) {
_joinChannel->setText((channel->isBroadcast()
? tr::lng_profile_join_channel(tr::now)
: (channel->requestToJoin() && !channel->amCreator())
? tr::lng_profile_apply_to_join_group(tr::now)
: tr::lng_profile_join_group(tr::now)).toUpper());
}
}
void HistoryWidget::refreshTopBarActiveChat() {
const auto state = computeDialogsEntryState();
_topBar->setActiveChat(state, _history->sendActionPainter());
@@ -2210,12 +2220,6 @@ void HistoryWidget::showHistory(
&& !_peer->asUser()->isSupport())
? tr::lng_restart_button(tr::now)
: tr::lng_unblock_button(tr::now)).toUpper());
if (const auto channel = _peer->asChannel()) {
channel->updateFull();
_joinChannel->setText((channel->isMegagroup()
? tr::lng_profile_join_group(tr::now)
: tr::lng_profile_join_channel(tr::now)).toUpper());
}
}
_nonEmptySelection = false;
@@ -2269,6 +2273,18 @@ void HistoryWidget::showHistory(
object_ptr<HistoryInner>(this, _scroll, controller(), _history));
_list->show();
if (const auto channel = _peer->asChannel()) {
channel->updateFull();
if (!channel->isBroadcast()) {
channel->flagsValue(
) | rpl::start_with_next([=] {
refreshJoinChannelText();
}, _list->lifetime());
} else {
refreshJoinChannelText();
}
}
controller()->adaptive().changes(
) | rpl::start_with_next([=] {
_history->forceFullResize();