Improve shortcut messages geometry.

This commit is contained in:
John Preston 2024-02-27 13:58:46 +04:00
parent 6e08b00dba
commit fb539b0f70
4 changed files with 9 additions and 8 deletions

View file

@ -735,7 +735,7 @@ TimeId HistoryItem::NewMessageDate(TimeId scheduled) {
TimeId HistoryItem::NewMessageDate( TimeId HistoryItem::NewMessageDate(
const Api::SendOptions &options) { const Api::SendOptions &options) {
return options.shortcutId ? TimeId() : NewMessageDate(options.scheduled); return options.shortcutId ? 1 : NewMessageDate(options.scheduled);
} }
HistoryServiceDependentData *HistoryItem::GetServiceDependentData() { HistoryServiceDependentData *HistoryItem::GetServiceDependentData() {

View file

@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h" #include "mainwindow.h"
#include "media/audio/media_audio.h" #include "media/audio/media_audio.h"
#include "media/player/media_player_instance.h" #include "media/player/media_player_instance.h"
#include "data/business/data_shortcut_messages.h"
#include "data/stickers/data_custom_emoji.h" #include "data/stickers/data_custom_emoji.h"
#include "data/data_channel.h" #include "data/data_channel.h"
#include "data/data_media_types.h" #include "data/data_media_types.h"
@ -301,10 +302,11 @@ ReplyFields ReplyFieldsFromMTP(
if (const auto id = data.vreply_to_msg_id().value_or_empty()) { if (const auto id = data.vreply_to_msg_id().value_or_empty()) {
result.messageId = data.is_reply_to_scheduled() result.messageId = data.is_reply_to_scheduled()
? owner->scheduledMessages().localMessageId(id) ? owner->scheduledMessages().localMessageId(id)
AssertIsDebug() : item->shortcutId()
? owner->shortcutMessages().localMessageId(id)
: id; : id;
result.topMessageId result.topMessageId
= data.vreply_to_top_id().value_or(id); = data.vreply_to_top_id().value_or(result.messageId.bare);
result.topicPost = data.is_forum_topic() ? 1 : 0; result.topicPost = data.is_forum_topic() ? 1 : 0;
} }
if (const auto header = data.vreply_from()) { if (const auto header = data.vreply_from()) {

View file

@ -462,7 +462,7 @@ Element::Element(
Flag serviceFlag) Flag serviceFlag)
: _delegate(delegate) : _delegate(delegate)
, _data(data) , _data(data)
, _dateTime(IsItemScheduledUntilOnline(data) , _dateTime((IsItemScheduledUntilOnline(data) || data->shortcutId())
? QDateTime() ? QDateTime()
: ItemDateTime(data)) : ItemDateTime(data))
, _text(st::msgMinWidth) , _text(st::msgMinWidth)

View file

@ -337,8 +337,8 @@ ShortcutMessages::ShortcutMessages(
_inner->setEmptyInfoWidget(std::move(emptyInfo)); _inner->setEmptyInfoWidget(std::move(emptyInfo));
} }
widthValue() | rpl::start_with_next([=](int width) { _inner->heightValue() | rpl::start_with_next([=](int height) {
resize(width, width); resize(width(), height);
}, lifetime()); }, lifetime());
} }
@ -401,7 +401,6 @@ void ShortcutMessages::outerResized(QSize outer) {
: 0; : 0;
_skipScrollEvent = true; _skipScrollEvent = true;
_inner->resizeToWidth(contentWidth, _scroll->height()); _inner->resizeToWidth(contentWidth, _scroll->height());
resize(width(), _inner->height());
_skipScrollEvent = false; _skipScrollEvent = false;
if (!_scroll->isHidden()) { if (!_scroll->isHidden()) {
@ -743,7 +742,7 @@ void ShortcutMessages::listAddTranslatedItems(
void ShortcutMessages::cornerButtonsShowAtPosition( void ShortcutMessages::cornerButtonsShowAtPosition(
Data::MessagePosition position) { Data::MessagePosition position) {
//showAtPosition(position); showAtPosition(position);
} }
Data::Thread *ShortcutMessages::cornerButtonsThread() { Data::Thread *ShortcutMessages::cornerButtonsThread() {