refactor: update Repository.HistoriesFilterMode in Repository.RefreshHistoriesFilters

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-11-20 16:52:30 +08:00
parent 839dab494b
commit efac161b12
No known key found for this signature in database

View file

@ -704,12 +704,7 @@ namespace SourceGit.ViewModels
{ {
var changed = _settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode); var changed = _settings.UpdateHistoriesFilter(tag.Name, Models.FilterType.Tag, mode);
if (changed) if (changed)
{
if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0)
HistoriesFilterMode = mode;
RefreshHistoriesFilters(); RefreshHistoriesFilters();
}
} }
public void SetBranchFilterMode(BranchTreeNode node, Models.FilterMode mode) public void SetBranchFilterMode(BranchTreeNode node, Models.FilterMode mode)
@ -754,9 +749,6 @@ namespace SourceGit.ViewModels
cur = parent; cur = parent;
} while (true); } while (true);
if (mode != Models.FilterMode.None || _settings.HistoriesFilters.Count == 0)
HistoriesFilterMode = mode;
RefreshHistoriesFilters(); RefreshHistoriesFilters();
} }
@ -2073,6 +2065,12 @@ namespace SourceGit.ViewModels
UpdateBranchTreeFilterMode(LocalBranchTrees, filters); UpdateBranchTreeFilterMode(LocalBranchTrees, filters);
UpdateBranchTreeFilterMode(RemoteBranchTrees, filters); UpdateBranchTreeFilterMode(RemoteBranchTrees, filters);
UpdateTagFilterMode(filters); UpdateTagFilterMode(filters);
if (_settings.HistoriesFilters.Count > 0)
HistoriesFilterMode = _settings.HistoriesFilters[0].Mode;
else
HistoriesFilterMode = Models.FilterMode.None;
Task.Run(RefreshCommits); Task.Run(RefreshCommits);
} }