2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Implement correct ForumTopic::canWrite logic.

This commit is contained in:
John Preston
2022-10-25 11:20:22 +04:00
parent 1cd02fc3c9
commit 602ba5bba9
35 changed files with 363 additions and 144 deletions

View File

@@ -552,11 +552,14 @@ bool ChannelData::canPublish() const {
|| (adminRights() & AdminRight::PostMessages);
}
bool ChannelData::canWrite() const {
bool ChannelData::canWrite(bool checkForForum) const {
// Duplicated in Data::CanWriteValue().
const auto allowed = amIn()
|| ((flags() & Flag::HasLink) && !(flags() & Flag::JoinToWrite));
return allowed && (canPublish()
const auto forumRestriction = checkForForum && isForum();
return allowed
&& !forumRestriction
&& (canPublish()
|| (!isBroadcast()
&& !amRestricted(Restriction::SendMessages)));
}