]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix changelog button always indicating new changes. (#41277)
authoreoineoineoin <helloworld@eoinrul.es>
Wed, 5 Nov 2025 09:29:07 +0000 (09:29 +0000)
committerGitHub <noreply@github.com>
Wed, 5 Nov 2025 09:29:07 +0000 (09:29 +0000)
* Refresh changelog button when ServerId is changed

* Listen to specific cvar being changed

Content.Client/Changelog/ChangelogManager.cs

index 657d0cb3acf6c00a55e3852b3de4ad0167ceaddd..545d001aab344c8c1d6624820975ea7777874c41 100644 (file)
@@ -52,6 +52,7 @@ namespace Content.Client.Changelog
             // Open changelog purely to compare to the last viewed date.
             var changelogs = await LoadChangelog();
             UpdateChangelogs(changelogs);
+            _configManager.OnValueChanged(CCVars.ServerId, OnServerIdCVarChanged);
         }
 
         private void UpdateChangelogs(List<Changelog> changelogs)
@@ -81,6 +82,11 @@ namespace Content.Client.Changelog
 
             MaxId = changelog.Entries.Max(c => c.Id);
 
+            CheckLastSeenEntry();
+        }
+
+        private void CheckLastSeenEntry()
+        {
             var path = new ResPath($"/changelog_last_seen_{_configManager.GetCVar(CCVars.ServerId)}");
             if (_resource.UserData.TryReadAllText(path, out var lastReadIdText))
             {
@@ -92,6 +98,11 @@ namespace Content.Client.Changelog
             NewChangelogEntriesChanged?.Invoke();
         }
 
+        private void OnServerIdCVarChanged(string newValue)
+        {
+            CheckLastSeenEntry();
+        }
+
         public Task<List<Changelog>> LoadChangelog()
         {
             return Task.Run(() =>