Improved section of scheduled messages when forum opened in flat mode.

This commit is contained in:
23rd 2024-03-13 21:29:46 +03:00 committed by John Preston
parent 782556495a
commit fe4b853393
4 changed files with 18 additions and 10 deletions

View file

@ -104,7 +104,8 @@ bool HasEditMessageAction(
|| !request.selectedItems.empty() || !request.selectedItems.empty()
|| (context != Context::History || (context != Context::History
&& context != Context::Replies && context != Context::Replies
&& context != Context::ShortcutMessages)) { && context != Context::ShortcutMessages
&& context != Context::ScheduledTopic)) {
return false; return false;
} }
const auto peer = item->history()->peer; const auto peer = item->history()->peer;
@ -1340,7 +1341,8 @@ void AddPollActions(
} }
if ((context != Context::History) if ((context != Context::History)
&& (context != Context::Replies) && (context != Context::Replies)
&& (context != Context::Pinned)) { && (context != Context::Pinned)
&& (context != Context::ScheduledTopic)) {
return; return;
} }
if (poll->closed()) { if (poll->closed()) {

View file

@ -60,6 +60,7 @@ enum class Context : char {
SavedSublist, SavedSublist,
TTLViewer, TTLViewer,
ShortcutMessages, ShortcutMessages,
ScheduledTopic,
}; };
enum class OnlyEmojiAndSpaces : char { enum class OnlyEmojiAndSpaces : char {

View file

@ -861,9 +861,7 @@ QSize Message::performCountOptimalSize() {
void Message::refreshTopicButton() { void Message::refreshTopicButton() {
const auto item = data(); const auto item = data();
if (isAttachedToPrevious() if (isAttachedToPrevious() || context() != Context::History) {
|| (context() != Context::History)
|| item->isScheduled()) {
_topicButton = nullptr; _topicButton = nullptr;
} else if (const auto topic = item->topic()) { } else if (const auto topic = item->topic()) {
if (!_topicButton) { if (!_topicButton) {
@ -2044,7 +2042,8 @@ bool Message::hasFromPhoto() const {
case Context::TTLViewer: case Context::TTLViewer:
case Context::Pinned: case Context::Pinned:
case Context::Replies: case Context::Replies:
case Context::SavedSublist: { case Context::SavedSublist:
case Context::ScheduledTopic: {
const auto item = data(); const auto item = data();
if (item->isPost()) { if (item->isPost()) {
return false; return false;
@ -3243,7 +3242,8 @@ bool Message::hasFromName() const {
case Context::TTLViewer: case Context::TTLViewer:
case Context::Pinned: case Context::Pinned:
case Context::Replies: case Context::Replies:
case Context::SavedSublist: { case Context::SavedSublist:
case Context::ScheduledTopic: {
const auto item = data(); const auto item = data();
const auto peer = item->history()->peer; const auto peer = item->history()->peer;
if (hasOutLayout() && !item->from()->isChannel()) { if (hasOutLayout() && !item->from()->isChannel()) {

View file

@ -252,7 +252,8 @@ void ScheduledWidget::setupComposeControls() {
& ~ChatRestriction::SendPolls; & ~ChatRestriction::SendPolls;
const auto canSendAnything = Data::CanSendAnyOf( const auto canSendAnything = Data::CanSendAnyOf(
_history->peer, _history->peer,
allWithoutPolls); allWithoutPolls,
false);
const auto restriction = Data::RestrictionError( const auto restriction = Data::RestrictionError(
_history->peer, _history->peer,
ChatRestriction::SendOther); ChatRestriction::SendOther);
@ -650,7 +651,11 @@ void ScheduledWidget::send() {
const auto error = GetErrorTextForSending( const auto error = GetErrorTextForSending(
_history->peer, _history->peer,
{ {
.topicRootId = _forumTopic ? _forumTopic->topicRootId() : MsgId(), .topicRootId = _forumTopic
? _forumTopic->topicRootId()
: history()->isForum()
? MsgId(1)
: MsgId(),
.forward = nullptr, .forward = nullptr,
.text = &textWithTags, .text = &textWithTags,
.ignoreSlowmodeCountdown = true, .ignoreSlowmodeCountdown = true,
@ -1143,7 +1148,7 @@ QRect ScheduledWidget::floatPlayerAvailableRect() {
} }
Context ScheduledWidget::listContext() { Context ScheduledWidget::listContext() {
return Context::History; return _forumTopic ? Context::ScheduledTopic : Context::History;
} }
bool ScheduledWidget::listScrollTo(int top, bool syntetic) { bool ScheduledWidget::listScrollTo(int top, bool syntetic) {