From 10eb8424afa7af412a25d6aab032395009f5106c Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Mon, 5 Sep 2022 23:57:42 +0300
Subject: [PATCH] SL-3007 Small improvements for auto filling abuse reports #2

---
 indra/newview/llchathistory.cpp | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 4f8182936d2..7ff24f64acf 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -119,6 +119,7 @@ class LLChatHistoryHeader: public LLPanel
 		mSourceType(CHAT_SOURCE_UNKNOWN),
 		mFrom(),
 		mSessionID(),
+        mCreationTime(time_corrected()),
 		mMinUserNameWidth(0),
 		mUserNameFont(NULL),
 		mUserNameTextBox(NULL),
@@ -425,9 +426,24 @@ class LLChatHistoryHeader: public LLPanel
             }
             else
             {
-                // From history. This might be not full.
-                // See LLChatLogParser::parse if it needs to include full date
+                // From history. This might be empty or not full.
+                // See LLChatLogParser::parse
                 time_string = getChild<LLTextBox>("time_box")->getValue().asString();
+
+                // Just add current date if not full.
+                // Should be fine since both times are supposed to be stl
+                if (!time_string.empty() && time_string.size() < 7)
+                {
+                    time_string = "[" + LLTrans::getString("TimeMonth") + "]/["
+                        + LLTrans::getString("TimeDay") + "]/["
+                        + LLTrans::getString("TimeYear") + "] " + time_string;
+
+                    LLSD substitution;
+                    // To avoid adding today's date to yesterday's timestamp,
+                    // use creation time instead of current time
+                    substitution["datetime"] = (S32)mCreationTime;
+                    LLStringUtil::format(time_string, substitution);
+                }
             }
             LLFloaterReporter::showFromChat(mAvatarID, mFrom, time_string, mText);
         }
@@ -1022,7 +1038,8 @@ class LLChatHistoryHeader: public LLPanel
 	std::string			mFrom;
 	LLUUID				mSessionID;
     std::string			mText;
-    F64					mTime;
+    F64					mTime; // IM's frame time
+    time_t				mCreationTime; // Views's time
 
 	S32					mMinUserNameWidth;
 	const LLFontGL*		mUserNameFont;
-- 
GitLab