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()
|| (context != Context::History
&& context != Context::Replies
&& context != Context::ShortcutMessages)) {
&& context != Context::ShortcutMessages
&& context != Context::ScheduledTopic)) {
return false;
}
const auto peer = item->history()->peer;
@ -1340,7 +1341,8 @@ void AddPollActions(
}
if ((context != Context::History)
&& (context != Context::Replies)
&& (context != Context::Pinned)) {
&& (context != Context::Pinned)
&& (context != Context::ScheduledTopic)) {
return;
}
if (poll->closed()) {

View file

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

View file

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

View file

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