fix: restrict saving content toggle

This commit is contained in:
AlexeyZavar 2025-07-07 00:59:02 +03:00
parent e097a5de58
commit 12879207ef
3 changed files with 6 additions and 5 deletions

View file

@ -932,7 +932,7 @@ void Controller::fillPrivacyTypeButton() {
.usernamesOrder = (_peer->isChannel()
? _peer->asChannel()->usernames()
: std::vector<QString>()),
.noForwards = !_peer->allowsForwarding(),
.noForwards = _peer->isAyuNoForwards(),
.joinToWrite = (_peer->isMegagroup()
&& _peer->asChannel()->joinToWrite()),
.requestToJoin = (_peer->isMegagroup()
@ -2572,7 +2572,7 @@ void Controller::saveSignatures() {
void Controller::saveForwards() {
if (!_savingData.noForwards
|| *_savingData.noForwards != _peer->allowsForwarding()) {
|| *_savingData.noForwards == _peer->isAyuNoForwards()) {
return continueSave();
}
_api.request(MTPmessages_ToggleNoForwards(

View file

@ -1387,7 +1387,7 @@ Data::ForumTopic *PeerData::forumTopicFor(MsgId rootId) const {
}
bool PeerData::isAyuNoForwards() const {
if (const auto user = asUser()) {
if (asUser()) {
return false;
} else if (const auto channel = asChannel()) {
return channel->isAyuNoForwards();
@ -1397,7 +1397,6 @@ bool PeerData::isAyuNoForwards() const {
return true;
}
bool PeerData::allowsForwarding() const {
if (isUser()) {
return true;

View file

@ -850,7 +850,8 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
| Flag::Forbidden
| Flag::CallActive
| Flag::CallNotEmpty
| Flag::NoForwards;
| Flag::NoForwards
| Flag::AyuNoForwards;
const auto flagsSet = (data.is_left() ? Flag::Left : Flag())
| (data.is_creator() ? Flag::Creator : Flag())
| (data.is_deactivated() ? Flag::Deactivated : Flag())
@ -972,6 +973,7 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
| Flag::Forbidden
| (!minimal ? (Flag::Left | Flag::Creator) : Flag())
| Flag::NoForwards
| Flag::AyuNoForwards
| Flag::JoinToWrite
| Flag::RequestToJoin
| Flag::Forum