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

@@ -811,6 +811,8 @@ Manager::DisplayOptions Manager::getNotificationOptions(
const auto hideEverything = Core::App().passcodeLocked()
|| forceHideDetails();
const auto view = Core::App().settings().notifyView();
const auto peer = item ? item->history()->peer.get() : nullptr;
const auto topic = item ? item->topic() : nullptr;
auto result = DisplayOptions();
result.hideNameAndPhoto = hideEverything
@@ -820,12 +822,11 @@ Manager::DisplayOptions Manager::getNotificationOptions(
result.hideMarkAsRead = result.hideMessageText
|| (type != Data::ItemNotificationType::Message)
|| !item
|| ((item->out() || item->history()->peer->isSelf())
&& item->isFromScheduled());
|| ((item->out() || peer->isSelf()) && item->isFromScheduled());
result.hideReplyButton = result.hideMarkAsRead
|| !item->history()->peer->canWrite()
|| item->history()->peer->isBroadcast()
|| (item->history()->peer->slowmodeSecondsLeft() > 0);
|| (!peer->canWrite() && (!topic || !topic->canWrite()))
|| peer->isBroadcast()
|| (peer->slowmodeSecondsLeft() > 0);
return result;
}