2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Handle join-to-write / request-to-join in comments section.

This commit is contained in:
John Preston
2022-04-21 18:29:49 +04:00
parent 5874ae7c51
commit 2f6f432583
6 changed files with 127 additions and 15 deletions

View File

@@ -205,6 +205,7 @@ rpl::producer<bool> CanWriteValue(ChannelData *channel) {
using Flag = ChannelDataFlag;
const auto mask = 0
| Flag::Left
| Flag::JoinToWrite
| Flag::HasLink
| Flag::Forbidden
| Flag::Creator
@@ -227,7 +228,7 @@ rpl::producer<bool> CanWriteValue(ChannelData *channel) {
bool defaultSendMessagesRestriction) {
const auto notAmInFlags = Flag::Left | Flag::Forbidden;
const auto allowed = !(flags & notAmInFlags)
|| (flags & Flag::HasLink);
|| ((flags & Flag::HasLink) && !(flags & Flag::JoinToWrite));
return allowed && (postMessagesRight
|| (flags & Flag::Creator)
|| (!(flags & Flag::Broadcast)