Added original date of forwarded messages to bottom message in self.

This commit is contained in:
23rd
2025-11-07 14:22:07 +03:00
parent ff42b7f61a
commit 417d151f2c
2 changed files with 12 additions and 3 deletions
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/view/media/history_view_media.h" #include "history/view/media/history_view_media.h"
#include "history/view/history_view_message.h" #include "history/view/history_view_message.h"
#include "history/view/history_view_cursor_state.h" #include "history/view/history_view_cursor_state.h"
#include "base/unixtime.h"
#include "chat_helpers/emoji_interactions.h" #include "chat_helpers/emoji_interactions.h"
#include "core/click_handler_types.h" #include "core/click_handler_types.h"
#include "main/main_session.h" #include "main/main_session.h"
@@ -415,9 +416,9 @@ void BottomInfo::layoutDateText() {
: QString(); : QString();
const auto author = _data.author; const auto author = _data.author;
const auto prefix = !author.isEmpty() ? u", "_q : QString(); const auto prefix = !author.isEmpty() ? u", "_q : QString();
const auto date = edited + QLocale().toString( const auto date = edited + ((_data.flags & Data::Flag::ForwardedDate)
_data.date.time(), ? langDateTime(_data.date)
QLocale::ShortFormat); : QLocale().toString(_data.date.time(), QLocale::ShortFormat));
const auto afterAuthor = prefix + date; const auto afterAuthor = prefix + date;
const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor); const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor);
const auto authorWidth = st::msgDateFont->width(author); const auto authorWidth = st::msgDateFont->width(author);
@@ -615,6 +616,13 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
if (item->awaitingVideoProcessing()) { if (item->awaitingVideoProcessing()) {
result.flags |= Flag::EstimateDate; result.flags |= Flag::EstimateDate;
} }
if (forwarded
&& forwarded->savedFromPeer
&& forwarded->savedFromMsgId
&& (!item->externalReply())) {
result.date = base::unixtime::parse(forwarded->originalDate);
result.flags |= Flag::ForwardedDate;
}
// We don't want to pass and update it in Data for now. // We don't want to pass and update it in Data for now.
//if (item->unread()) { //if (item->unread()) {
// result.flags |= Flag::Unread; // result.flags |= Flag::Unread;
@@ -42,6 +42,7 @@ public:
Imported = 0x040, Imported = 0x040,
Shortcut = 0x080, Shortcut = 0x080,
EstimateDate = 0x100, EstimateDate = 0x100,
ForwardedDate = 0x200,
//Unread, // We don't want to pass and update it in Date for now. //Unread, // We don't want to pass and update it in Date for now.
}; };
friend inline constexpr bool is_flag_type(Flag) { return true; }; friend inline constexpr bool is_flag_type(Flag) { return true; };