From 0e3d8023dc08d6b4965e71064c3ac5a2f1e4f180 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 11 Feb 2021 18:45:57 +0200
Subject: [PATCH] SL-12795 Fix log session name not updating

---
 indra/newview/llconversationlog.cpp | 3 ++-
 indra/newview/llconversationlog.h   | 2 +-
 indra/newview/llimview.cpp          | 7 +++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index fd59dd26019..a696c99a820 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -398,7 +398,7 @@ void LLConversationLog::deleteBackupLogs()
 	}
 }
 
-void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename)
+void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name)
 {
     conversations_vec_t::iterator conv_it = mConversations.begin();
     for (; conv_it != mConversations.end(); ++conv_it)
@@ -409,6 +409,7 @@ void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::stri
             {
                 LLLogChat::renameLogFile(conv_it->getHistoryFileName(), expected_filename);
                 conv_it->updateHistoryFileName(expected_filename);
+                conv_it->setConversationName(new_session_name);
             }
             break;
         }
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 82e7e597d04..820a5db4914 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -140,7 +140,7 @@ class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObse
 	 */
 	void cache();
     // will check if current name is edentical with the one on disk and will rename the one on disk if it isn't
-	void verifyFilename(const LLUUID& session_id, const std::string &expected_filename);
+	void verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name);
 	bool moveLog(const std::string &originDirectory, const std::string &targetDirectory);
 	void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs);
 	void deleteBackupLogs();
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index b68fec297ad..1059324a167 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -602,10 +602,6 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 	}
 
 	buildHistoryFileName();
-    if (isP2P()) // user's account name can change, but filenames are account name based
-    {
-        LLConversationLog::getInstance()->verifyFilename(mSessionID, mHistoryFileName);
-    }
 	loadHistory();
 
 	// Localizing name of ad-hoc session. STORM-153
@@ -973,6 +969,9 @@ void LLIMModel::LLIMSession::buildHistoryFileName()
 			// Incoming P2P sessions include a name that we can use to build a history file name
 			mHistoryFileName = LLCacheName::buildUsername(mName);
 		}
+
+        // user's account name can change, but filenames and session names are account name based
+        LLConversationLog::getInstance()->verifyFilename(mSessionID, mHistoryFileName, av_name.getCompleteName());
 	}
 	else if (isGroupChat())
 	{
-- 
GitLab